• R/O
  • SSH
  • HTTPS

owata: Commit


Commit MetaInfo

Revision2 (tree)
Time2008-02-23 12:17:08
Authorbird_may_nike

Log Message

(empty log message)

Change Summary

Incremental Difference

--- trunc/src/psp2ch.c (nonexistent)
+++ trunc/src/psp2ch.c (revision 2)
@@ -0,0 +1,1093 @@
1+
2+#include "pspdialogs.h"
3+#include <stdio.h>
4+#include <string.h>
5+#include <malloc.h>
6+#include <time.h>
7+#include <sys/unistd.h>
8+#include <arpa/inet.h>
9+#include <pspdebug.h>
10+#include <pspctrl.h>
11+#include <pspsdk.h>
12+#include <pspwlan.h>
13+#include "psp2ch.h"
14+#include "psp2chIta.h"
15+#include "psp2chThread.h"
16+#include "psp2chRes.h"
17+#include "psp2chFavorite.h"
18+#include "psp2chSearch.h"
19+#include "utf8.h"
20+#include "pg.h"
21+#include "cp932.h"
22+#include "intraFont.h"
23+#include "libCat/Cat_Network.h"
24+#include "libCat/Cat_Resolver.h"
25+
26+extern int running; //main.c
27+extern char cwDir[256]; //main.c
28+extern void* framebuffer; // pg.c
29+
30+int tateFlag = 0;
31+int sel = 0;
32+const char* userAgent = "Monazilla/1.00 (Compatible; PSP; ja) owata\(^o^)/0.4.3";
33+const char* logDir = "log";
34+char cookie[128] = {0};
35+SceCtrlData pad;
36+SceCtrlData oldPad;
37+MESSAGE_HELPER mh;
38+S_2CH_HEADER_COLOR resHeaderColor;
39+S_2CH_RES_COLOR resColor;
40+S_2CH_BAR_COLOR resBarColor;
41+S_2CH_HEADER_COLOR resAHeaderColor;
42+S_2CH_RES_COLOR resAColor;
43+S_2CH_BAR_COLOR resABarColor;
44+S_2CH_MENU_COLOR menuColor;
45+S_2CH_THREAD_COLOR threadColor;
46+S_2CH_ITA_COLOR cateOnColor;
47+S_2CH_ITA_COLOR cateOffColor;
48+S_2CH_FORM_COLOR formColor;
49+
50+/*********************************
51+メインループ
52+runningが真の間ループ(×ボタンの終了やhomeボタンでの終了でrunningが0)
53+セレクター(sel)で各関数へ分岐
54+レス表示はお気に入り、板一覧、レス表示中リンクジャンプ、全板検索結果からラッパー関数へ移動
55+移動元に戻るためretSelを使用(レス表示からの"戻る"でsel = retSel実行)
56+全板検索も移動元に戻るためretSel使用
57+*********************************/
58+int psp2ch(void)
59+{
60+ int retSel = 0;
61+
62+ sceCtrlSetSamplingCycle(0);
63+ sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
64+ while (running)
65+ {
66+ switch (sel)
67+ {
68+ case 1:
69+ psp2chFavorite();
70+ retSel = 1;
71+ break;
72+ case 2:
73+ psp2chIta();
74+ retSel = 2;
75+ break;
76+ case 3:
77+ psp2chThread();
78+ retSel = 3;
79+ break;
80+ case 4:
81+ retSel = psp2chFavoriteRes(retSel);
82+ break;
83+ case 5:
84+ retSel = psp2chThreadRes(retSel);
85+ break;
86+ case 6:
87+ retSel = psp2chJumpRes(retSel);
88+ break;
89+ case 7:
90+ psp2chSearch(retSel);
91+ retSel = 7;
92+ break;
93+ case 8:
94+ psp2chSearchRes(retSel);
95+ break;
96+ default:
97+ psp2chStart();
98+ break;
99+ }
100+ }
101+ return 0;
102+}
103+
104+/*****************************
105+スタート画面
106+*****************************/
107+void psp2chStart(void)
108+{
109+ if(sceCtrlPeekBufferPositive(&pad, 1))
110+ {
111+ if (pad.Buttons != oldPad.Buttons)
112+ {
113+ oldPad = pad;
114+ if(pad.Buttons & PSP_CTRL_CROSS)
115+ {
116+ if (psp2chOwata())
117+ {
118+ return;
119+ }
120+ }
121+ else if(pad.Buttons & PSP_CTRL_START)
122+ {
123+ sel = 2;
124+ return;
125+ }
126+ else if(pad.Buttons & PSP_CTRL_CIRCLE)
127+ {
128+ sel = 1;
129+ return;
130+ }
131+ }
132+ pgPrintMona();
133+ pgCopy(0, 0);
134+ sceDisplayWaitVblankStart();
135+ framebuffer = sceGuSwapBuffers();
136+ }
137+}
138+
139+/*****************************
140+終了画面
141+*****************************/
142+int psp2chOwata(void)
143+{
144+ memset(&mh,0,sizeof(MESSAGE_HELPER));
145+ mh.options = PSP_UTILITY_MSGDIALOG_OPTION_TEXT | PSP_UTILITY_MSGDIALOG_OPTION_YESNO_BUTTONS;
146+ strcpy(mh.message, TEXT_3);
147+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
148+ sceCtrlPeekBufferPositive(&oldPad, 1);
149+ if (mh.buttonPressed == PSP_UTILITY_MSGDIALOG_RESULT_YES)
150+ {
151+ tateFlag = 0;
152+ pgPrintOwata();
153+ pgCopy(0, 0);
154+ framebuffer = sceGuSwapBuffers();
155+ pgWaitVn(10);
156+ running = 0;
157+ return 1;
158+ }
159+ return 0;
160+}
161+
162+/*****************************
163+カーソル移動ルーチン
164+S_2CH_SCREEN構造体の
165+start:表示開始行
166+select:カーソル選択行
167+を変更しRボタン情報を返す
168+*****************************/
169+int psp2chCursorSet(S_2CH_SCREEN* line)
170+{
171+ static int keyStart = 0, keyRepeat = 0;
172+ static clock_t keyTime = 0;
173+ int lineEnd, rMenu;
174+
175+ if (tateFlag)
176+ {
177+ lineEnd = 35;
178+ }
179+ else
180+ {
181+ lineEnd = 20;
182+ }
183+ if(pad.Buttons & PSP_CTRL_RTRIGGER)
184+ {
185+ rMenu = 1;
186+ }
187+ else
188+ {
189+ rMenu = 0;
190+ }
191+ if (pad.Buttons != oldPad.Buttons || keyRepeat)
192+ {
193+ if (pad.Buttons != oldPad.Buttons)
194+ {
195+ keyStart = 1;
196+ }
197+ else
198+ {
199+ keyStart = 0;
200+ }
201+ keyTime = clock();
202+ keyRepeat = 0;
203+ if((pad.Buttons & PSP_CTRL_UP && !tateFlag) || (pad.Buttons & PSP_CTRL_RIGHT && tateFlag))
204+ {
205+ if (rMenu)
206+ {
207+ line->start = 0;
208+ line->select = 0;
209+ }
210+ else
211+ {
212+ line->select--;
213+ if (line->select < 0)
214+ {
215+ line->select = 0;
216+ }
217+ if (line->select < line->start)
218+ {
219+ line->start = line->select;
220+ }
221+ }
222+ }
223+ if((pad.Buttons & PSP_CTRL_DOWN && !tateFlag) || (pad.Buttons & PSP_CTRL_LEFT && tateFlag))
224+ {
225+ if (rMenu)
226+ {
227+ line->start = line->count - lineEnd;
228+ if (line->start < 0)
229+ {
230+ line->start = 0;
231+ }
232+ line->select = line->count - 1;
233+ }
234+ else
235+ {
236+ line->select++;
237+ if (line->select >= line->count)
238+ {
239+ line->select = line->count -1;
240+ }
241+ if (line->select >= line->start + lineEnd)
242+ {
243+ line->start = line->select - lineEnd + 1;
244+ }
245+ if (line->start < 0)
246+ {
247+ line->start = 0;
248+ }
249+ }
250+ }
251+ if((pad.Buttons & PSP_CTRL_LEFT && !tateFlag) || (pad.Buttons & PSP_CTRL_UP && tateFlag))
252+ {
253+ if (line->select == line->start)
254+ {
255+ line->start -= lineEnd;
256+ if (line->start < 0)
257+ {
258+ line->start = 0;
259+ }
260+ }
261+ line->select = line->start;
262+ }
263+ if((pad.Buttons & PSP_CTRL_RIGHT && !tateFlag) || (pad.Buttons & PSP_CTRL_DOWN && tateFlag))
264+ {
265+ if (line->select == line->start + lineEnd - 1)
266+ {
267+ line->start += lineEnd;
268+ if (line->start + lineEnd >= line->count)
269+ {
270+ line->start = line->count - lineEnd;
271+ }
272+ if (line->start < 0)
273+ {
274+ line->start = 0;
275+ }
276+ }
277+ line->select = line->start + lineEnd - 1;
278+ if (line->select >= line->count)
279+ {
280+ line->select = line->count -1;
281+ }
282+ }
283+ }
284+ else
285+ {
286+ if (keyStart)
287+ {
288+ if (clock() - keyTime > 400000)
289+ {
290+ keyRepeat = 1;
291+ }
292+ }
293+ else
294+ {
295+ if (clock() - keyTime > 5000)
296+ {
297+ keyRepeat = 1;
298+ }
299+ }
300+ }
301+ return rMenu;
302+}
303+
304+/***********************************
305+外部カラーセット
306+color.iniを読み込んで各カラーをセット
307+************************************/
308+#define setColor(A, B, C) \
309+ p = strstr(buf, (A));\
310+ if (p) {\
311+ p = strstr(p, "0x");\
312+ if(p){\
313+ p+=2;\
314+ sscanf(p, "%X", &(B));\
315+ }\
316+ else{(B) = (C);}\
317+ }\
318+ else{(B) = (C);}
319+void psp2chSetColor(void)
320+{
321+ SceUID fd;
322+ SceIoStat st;
323+ char file[256];
324+ char *buf;
325+ char *p;
326+ int ret;
327+
328+ sprintf(file, "%s/color.ini", cwDir);
329+ ret = sceIoGetstat(file, &st);
330+ if (ret >= 0)
331+ {
332+ buf = (char*)malloc(st.st_size + 1);
333+ if (buf)
334+ {
335+ fd = sceIoOpen(file, PSP_O_RDONLY, 0777);
336+ if (fd >= 0)
337+ {
338+ sceIoRead(fd, buf, st.st_size);
339+ sceIoClose(fd);
340+ buf[st.st_size] = '\0';
341+ setColor("RES_NUMBER", resHeaderColor.num, RED);
342+ setColor("RES_NAME_HEAD", resHeaderColor.name1, BLACK);
343+ setColor("RES_NAME_BODY", resHeaderColor.name2, RGB(0x00, 0xCC, 0x00));
344+ setColor("RES_MAIL", resHeaderColor.mail, RGB(0x99, 0x99, 0x99));
345+ setColor("RES_DATE", resHeaderColor.date, BLACK);
346+ setColor("RES_ID_HEAD_1", resHeaderColor.id1, BLUE);
347+ setColor("RES_ID_HEAD_2", resHeaderColor.id2, RED);
348+ setColor("RES_ID_BODY", resHeaderColor.id3, BLUE);
349+ setColor("RES_TEXT", resColor.text, BLACK);
350+ setColor("RES_BG", resColor.bg, RGB(0xE0, 0xE0, 0xE0));
351+ setColor("RES_LINK", resColor.link, BLUE);
352+ setColor("RES_BAR_SLIDER", resBarColor.slider, YELLOW);
353+ setColor("RES_BAR_BG", resBarColor.bg, RGB(0x66, 0x66, 0xFF));
354+
355+ setColor("RES_A_NUMBER", resAHeaderColor.num, RED);
356+ setColor("RES_A_NAME_HEAD", resAHeaderColor.name1, BLACK);
357+ setColor("RES_A_NAME_BODY", resAHeaderColor.name2, RGB(0x00, 0xCC, 0x00));
358+ setColor("RES_A_MAIL", resAHeaderColor.mail, RGB(0x99, 0x99, 0x99));
359+ setColor("RES_A_DATE", resAHeaderColor.date, BLACK);
360+ setColor("RES_A_ID_HEAD_1", resAHeaderColor.id1, BLUE);
361+ setColor("RES_A_ID_HEAD_2", resAHeaderColor.id2, RED);
362+ setColor("RES_A_ID_BODY", resAHeaderColor.id3, BLUE);
363+ setColor("RES_A_TEXT", resAColor.text, BLACK);
364+ setColor("RES_A_BG", resAColor.bg, RGB(0xFF, 0xFF, 0xCC));
365+ setColor("RES_A_LINK", resAColor.link, BLUE);
366+ setColor("RES_A_BAR_SLIDER", resABarColor.slider, RGB(0x00, 0xFF, 0xCC));
367+ setColor("RES_A_BAR_BG", resABarColor.bg, RGB(0xCC, 0xFF, 0xFF));
368+
369+ setColor("MENU_TEXT", menuColor.text, WHITE);
370+ setColor("MENU_BG", menuColor.bg, BLACK);
371+ setColor("MENU_BATTERY_1", menuColor.bat1, GREEN);
372+ setColor("MENU_BATTERY_2", menuColor.bat2, YELLOW);
373+ setColor("MENU_BATTERY_3", menuColor.bat3, RED);
374+
375+ setColor("THREAD_NUMBER", threadColor.num, RED);
376+ setColor("THREAD_CATEGORY", threadColor.category, RED);
377+ setColor("THREAD_TEXT_1", threadColor.text1, BLUE);
378+ setColor("THREAD_TEXT_2", threadColor.text2, RED);
379+ setColor("THREAD_BG", threadColor.bg, RGB(0xCC, 0xFF, 0xCC));
380+ setColor("THREAD_COUNT_1", threadColor.count1, BLACK);
381+ setColor("THREAD_COUNT_2", threadColor.count2, BLACK);
382+ setColor("THREAD_SELECT_NUMBER", threadColor.s_num, RED);
383+ setColor("THREAD_SELECT_CATEGORY", threadColor.s_category, RGB(0x99, 0x00, 0x00));
384+ setColor("THREAD_SELECT_TEXT_1", threadColor.s_text1, RGB(0x00, 0x00, 0x99));
385+ setColor("THREAD_SELECT_TEXT_2", threadColor.s_text2, RGB(0x99, 0x00, 0x00));
386+ setColor("THREAD_SELECT_BG", threadColor.s_bg, GRAY);
387+ setColor("THREAD_SELECT_COUNT_1", threadColor.s_count1, BLACK);
388+ setColor("THREAD_SELECT_COUNT_2", threadColor.s_count2, BLACK);
389+
390+ setColor("CATE_ON_TEXT", cateOnColor.cate.text, RGB(0xCC, 0x33, 0x00));
391+ setColor("CATE_ON_BG", cateOnColor.cate.bg, WHITE);
392+ setColor("CATE_ON_S_TEXT", cateOnColor.cate.s_text, WHITE);
393+ setColor("CATE_ON_S_BG", cateOnColor.cate.s_bg, RGB(0xCC, 0x33, 0x00));
394+ setColor("ITA_OFF_TEXT", cateOnColor.ita.text, RGB(0x66, 0x66, 0xFF));
395+ setColor("ITA_OFF_BG", cateOnColor.ita.bg, GRAY);
396+ setColor("ITA_OFF_S_TEXT", cateOnColor.ita.s_text, GRAY);
397+ setColor("ITA_OFF_S_BG", cateOnColor.ita.s_bg, RGB(0x66, 0x66, 0xFF));
398+ setColor("CATE_ON_BASE", cateOnColor.base, WHITE);
399+
400+ setColor("CATE_OFF_TEXT", cateOffColor.cate.text, RGB(0x88, 0x99, 0x66));
401+ setColor("CATE_OFF_BG", cateOffColor.cate.bg, GRAY);
402+ setColor("CATE_OFF_S_TEXT", cateOffColor.cate.s_text, GRAY);
403+ setColor("CATE_OFF_S_BG", cateOffColor.cate.s_bg, RGB(0x88, 0x99, 0x66));
404+ setColor("ITA_ON_TEXT", cateOffColor.ita.text, BLUE);
405+ setColor("ITA_ON_BG", cateOffColor.ita.bg, WHITE);
406+ setColor("ITA_ON_S_TEXT", cateOffColor.ita.s_text, WHITE);
407+ setColor("ITA_ON_S_BG", cateOffColor.ita.s_bg, BLUE);
408+ setColor("CATE_OFF_BASE", cateOffColor.base, WHITE);
409+
410+ setColor("FORM_TITLE_TEXT", formColor.title, WHITE);
411+ setColor("FORM_TITLE_BG", formColor.title_bg, RED);
412+ free(buf);
413+ return;
414+ }
415+ else
416+ {
417+ free(buf);
418+ }
419+ }
420+ }
421+ // iniファイルがない時のデフォルト
422+ // レス本文
423+ resHeaderColor.num = RED;
424+ resHeaderColor.name1 = BLACK;
425+ resHeaderColor.name2 = RGB(0x00, 0xCC, 0x00);
426+ resHeaderColor.mail = RGB(0x99, 0x99, 0x99);
427+ resHeaderColor.date = BLACK;
428+ resHeaderColor.id1 = BLUE;
429+ resHeaderColor.id2 = RED;
430+ resHeaderColor.id3 = BLUE;
431+ resColor.text = BLACK;
432+ resColor.bg = RGB(0xE0, 0xE0, 0xE0);
433+ resColor.link = BLUE;
434+ resBarColor.slider = YELLOW;
435+ resBarColor.bg = RGB(0x66, 0x66, 0xFF);
436+ // レスアンカー 
437+ resAHeaderColor.num = RED;
438+ resAHeaderColor.name1 = BLACK;
439+ resAHeaderColor.name2 = RGB(0x00, 0xCC, 0x00);
440+ resAHeaderColor.mail = RGB(0x99, 0x99, 0x99);
441+ resAHeaderColor.date = BLACK;
442+ resAHeaderColor.id1 = BLUE;
443+ resAHeaderColor.id2 = RED;
444+ resAHeaderColor.id3 = BLUE;
445+ resAColor.text = BLACK;
446+ resAColor.bg = RGB(0xFF, 0xFF, 0xCC);
447+ resAColor.link = BLUE;
448+ resABarColor.slider = RGB(0x00, 0xFF, 0xCC);
449+ resABarColor.bg = RGB(0xCC, 0xFF, 0xFF);
450+ // メニューバー 
451+ menuColor.text = WHITE;
452+ menuColor.bg = BLACK;
453+ menuColor.bat1 = GREEN;
454+ menuColor.bat2 = YELLOW;
455+ menuColor.bat3 = RED;
456+ // スレッド一覧
457+ threadColor.num = RED;
458+ threadColor.category = RED;
459+ threadColor.text1 = BLUE;
460+ threadColor.text2 = RED;
461+ threadColor.bg = RGB(0xCC, 0xFF,0xCC);
462+ threadColor.count1 = BLACK;
463+ threadColor.count2 = BLACK;
464+ threadColor.s_num = RED;
465+ threadColor.s_category = RGB(0x99, 0x00, 0x00);
466+ threadColor.s_text1 = RGB(0x00, 0x00, 0x99);
467+ threadColor.s_text2 = RGB(0x99, 0x00, 0x00);
468+ threadColor.s_bg = GRAY;
469+ threadColor.s_count1 = BLACK;
470+ threadColor.s_count2 = BLACK;
471+ // カテゴリー・板一覧
472+ cateOnColor.cate.text = RGB(0xCC, 0x33, 0x00);
473+ cateOnColor.cate.bg = WHITE;
474+ cateOnColor.cate.s_text = WHITE;
475+ cateOnColor.cate.s_bg = RGB(0xCC, 0x33, 0x00);
476+ cateOnColor.ita.text = RGB(0x66, 0x66, 0xFF);
477+ cateOnColor.ita.bg = GRAY;
478+ cateOnColor.ita.s_text = GRAY;
479+ cateOnColor.ita.s_bg = RGB(0x66, 0x66, 0xFF);
480+ cateOnColor.base = WHITE;
481+ cateOffColor.cate.text = RGB(0x88, 0x99, 0x66);
482+ cateOffColor.cate.bg = GRAY;
483+ cateOffColor.cate.s_text = GRAY;
484+ cateOffColor.cate.s_bg = RGB(0x88, 0x99, 0x66);
485+ cateOffColor.ita.text = BLUE;
486+ cateOffColor.ita.bg = WHITE;
487+ cateOffColor.ita.s_text = WHITE;
488+ cateOffColor.ita.s_bg = BLUE;
489+ cateOffColor.base = WHITE;
490+ // 送信フォーム
491+ formColor.title = WHITE;
492+ formColor.title_bg = RED;
493+}
494+
495+/***********************************
496+ネットモジュールのロード初期化
497+************************************/
498+int psp2chInit(void)
499+{
500+ int ret;
501+
502+ ret = sceUtilityLoadNetModule(PSP_NET_MODULE_COMMON);
503+ if (ret < 0)
504+ {
505+ memset(&mh,0,sizeof(MESSAGE_HELPER));
506+ strcpy(mh.message, "Load module common errror");
507+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
508+ return ret;
509+ }
510+ ret = sceUtilityLoadNetModule(PSP_NET_MODULE_INET);
511+ if (ret < 0)
512+ {
513+ memset(&mh,0,sizeof(MESSAGE_HELPER));
514+ strcpy(mh.message, "Load module inet errror");
515+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
516+ return ret;
517+ }
518+ ret = Cat_NetworkInit();
519+ if (ret < 0)
520+ {
521+ memset(&mh,0,sizeof(MESSAGE_HELPER));
522+ strcpy(mh.message, "Cat_NetworkInit errror");
523+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
524+ return ret;
525+ }
526+ psp2chSetColor();
527+ return 0;
528+}
529+
530+/**************************
531+終了前の後始末
532+**************************/
533+int psp2chTerm(void)
534+{
535+ Cat_NetworkTerm();
536+ return 0;
537+}
538+
539+/*****************************
540+アクセスポイントへ接続してソケット作成
541+成功時にはソケット(>=0)を返す
542+失敗時には<0を返す
543+psp2chRequest()とpsp2chPost()から呼ばれます。
544+*****************************/
545+int psp2chOpenSocket(void)
546+{
547+ int mySocket, ret;
548+
549+ ret = psp2chApConnect();
550+ if (ret < 0 && ret != 0x80110405)
551+ {
552+ return ret;
553+ }
554+ mySocket = socket(PF_INET, SOCK_STREAM, 0 );
555+#ifdef DEBUG
556+ pspDebugScreenPrintf("socket = %d\n", mySocket);
557+#endif
558+ return mySocket;
559+}
560+
561+/*****************************
562+ソケットを閉じる
563+*****************************/
564+int psp2chCloseSocket(int mySocket)
565+{
566+ shutdown(mySocket, SHUT_RDWR);
567+ return close(mySocket);
568+}
569+
570+/*****************************
571+名前解決 ホスト名をIPアドレスに変換
572+Sfiya猫さんのパッチ使用
573+*****************************/
574+int psp2chResolve(const char* host, struct in_addr* addr)
575+{
576+ SceUID fd;
577+ char buf[256];
578+ char hosts[2048];
579+ char *p;
580+
581+ sprintf(buf, " %s のアドレスを解決しています", host);
582+ pgMenuBar(buf);
583+ sceDisplayWaitVblankStart();
584+ framebuffer = sceGuSwapBuffers();
585+ sprintf(buf, "%s/hosts", cwDir);
586+ fd = sceIoOpen(buf, PSP_O_RDONLY, 0777);
587+ if (fd >= 0)
588+ {
589+ sceIoRead(fd, hosts, sizeof(hosts));
590+ sceIoClose(fd);
591+ p = strstr(hosts, host);
592+ if (p)
593+ {
594+ *p = '\0';
595+ p = strrchr(hosts, '\n');
596+ if (p)
597+ {
598+ sscanf(p, " %s", buf);
599+ if (inet_aton(buf, addr))
600+ {
601+ return 0;
602+ }
603+ }
604+ }
605+ }
606+ if(Cat_ResolverURL( host, addr ) < 0 )
607+ {
608+ pgMenuBar(" Cat_ResolverURL error");
609+ sceDisplayWaitVblankStart();
610+ framebuffer = sceGuSwapBuffers();
611+ return -1;
612+ }
613+ return 0;
614+}
615+
616+/*****************************
617+HTTP で GETリクエスト
618+ソケットを作成
619+アドレス解決してリクエストヘッダを送信します
620+成功時にはソケット(>=0)を返します
621+*****************************/
622+int psp2chRequest(const char* host, const char* path, const char* header) {
623+ int mySocket;
624+ int ret;
625+ char requestText[512];
626+ char buf[512];
627+ struct sockaddr_in sain;
628+ struct in_addr addr;
629+ char *p;
630+
631+ mySocket = psp2chOpenSocket();
632+ if (mySocket < 0) {
633+ return mySocket;
634+ }
635+ p = strrchr(path, '#');
636+ if (p)
637+ {
638+ *p = '\0';
639+ }
640+ sprintf(requestText,
641+ "GET /%s HTTP/1.1\r\n"
642+ "Host: %s\r\n"
643+ "User-Agent: %s\r\n"
644+ "%s"
645+ "Connection: close\r\n\r\n"
646+ , path, host, userAgent, header);
647+ ret = psp2chResolve(host, &addr);
648+ if (ret < 0) {
649+ return ret;
650+ }
651+ sprintf(buf, " %s (%s)", host, inet_ntoa(addr));
652+ pgMenuBar(buf);
653+ sceDisplayWaitVblankStart();
654+ framebuffer = sceGuSwapBuffers();
655+ // Tell the socket to connect to the IP address we found, on port 80 (HTTP)
656+ sain.sin_family = AF_INET;
657+ sain.sin_port = htons(80);
658+ sain.sin_addr.s_addr = addr.s_addr;
659+ sprintf(buf, " http://%s/%s に接続しています", host, path);
660+ pgMenuBar(buf);
661+ sceDisplayWaitVblankStart();
662+ framebuffer = sceGuSwapBuffers();
663+ ret = connect(mySocket,(struct sockaddr *)&sain, sizeof(sain) );
664+ if (ret < 0) {
665+ memset(&mh,0,sizeof(MESSAGE_HELPER));
666+ strcpy(mh.message, "Connect errror");
667+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
668+ sceCtrlPeekBufferPositive(&oldPad, 1);
669+ return ret;
670+ }
671+ pgMenuBar("接続しました");
672+ sceDisplayWaitVblankStart();
673+ framebuffer = sceGuSwapBuffers();
674+#ifdef DEBUG
675+ pspDebugScreenPrintf("send request\n%s\n", requestText);
676+#endif
677+ // send our request
678+ send(mySocket, requestText, strlen(requestText), 0 );
679+
680+ return mySocket;
681+}
682+
683+/*****************************
684+HTTP で POST 送信します。
685+ソケット作成
686+アドレス解決してヘッダとボディを送信
687+成功時にはソケット(>=0)を返す
688+*****************************/
689+int psp2chPost(char* host, char* dir, int dat, char* cook, char* body)
690+{
691+ int mySocket;
692+ int ret;
693+ char requestText[512];
694+ char buf[512];
695+ struct sockaddr_in sain;
696+ struct in_addr addr;
697+
698+ mySocket = psp2chOpenSocket();
699+ if (mySocket < 0) {
700+ return -1;
701+ }
702+ sprintf(requestText,
703+ "POST /test/bbs.cgi HTTP/1.1\r\n"
704+ "Host: %s\r\n"
705+ "User-Agent: %s\r\n"
706+ "Referer: http://%s/test/read.cgi/%s/%d/l50\r\n"
707+ "Cookie: %s\r\n"
708+ "Content-Type: application/x-www-form-urlencoded\r\n"
709+ "Content-Length: %d\r\n\r\n"
710+ , host, userAgent, host, dir, dat, cook, strlen(body));
711+ ret = psp2chResolve(host, &addr);
712+ if (ret < 0) {
713+ return -1;
714+ }
715+ sprintf(buf, " %s (%s)", host, inet_ntoa(addr));
716+ pgMenuBar(buf);
717+ sceDisplayWaitVblankStart();
718+ framebuffer = sceGuSwapBuffers();
719+ // Tell the socket to connect to the IP address we found, on port 80 (HTTP)
720+ sain.sin_family = AF_INET;
721+ sain.sin_port = htons(80);
722+ sain.sin_addr.s_addr = addr.s_addr;
723+ sprintf(buf, " http://%s/test/bbs.cgi に接続しています", host);
724+ pgCopy(0, 0);
725+ pgMenuBar(buf);
726+ sceDisplayWaitVblankStart();
727+ framebuffer = sceGuSwapBuffers();
728+ ret = connect( mySocket,(struct sockaddr *)&sain, sizeof(sain) );
729+ if (ret < 0) {
730+ memset(&mh,0,sizeof(MESSAGE_HELPER));
731+ sprintf(mh.message, "Can't connect bbs.cgi");
732+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
733+ return -1;
734+ }
735+#ifdef DEBUG
736+ pspDebugScreenPrintf("send request\n%s\n", requestText);
737+#endif
738+ // send our request
739+ send(mySocket, requestText, strlen(requestText), 0 );
740+ send(mySocket, body, strlen(body), 0 );
741+ return mySocket;
742+}
743+
744+/*****************************
745+ソケットから最初の1行(ステータスライン)を読み込みます。
746+ステータスコードをintに変換して返す
747+HTTP/1.1 200 OK
748+なら200を返す
749+*****************************/
750+int psp2chGetStatusLine(int mySocket)
751+{
752+ char in;
753+ char incomingBuffer[256];
754+ int i = 0;
755+ int verMajor, verMinor, code;
756+ char phrase[256];
757+
758+ do
759+ {
760+ if (recv( mySocket, &in, 1, 0 ) == 0)
761+ {
762+ return -1;
763+ }
764+ incomingBuffer[i] = in;
765+ if (++i > 255)
766+ {
767+ return -1;
768+ }
769+ } while (in != '\n');
770+ incomingBuffer[i] = '\0';
771+ pgMenuBar(incomingBuffer);
772+ sceDisplayWaitVblankStart();
773+ framebuffer = sceGuSwapBuffers();
774+ sscanf(incomingBuffer, "HTTP/%d.%d %d %s\r\n", &verMajor, &verMinor, &code, phrase);
775+ return code;
776+}
777+
778+/*****************************
779+ソケットからレスポンスヘッダを読み込みます。
780+HTTP_HEADERS構造体に
781+Content-Length
782+Content-Type
783+Last-Modified
784+ETag
785+の内容がコピーされます。
786+cookie[]にSet-Cookieの内容が追加されます。
787+Content-Lengthがintで返されます
788+Content-Lengthを返さない場合もあるので注意(CGI等)
789+*****************************/
790+int psp2chGetHttpHeaders(int mySocket, HTTP_HEADERS* header)
791+{
792+ int i = 0;
793+ char in;
794+ char incomingBuffer[256];
795+ int contentLength = 0;
796+ char *p;
797+
798+ while(recv(mySocket, &in, 1, 0) > 0) // if recv returns 0, the socket has been closed.
799+ {
800+ if (in == '\r')
801+ {
802+ continue;
803+ }
804+ incomingBuffer[i] = in;
805+ i++;
806+ if (in == '\n')
807+ {
808+ incomingBuffer[i] = 0;
809+ if (incomingBuffer[0] == '\n') // End of headers
810+ {
811+ break;
812+ }
813+ if (strstr(incomingBuffer, "Content-Length:"))
814+ {
815+ sscanf(incomingBuffer, "Content-Length: %d\n", &contentLength);
816+ header->Content_Length = contentLength;
817+ }
818+ else if (strstr(incomingBuffer, "Content-Type:"))
819+ {
820+ strcpy(header->Content_Type, &incomingBuffer[14]);
821+ }
822+ else if (strstr(incomingBuffer, "Last-Modified:"))
823+ {
824+ strcpy(header->Last_Modified, &incomingBuffer[15]);
825+ }
826+ else if (strstr(incomingBuffer, "ETag:"))
827+ {
828+ strcpy(header->ETag, &incomingBuffer[6]);
829+ }
830+ else if (strstr(incomingBuffer, "Set-Cookie:"))
831+ {
832+ p = strchr(incomingBuffer, ';');
833+ *p = '\0';
834+ if (cookie[0])
835+ {
836+ strcat(cookie, "; ");
837+ }
838+ strcat(cookie, &incomingBuffer[12]);
839+ }
840+#ifdef DEBUG
841+ pspDebugScreenPrintf("%s", incomingBuffer);
842+#endif
843+ i = 0;
844+ }
845+ }
846+ return contentLength;
847+}
848+
849+static void draw_callback( void* pvUserData )
850+{
851+ // 描画処理
852+ // ダイアログ表示のさいの背景を描画する
853+
854+ minimalRender();
855+}
856+
857+static void screen_update_callback( void* pvUserData ) {
858+ // 更新処理
859+ // フレームバッファのスワップなど
860+
861+ sceGuSync( 0, 0 );
862+ sceDisplayWaitVblankStartCB();
863+ framebuffer = sceGuSwapBuffers();
864+}
865+
866+/*****************************
867+指定された設定番号のアクセスポイントに接続します
868+psp2chApConnect()から呼ばれます。
869+*****************************/
870+int connect_to_apctl(int config)
871+{
872+ int err;
873+ int stateLast = -1;
874+ int state;
875+ char buf[32];
876+ clock_t time;
877+
878+ err = sceNetApctlConnect(config);
879+ if (err != 0)
880+ {
881+ memset(&mh,0,sizeof(MESSAGE_HELPER));
882+ strcpy(mh.message, "sceNetApctlConnect error");
883+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
884+ return 0;
885+ }
886+
887+ pgMenuBar(" Connecting...");
888+ sceDisplayWaitVblankStart();
889+ framebuffer = sceGuSwapBuffers();
890+ time = clock();
891+ while (1)
892+ {
893+ err = sceNetApctlGetState(&state);
894+ if (err != 0)
895+ {
896+ memset(&mh,0,sizeof(MESSAGE_HELPER));
897+ sprintf(mh.message, "sceNetApctlGetState error\n0x%X", err);
898+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
899+ break;
900+ }
901+ if (state == 2)
902+ {
903+ strcpy(buf, " アクセスポイントに接続中です。");
904+ stateLast = state;
905+ }
906+ if (state == 3)
907+ {
908+ strcpy(buf, " IPアドレスを取得中です。");
909+ stateLast = state;
910+ }
911+ if (state == 4)
912+ {
913+ break; // connected with static IP
914+ }
915+ pgMenuBar(buf);
916+ sceDisplayWaitVblankStart();
917+ framebuffer = sceGuSwapBuffers();
918+ if (clock() > time + 1000000 * 8)
919+ {
920+ break;
921+ }
922+ }
923+ if (state != 4)
924+ {
925+ pgMenuBar(" 接続に失敗しました。");
926+ }
927+ else
928+ {
929+ pgMenuBar(" 接続しました。");
930+ Cat_ResolverInitEngine();
931+ }
932+ sceDisplayWaitVblankStart();
933+ framebuffer = sceGuSwapBuffers();
934+ return 0;
935+}
936+
937+/*****************************
938+PSP内のアクセスポイント設定を検索します
939+設定が2個以上あれば選択ダイアログを表示します。
940+設定が1個のみの場合はその値で接続します。
941+設定がない場合は-1が返されます。
942+*****************************/
943+int psp2chApConnect(void)
944+{
945+ struct
946+ {
947+ int index;
948+ char name[128];
949+ } ap[2];
950+ int count = 0;
951+ int i;
952+ char buf[32];
953+
954+ memset(&mh,0,sizeof(MESSAGE_HELPER));
955+ mh.options = PSP_UTILITY_MSGDIALOG_OPTION_TEXT;
956+ if (sceWlanGetSwitchState() == 0)
957+ {
958+ strcpy(mh.message, TEXT_1);
959+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
960+ return -1;
961+ }
962+ else if (sceWlanDevIsPowerOn() == 0)
963+ {
964+ strcpy(mh.message, TEXT_2);
965+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
966+ return -1;
967+ }
968+ if (sceNetApctlGetInfo(8, buf) == 0)
969+ {
970+ // IP取得済み
971+ return 0;
972+ }
973+ pgMenuBar("接続の設定を検索しています...");
974+ pgWaitVn(2);
975+ framebuffer = sceGuSwapBuffers();
976+ for (i = 1; i < 100; i++) // skip the 0th connection
977+ {
978+ if (sceUtilityCheckNetParam(i) != 0) continue; // more
979+ sceUtilityGetNetParam(i, 0, (netData*) ap[count].name);
980+ ap[count].index = i;
981+ count++;
982+ if (count > 1) break; // no more room
983+ }
984+ if (count == 1)
985+ {
986+ return connect_to_apctl(ap[0].index);
987+ }
988+ else if (count > 1)
989+ {
990+ // 返り値 < 0 : エラー
991+ // 返り値 = 0 : 接続した
992+ // 返り値 > 0 : キャンセルされた
993+ return Cat_NetworkConnect( draw_callback, screen_update_callback, 0 );
994+ // 全部0なのかな???
995+ }
996+ return -1;
997+}
998+
999+/*****************************
1000+OnScreenKeyboardで文字入力
1001+title: OSKの右下に表示されるタイトル文字列(SJIS)
1002+text:入力文字を保存するポインタ
1003+num:入力文字列の長さ
1004+lines:入力文字列の行数
1005+OSKからはワイド文字(UCS)で帰ってくるのでSJISに変換しています。
1006+*****************************/
1007+void psp2chGets(char* title, char* text, int num, int lines)
1008+{
1009+ unsigned short* wc;
1010+ unsigned char* p;
1011+ char* s;
1012+ int sjis, i;
1013+ unsigned short string[128];
1014+ unsigned short pretext[256];
1015+ OSK_HELPER helper;
1016+ char* buf = "人生オワタ\(^o^)/";
1017+
1018+ if (num > 256)
1019+ {
1020+ num = 256;
1021+ }
1022+ /* sjis => ucs */
1023+ if (title && *title != '\0')
1024+ {
1025+ p = (unsigned char*)title;
1026+ }
1027+ else
1028+ {
1029+ p = (unsigned char*)buf;
1030+ }
1031+ i = 0;
1032+ while (*p && i < 127)
1033+ {
1034+ sjis = conv_sjiswin_wchar(*p++);
1035+ if (sjis == -1)
1036+ {
1037+ continue;
1038+ }
1039+ string[i] = (unsigned short)sjis;
1040+ i++;
1041+ }
1042+ string[i] = 0;
1043+ i = 0;
1044+ p = (unsigned char*)text;
1045+ while (*p && i < 255)
1046+ {
1047+ sjis = conv_sjiswin_wchar(*p++);
1048+ if (sjis == -1)
1049+ {
1050+ continue;
1051+ }
1052+ pretext[i] = (unsigned short)sjis;
1053+ i++;
1054+ }
1055+ pretext[i] = 0;
1056+ memset(&helper,0,sizeof(OSK_HELPER));
1057+ helper.title = (unsigned short*)string;
1058+ helper.pretext = (unsigned short*)pretext;
1059+ helper.textlength = num;
1060+ helper.textlimit = 100;
1061+ helper.lines = lines;
1062+
1063+ pspShowOSK(&helper,DIALOG_LANGUAGE_AUTO);
1064+ /* ucs => sjis */
1065+ wc = (unsigned short*)helper.text;
1066+ s = text;
1067+ i = 0;
1068+ while (*wc)
1069+ {
1070+ sjis = conv_wchar_sjiswin((int)(*wc++));
1071+ if (sjis < 0x100)
1072+ {
1073+ s[i] = sjis;
1074+ i++;
1075+ }
1076+ else
1077+ {
1078+ if (i >= num - 2)
1079+ {
1080+ break;
1081+ }
1082+ s[i] = sjis & 0xFF;
1083+ i++;
1084+ s[i] = (sjis>>8) & 0xFF;
1085+ i++;
1086+ }
1087+ if (i >= num - 1)
1088+ {
1089+ break;
1090+ }
1091+ }
1092+ s[i] = '\0';
1093+}
Added: svn:executable
--- trunc/src/psp2chFavorite.c (nonexistent)
+++ trunc/src/psp2chFavorite.c (revision 2)
@@ -0,0 +1,367 @@
1+
2+#include "pspdialogs.h"
3+#include <stdio.h>
4+#include <malloc.h>
5+#include <time.h>
6+#include <pspdebug.h>
7+#include <pspctrl.h>
8+#include "psp2ch.h"
9+#include "psp2chIta.h"
10+#include "psp2chThread.h"
11+#include "psp2chRes.h"
12+#include "psp2chFavorite.h"
13+#include "utf8.h"
14+#include "pg.h"
15+
16+extern int running; //main.c
17+extern char cwDir[256]; //main.c
18+extern unsigned long pgCursorX, pgCursorY; // pg.c
19+extern void* framebuffer; // pg.c
20+extern char* logDir; // psp2ch.c
21+extern int sel; // psp2ch.c
22+extern int tateFlag; // psp2ch.c
23+extern SceCtrlData pad; // psp2ch.c
24+extern SceCtrlData oldPad; // psp2ch.c
25+extern MESSAGE_HELPER mh; // psp2ch.c
26+extern S_2CH_THREAD* threadList; // psp2chThread.c
27+extern S_2CH_SCREEN thread; // psp2chThread.c
28+extern S_2CH_RES* resList; // psp2chRes.c
29+extern int preLine; // psp2chRes.c
30+extern S_2CH_THREAD_COLOR threadColor; // psp2ch.c
31+extern S_2CH_FAVORITE* findList; // psp2chSearch.c
32+extern char keyWords[128]; // psp2chThread.c
33+
34+S_2CH_FAVORITE* favList = NULL;
35+S_2CH_SCREEN fav;
36+
37+/**********************
38+ Favorite
39+**********************/
40+int psp2chFavorite(void)
41+{
42+ static char* menuStr = "";
43+ int rMenu;
44+
45+ if (favList == NULL)
46+ {
47+ if (psp2chLoadFavorite() < 0)
48+ {
49+ sel = 2;
50+ return 0;
51+ }
52+ }
53+ if(sceCtrlPeekBufferPositive(&pad, 1))
54+ {
55+ rMenu = psp2chCursorSet(&fav);
56+ if (rMenu)
57+ {
58+ menuStr = " ↑ : 先頭   ↓ : 最後    □ : 全板検索";
59+ }
60+ else
61+ {
62+ menuStr = " ○ : 決定     × : 終了     △ : 削除     □ : 板一覧   R : メニュー切替";
63+ }
64+ if (pad.Buttons != oldPad.Buttons)
65+ {
66+ oldPad = pad;
67+ if (pad.Buttons & PSP_CTRL_SELECT)
68+ {
69+ tateFlag = (tateFlag) ? 0 : 1;
70+ }
71+ else if(pad.Buttons & PSP_CTRL_CIRCLE)
72+ {
73+ if (rMenu)
74+ {
75+ }
76+ else
77+ {
78+ free(resList);
79+ resList = NULL;
80+ preLine = -2;
81+ pgFillvram(WHITE, 0, 0, SCR_WIDTH, BUF_HEIGHT);
82+ sel = 4;
83+ return 0;
84+ }
85+ }
86+ else if(pad.Buttons & PSP_CTRL_CROSS)
87+ {
88+ if (rMenu)
89+ {
90+ }
91+ else
92+ {
93+ if (psp2chOwata())
94+ {
95+ return 0;
96+ }
97+ }
98+ }
99+ else if(pad.Buttons & PSP_CTRL_TRIANGLE)
100+ {
101+ if (rMenu)
102+ {
103+ }
104+ else
105+ {
106+ psp2chDelFavorite(favList[fav.select].title, favList[fav.select].dat);
107+ }
108+ }
109+ else if(pad.Buttons & PSP_CTRL_SQUARE)
110+ {
111+ if (rMenu)
112+ {
113+ if (psp2chThreadSearch() == 0 && keyWords[0])
114+ {
115+ if (findList)
116+ {
117+ free(findList);
118+ findList = NULL;
119+ }
120+ sel = 7;
121+ }
122+ }
123+ else
124+ {
125+ sel = 2;
126+ }
127+ }
128+ }
129+ psp2chDrawFavorite(fav.start, fav.select);
130+ pgCopy(0, 0);
131+ pgMenuBar(menuStr);
132+ sceDisplayWaitVblankStart();
133+ framebuffer = sceGuSwapBuffers();
134+ }
135+ return 0;
136+}
137+
138+/**********************
139+favorite.brdがあれば読み込んで
140+favListのメモリ再確保とデータ作成
141+**********************/
142+int psp2chLoadFavorite(void)
143+{
144+ SceUID fd;
145+ SceIoStat st;
146+ char path[256];
147+ char *buf, *p, *r;
148+ int i;
149+
150+ sprintf(path, "%s/%s/favorite.brd", cwDir, logDir);
151+ i = sceIoGetstat(path, &st);
152+ if (i < 0)
153+ {
154+ return -1;
155+ }
156+ buf = (char*)malloc(st.st_size + 1);
157+ if (buf == NULL)
158+ {
159+ memset(&mh,0,sizeof(MESSAGE_HELPER));
160+ strcpy(mh.message, "memorry error");
161+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
162+ return -1;
163+ }
164+ fd = sceIoOpen(path, PSP_O_RDONLY, 0777);
165+ if (fd < 0)
166+ {
167+ free(buf);
168+ return -1;
169+ }
170+ sceIoRead(fd, buf, st.st_size);
171+ sceIoClose(fd);
172+ buf[st.st_size] = '\0';
173+ p = buf;
174+ fav.count = 0;
175+ while (*p)
176+ {
177+ if (*p++ == '\n')
178+ {
179+ fav.count++;
180+ }
181+ }
182+ if (fav.count <= 0)
183+ {
184+ free(buf);
185+ return -1;
186+ }
187+ favList = (S_2CH_FAVORITE*)realloc(favList, sizeof(S_2CH_FAVORITE) * fav.count);
188+ if (favList == NULL)
189+ {
190+ memset(&mh,0,sizeof(MESSAGE_HELPER));
191+ strcpy(mh.message, "memorry error");
192+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
193+ return -1;
194+ }
195+ r = buf;
196+ i = 0;
197+ while (*r)
198+ {
199+ p = strchr(r, '\t');
200+ *p= '\0';
201+ strcpy(favList[i].host, r);
202+ r = ++p;
203+ p = strchr(r, '\t');
204+ *p= '\0';
205+ strcpy(favList[i].dir, r);
206+ r = ++p;
207+ p = strchr(r, '\t');
208+ *p= '\0';
209+ strcpy(favList[i].title, r);
210+ r = ++p;
211+ p = strchr(r, '\t');
212+ *p= '\0';
213+ sscanf(r, "%d", &favList[i].dat);
214+ r = ++p;
215+ p = strchr(r, '\n');
216+ *p= '\0';
217+ strcpy(favList[i].subject, r);
218+ r = ++p;
219+ i++;
220+ }
221+ free(buf);
222+ return 0;
223+}
224+
225+/**********************
226+表示中のスレッドをfavorite.brdの最後に追加
227+psp2chLoadFavorite()でリストを作成しなおす
228+**********************/
229+int psp2chAddFavorite(char* host, char* dir, char* title, int dat)
230+{
231+ SceUID fd;
232+ char path[256];
233+ int i;
234+
235+ if (fav.count == 0)
236+ {
237+ psp2chLoadFavorite();
238+ }
239+ for (i = 0; i < fav.count; i++)
240+ {
241+ if (favList[i].dat == dat && strcmp(favList[i].title, title) == 0)
242+ {
243+ memset(&mh,0,sizeof(MESSAGE_HELPER));
244+ strcpy(mh.message, TEXT_8);
245+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
246+ return -1;
247+ }
248+ }
249+ sprintf(path, "%s/%s/favorite.brd", cwDir, logDir);
250+ fd = sceIoOpen(path, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_APPEND, 0777);
251+ if (fd < 0)
252+ {
253+ return -1;
254+ }
255+ sprintf(path, "%s\t%s\t%s\t%d\t%s\n", host, dir, title, dat, resList[0].title);
256+ sceIoWrite(fd, path, strlen(path));
257+ sceIoClose(fd);
258+ return psp2chLoadFavorite();
259+}
260+
261+/**********************
262+favListからtitleとdatの一致する項目以外のリストのみをfavorite.brdに書き出す
263+psp2chLoadFavorite()でリストを作成しなおす
264+**********************/
265+int psp2chDelFavorite(char* title, int dat)
266+{
267+ SceUID fd;
268+ char path[256];
269+ int i;
270+
271+ if (favList == NULL || fav.count <= 0)
272+ {
273+ return -1;
274+ }
275+ memset(&mh,0,sizeof(MESSAGE_HELPER));
276+ mh.options = PSP_UTILITY_MSGDIALOG_OPTION_TEXT | PSP_UTILITY_MSGDIALOG_OPTION_YESNO_BUTTONS;
277+ strcpy(mh.message, TEXT_9);
278+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
279+ sceCtrlPeekBufferPositive(&oldPad, 1);
280+ if (mh.buttonPressed == PSP_UTILITY_MSGDIALOG_RESULT_YES)
281+ {
282+ sprintf(path, "%s/%s/favorite.brd", cwDir, logDir);
283+ fd = sceIoOpen(path, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
284+ if (fd < 0)
285+ {
286+ return -1;
287+ }
288+ for (i = 0; i < fav.count; i++)
289+ {
290+ if (favList[i].dat == dat && strcmp(favList[i].title, title) == 0)
291+ {
292+ continue;
293+ }
294+ sprintf(path, "%s\t%s\t%s\t%d\t%s\n", favList[i].host, favList[i].dir, favList[i].title, favList[i].dat, favList[i].subject);
295+ sceIoWrite(fd, path, strlen(path));
296+ }
297+ sceIoClose(fd);
298+ fav.start = 0;
299+ fav.select = 0;
300+ return psp2chLoadFavorite();
301+ }
302+ return 0;
303+}
304+
305+/**********************
306+**********************/
307+void psp2chDrawFavorite(int start, int select)
308+{
309+ int i;
310+ char buf[32];
311+ int lineEnd, scrW, scrH;
312+
313+ if (tateFlag)
314+ {
315+ lineEnd = 35;
316+ scrW = SCR_HEIGHT;
317+ scrH = SCR_WIDTH;
318+ }
319+ else
320+ {
321+ lineEnd = 20;
322+ scrW = SCR_WIDTH;
323+ scrH = SCR_HEIGHT;
324+ }
325+ if (start + lineEnd > fav.count)
326+ {
327+ start = fav.count - lineEnd;
328+ }
329+ if (start < 0)
330+ {
331+ start = 0;
332+ }
333+ pgFillvram(threadColor.bg, 0, 0, scrW, scrH);
334+ pgCursorY = 0;
335+ for (i = start; i < start + lineEnd; i++)
336+ {
337+ if (i >= fav.count)
338+ {
339+ return;
340+ }
341+ pgCursorX = 0;
342+ sprintf(buf, "%4d", i + 1);
343+ if (i == select)
344+ {
345+ pgFillvram(threadColor.s_bg, 0, pgCursorY, scrW, LINE_PITCH);
346+ pgPrintNumber(i + 1, threadColor.s_num, threadColor.s_bg);
347+ }
348+ else
349+ {
350+ pgPrintNumber(i + 1, threadColor.num, threadColor.bg);
351+ }
352+ pgCursorX = THREAD_ID;
353+ if (i == select)
354+ {
355+ pgPrint(favList[i].title, threadColor.s_category, threadColor.s_bg, scrW);
356+ pgCursorX += 8;
357+ pgPrint(favList[i].subject, threadColor.s_text1, threadColor.s_bg, scrW);
358+ }
359+ else
360+ {
361+ pgPrint(favList[i].title, threadColor.category, threadColor.bg, scrW);
362+ pgCursorX += 8;
363+ pgPrint(favList[i].subject, threadColor.text1, threadColor.bg, scrW);
364+ }
365+ pgCursorY += LINE_PITCH;
366+ }
367+}
Added: svn:executable
--- trunc/src/psp2chFavorite.h (nonexistent)
+++ trunc/src/psp2chFavorite.h (revision 2)
@@ -0,0 +1,19 @@
1+#ifndef __PSP2CH_FAVORITE_H__
2+#define __PSP2CH_FAVORITE_H__
3+
4+
5+typedef struct {
6+ char host[32];
7+ char dir[32];
8+ char title[32];
9+ int dat;
10+ char subject[128];
11+} S_2CH_FAVORITE;
12+
13+int psp2chFavorite(void);
14+int psp2chLoadFavorite(void);
15+int psp2chAddFavorite(char* host, char* dir, char* title, int dat);
16+int psp2chDelFavorite(char* title, int dat);
17+void psp2chDrawFavorite(int start, int select);
18+
19+#endif
Added: svn:executable
--- trunc/src/intraFont.c (nonexistent)
+++ trunc/src/intraFont.c (revision 2)
@@ -0,0 +1,926 @@
1+/*
2+ * intraFont.c
3+ * This file is used to display the PSP's internal font (pgf firmware files)
4+ * intraFont Version 0.22 by BenHur - http://www.psp-programming.com/benhur
5+ *
6+ * Uses parts of pgeFont by InsertWittyName - http://insomniac.0x89.org
7+ *
8+ * This work is licensed under the Creative Commons Attribution-Share Alike 3.0 License.
9+ * See LICENSE for more details.
10+ *
11+ */
12+
13+#include <pspkernel.h>
14+#include <pspgu.h>
15+#include <pspgum.h>
16+#include <pspdisplay.h>
17+
18+#include <stdarg.h>
19+#include <stdio.h>
20+#include <string.h>
21+#include <math.h>
22+#include <malloc.h>
23+
24+#include "intraFont.h"
25+
26+static unsigned int __attribute__((aligned(16))) clut[16];
27+
28+
29+unsigned long intraFontGetV(unsigned long n, unsigned char *p, unsigned long *b) {
30+ unsigned long i,v=0;
31+ for(i=0;i<n;i++) {
32+ v += ( ( p[(*b)/8] >> ((*b)%8) ) & 1) << i;
33+ (*b)++;
34+ }
35+ return v;
36+}
37+
38+unsigned long* intraFontGetTable(FILE *file, unsigned long n_elements, unsigned long bp_element) {
39+ unsigned long len_table = ((n_elements*bp_element+31)/32)*4;
40+ unsigned char *raw_table = (unsigned char*)malloc(len_table*sizeof(unsigned char));
41+ if (raw_table == NULL) return NULL;
42+ if (fread(raw_table, len_table*sizeof(unsigned char), 1, file) != 1) {
43+ free(raw_table);
44+ return NULL;
45+ }
46+ unsigned long *table = (unsigned long*)malloc(n_elements*sizeof(unsigned long));
47+ if (table == NULL) {
48+ free(raw_table);
49+ return NULL;
50+ }
51+ unsigned long i,j=0;
52+ for (i=0;i<n_elements;i++) {
53+ table[i] = intraFontGetV(bp_element,raw_table,&j);
54+ }
55+ free(raw_table);
56+ return table;
57+}
58+
59+unsigned char intraFontGetBMP(intraFont *font, unsigned short id, unsigned char glyphtype) {
60+ if (!font) return 0;
61+ if (font->options & INTRAFONT_CACHE_ASCII) return 0; //swizzeled texture
62+
63+ Glyph *glyph;
64+ if (glyphtype & PGF_CHARGLYPH) {
65+ glyph = &(font->glyph[id]);
66+ } else {
67+ glyph = &(font->shadowGlyph[id]);
68+ }
69+ if (glyph->flags & PGF_CACHED) return 1;
70+ unsigned long b = glyph->ptr*8;
71+
72+ if (glyph->width > 0 && glyph->height > 0) {
73+ if (!(glyph->flags & PGF_BMP_H_ROWS) != !(glyph->flags & PGF_BMP_V_ROWS)) { //H_ROWS xor V_ROWS
74+ if ((font->texX + glyph->width + 1) > font->texWidth) {
75+ font->texY += font->texYSize + 1;
76+ font->texX = 1;
77+ }
78+ if ((font->texY + glyph->height + 1) > font->texHeight) {
79+ font->texY = 1;
80+ font->texX = 1;
81+ }
82+ glyph->x=font->texX;
83+ glyph->y=font->texY;
84+
85+ /*draw bmp*/
86+ int i=0,j,xx,yy;
87+ unsigned char nibble, value = 0;
88+ while (i<(glyph->width*glyph->height)) {
89+ nibble = intraFontGetV(4,font->fontdata,&b);
90+ if (nibble < 8) value = intraFontGetV(4,font->fontdata,&b);
91+ for (j=0; (j<=((nibble<8)?(nibble):(15-nibble))) && (i<(glyph->width*glyph->height)); j++) {
92+ if (nibble >= 8) value = intraFontGetV(4,font->fontdata,&b);
93+ if (glyph->flags & PGF_BMP_H_ROWS) {
94+ xx = i%glyph->width;
95+ yy = i/glyph->width;
96+ } else {
97+ xx = i/glyph->height;
98+ yy = i%glyph->height;
99+ }
100+ if ((font->texX + xx) & 1) {
101+ font->texture[((font->texX + xx) + (font->texY + yy) * font->texWidth)>>1] &= 0x0F;
102+ font->texture[((font->texX + xx) + (font->texY + yy) * font->texWidth)>>1] |= (value<<4);
103+ } else {
104+ font->texture[((font->texX + xx) + (font->texY + yy) * font->texWidth)>>1] &= 0xF0;
105+ font->texture[((font->texX + xx) + (font->texY + yy) * font->texWidth)>>1] |= (value);
106+ }
107+ i++;
108+ }
109+ }
110+ //erase border around glyph
111+ for (i = font->texX/2; i < (font->texX+glyph->width+1)/2; i++) {
112+ font->texture[i + (font->texY-1)*font->texWidth/2] = 0;
113+ font->texture[i + (font->texY+glyph->height)*font->texWidth/2] = 0;
114+ }
115+ for (i = font->texY-1; i < (font->texY+glyph->height+1); i++) {
116+ font->texture[((font->texX-1) + (i*font->texWidth))>>1] &= (font->texX & 1) ? 0xF0 : 0x0F;
117+ font->texture[((font->texX+glyph->width) + (i*font->texWidth))>>1] &= ((font->texX+glyph->width) & 1) ? 0x0F : 0xF0;
118+ }
119+ font->texX += glyph->width+1; //add empty gap to prevent interpolation artifacts from showing
120+
121+ //mark dirty glyphs as uncached
122+ for (i = 0; i < font->n_chars; i++) {
123+ if ( (font->glyph[i].flags & PGF_CACHED) && (font->glyph[i].y == glyph->y) ) {
124+ if ( (font->glyph[i].x+font->glyph[i].width+1) > glyph->x && font->glyph[i].x < (glyph->x+glyph->width+1) ) {
125+ font->glyph[i].flags -= PGF_CACHED;
126+ }
127+ }
128+ }
129+ for (i = 0; i < font->n_shadows; i++) {
130+ if ( (font->shadowGlyph[i].flags & PGF_CACHED) && (font->shadowGlyph[i].y == glyph->y) ) {
131+ if ( (font->shadowGlyph[i].x+font->shadowGlyph[i].width+1) > glyph->x && font->shadowGlyph[i].x < (glyph->x+glyph->width+1) ) {
132+ font->shadowGlyph[i].flags -= PGF_CACHED;
133+ }
134+ }
135+ }
136+ } else return 0; //transposition=0 or overlay glyph
137+ } else {
138+ glyph->x=0;
139+ glyph->y=0;
140+ }
141+ glyph->flags |= PGF_CACHED;
142+ return 1;
143+}
144+
145+unsigned short intraFontGetGlyph(unsigned char *data, unsigned long *b, unsigned char glyphtype, signed long *advancemap, Glyph *glyph) {
146+ if (glyphtype & PGF_CHARGLYPH) {
147+ (*b) += 14; //skip offset pos value of shadow
148+ } else {
149+ (*b) += intraFontGetV(14,data,b)*8+14; //skip to shadow
150+ }
151+ glyph->width=intraFontGetV(7,data,b);
152+ glyph->height=intraFontGetV(7,data,b);
153+ glyph->left=intraFontGetV(7,data,b);
154+ if (glyph->left >= 64) glyph->left -= 128;
155+ glyph->top=intraFontGetV(7,data,b);
156+ if (glyph->top >= 64) glyph->top -= 128;
157+ glyph->flags = intraFontGetV(6,data,b);
158+ if (glyph->flags & PGF_CHARGLYPH) {
159+ (*b) += 7; //skip magic number
160+ glyph->shadowID = intraFontGetV(9,data,b);
161+ (*b) += 24 + ((glyph->flags & PGF_NO_EXTRA1)?0:56) + ((glyph->flags & PGF_NO_EXTRA2)?0:56) + ((glyph->flags & PGF_NO_EXTRA3)?0:56); //skip to 6bits before end of header
162+ glyph->advance = advancemap[intraFontGetV(8,data,b)*2]/16;
163+ } else {
164+ glyph->shadowID = 65535;
165+ glyph->advance = 0;
166+ }
167+ glyph->ptr = (*b)/8;
168+ return 1;
169+}
170+
171+unsigned short intraFontGetID(intraFont* font, unsigned short ucs) {
172+ unsigned short j, id = 0;
173+ char found = 0;
174+ for (j = 0; j < font->charmap_compr_len && !found; j++) {
175+ if ((ucs >= font->charmap_compr[j*2]) && (ucs < (font->charmap_compr[j*2]+font->charmap_compr[j*2+1]))) {
176+ id += ucs - font->charmap_compr[j*2];
177+ found = 1;
178+ } else {
179+ id += font->charmap_compr[j*2+1];
180+ }
181+ }
182+ if (!found) return 65535; //char not in charmap
183+ id = font->charmap[id];
184+ if (id >= font->n_chars) return 65535; //char not in fontdata or not in ASCII-cache
185+ //if (font->glyph[id].width == 0 || font->glyph[id].height == 0) return 65535; //char has no valid glyph
186+ return id;
187+}
188+
189+static int intraFontSwizzle(intraFont *font) {
190+ int height = font->texHeight;
191+ int byteWidth = font->texWidth>>1;
192+ int textureSize = byteWidth*height;
193+
194+ int rowBlocks = (byteWidth>>4);
195+ int rowBlocksAdd = (rowBlocks - 1)<<7;
196+ unsigned int blockAddress = 0;
197+ unsigned int *src = (unsigned int*) font->texture;
198+ static unsigned char *tData;
199+
200+ tData = (unsigned char*) memalign(16,textureSize);
201+ if(!tData) return 0;
202+
203+ int i,j;
204+ for(j = 0; j < height; j++, blockAddress += 16) {
205+ unsigned int *block = ((unsigned int*)&tData[blockAddress]);
206+ for(i=0; i < rowBlocks; i++) {
207+ *block++ = *src++;
208+ *block++ = *src++;
209+ *block++ = *src++;
210+ *block++ = *src++;
211+ block += 28;
212+ }
213+ if((j & 0x7) == 0x7) blockAddress += rowBlocksAdd;
214+ }
215+
216+ free(font->texture);
217+ font->texture = tData;
218+ font->options |= INTRAFONT_CACHE_ASCII;
219+
220+ return 1;
221+}
222+
223+int intraFontPreCache(intraFont *font, unsigned short options) {
224+ if (!font) return 0;
225+ if (!(options & INTRAFONT_CACHE_ASCII)) return 0; //no precaching requested
226+ if (font->options & INTRAFONT_CACHE_ASCII) return 0; //already prechached?
227+
228+ //cache all glyphs
229+ int i,y;
230+ font->texX = 1;
231+ font->texY = 1;
232+ font->texYSize = 0;
233+ for (i = 0; i < font->n_chars; i++) {
234+ y = font->texY;
235+ intraFontGetBMP(font,i,PGF_CHARGLYPH);
236+ if (font->texY > y || font->texYSize < font->glyph[i].height) font->texYSize = font->glyph[i].height; //minimize ysize after newline in cache(only valid for precached glyphs)
237+ if (font->texY < y) return 0; //char did not fit into cache -> abort precache (should reset cache and glyph.flags)
238+ }
239+ for (i=0;i<font->n_shadows;i++) {
240+ y = font->texY;
241+ intraFontGetBMP(font,i,PGF_SHADOWGLYPH);
242+ if (font->texY > y || font->texYSize < font->shadowGlyph[i].height) font->texYSize = font->shadowGlyph[i].height; //minimize ysize
243+ if (font->texY < y) return 0; //char did not fit into cache -> abort precache (should reset cache and glyph.flags)
244+ }
245+ font->texHeight = ((font->texY) + (font->texYSize) + 7)&~7;
246+ if (font->texHeight > font->texWidth) font->texHeight = font->texWidth;
247+
248+ //reduce fontdata
249+ int index = 0, j;
250+ for (i = 0; i < font->n_chars; i++) {
251+ if ((font->glyph[i].flags & PGF_BMP_H_ROWS) && (font->glyph[i].flags & PGF_BMP_V_ROWS)) {
252+ for (j = 0; j < 6; j++, index++) {
253+ font->fontdata[index] = font->fontdata[(font->glyph[i].ptr)+j];
254+ }
255+ font->glyph[i].ptr = index - j;
256+ }
257+ }
258+ if (index == 0) {
259+ free(font->fontdata);
260+ font->fontdata = NULL;
261+ } else {
262+ font->fontdata = (unsigned char*)realloc(font->fontdata,index*sizeof(unsigned char));
263+ }
264+
265+ //swizzle texture
266+ sceKernelDcacheWritebackAll();
267+ intraFontSwizzle(font);
268+ sceKernelDcacheWritebackAll();
269+
270+ return 1;
271+}
272+
273+intraFont* intraFontLoad(const char *filename, unsigned short options) {
274+ unsigned long i,j;
275+
276+ //open pgf file and get file size
277+ FILE *file = fopen(filename, "rb"); /* read from the file in binary mode */
278+ if ( file == NULL ) {
279+ return NULL;
280+ }
281+ fseek(file, 0, SEEK_END);
282+ unsigned long filesize = ftell(file);
283+ fseek(file, 0, SEEK_SET);
284+
285+ //read pgf header
286+ PGF_Header header;
287+ if (fread(&header, sizeof(PGF_Header), 1, file) != 1) {
288+ fclose(file);
289+ return NULL;
290+ }
291+
292+ //pgf header tests: valid and known pgf file?
293+ if ((strncmp(header.pgf_id,"PGF0",4) != 0) || (header.version != 6) || (header.revision != 2 && header.revision != 3) ||
294+ (header.charmap_len > 65535) || (header.charptr_len > 65535) || (header.charmap_bpe > 32) || (header.charptr_bpe > 32) ||
295+ (header.charmap_min > header.charmap_max) || (header.shadowmap_len > 511) || (header.shadowmap_bpe > 16)) {
296+ fclose(file);
297+ return NULL;
298+ }
299+
300+ //create and initialize font structure
301+ intraFont* font = (intraFont*)malloc(sizeof(intraFont));
302+ if (font == NULL) {
303+ fclose(file);
304+ return NULL;
305+ }
306+
307+ font->n_chars = (unsigned short)header.charptr_len;
308+ font->charmap_compr_len = (header.revision == 3)?7:1;
309+ font->texWidth = (options & INTRAFONT_CACHE_LARGE) ? (512) : (256);
310+ font->texHeight = font->texWidth;
311+ font->texX = 1;
312+ font->texY = 1;
313+ font->texYSize = 0;
314+ font->advancex = header.fixedsize[0]/16;
315+ font->advancey = header.fixedsize[1]/16;
316+ font->n_shadows = (unsigned short)header.shadowmap_len;
317+ font->shadowscale = (unsigned char)header.shadowscale[0];
318+ font->options = options;
319+ if ((options & INTRAFONT_CACHE_ASCII) ) font->options -= INTRAFONT_CACHE_ASCII; //pre-cached texture enabled at the end of font-load
320+ font->size = 1.0f; //default size
321+ font->color = 0xFFFFFFFF; //non-transparent white
322+ font->shadowColor = 0xFF000000; //non-transparent black
323+
324+ font->filename = (char*)malloc((strlen(filename)+1)*sizeof(char));
325+ font->glyph = (Glyph*)malloc(font->n_chars*sizeof(Glyph));
326+ font->shadowGlyph = (Glyph*)malloc(font->n_shadows*sizeof(Glyph));
327+ font->charmap_compr = (unsigned short*)malloc(font->charmap_compr_len*sizeof(unsigned short)*2);
328+ font->charmap = (unsigned short*)malloc(header.charmap_len*sizeof(unsigned short));
329+ font->texture = (unsigned char*)memalign(16,font->texWidth*font->texHeight>>1);
330+
331+ if (!font->filename || !font->glyph || !font->shadowGlyph || !font->charmap_compr || !font->charmap || !font->texture) {
332+ fclose(file);
333+ intraFontUnload(font);
334+ return NULL;
335+ }
336+ strcpy(font->filename,filename);
337+ memset(font->glyph, 0, font->n_chars*sizeof(Glyph)); //make sure glyphs are initialized with 0
338+ memset(font->shadowGlyph, 0, font->n_shadows*sizeof(Glyph));
339+
340+ //read advance table
341+ fseek(file, header.header_len+(header.table1_len+header.table2_len+header.table3_len)*8, SEEK_SET);
342+ signed long *advancemap = (signed long*)malloc(header.advance_len*sizeof(signed long)*2);
343+ if (!advancemap) {
344+ fclose(file);
345+ intraFontUnload(font);
346+ return NULL;
347+ }
348+ if (fread(advancemap, header.advance_len*sizeof(signed long)*2, 1, file) != 1) {
349+ free(advancemap);
350+ fclose(file);
351+ intraFontUnload(font);
352+ return NULL;
353+ }
354+
355+ //read shadowmap
356+ unsigned long *ucs_shadowmap = intraFontGetTable(file, header.shadowmap_len, header.shadowmap_bpe);
357+ if (ucs_shadowmap == NULL) {
358+ free(advancemap);
359+ fclose(file);
360+ intraFontUnload(font);
361+ return NULL;
362+ }
363+
364+ //version 6.3 charmap compression
365+ if (header.revision == 3) {
366+ if (fread(font->charmap_compr, font->charmap_compr_len*sizeof(unsigned short)*2, 1, file) != 1) {
367+ free(advancemap);
368+ free(ucs_shadowmap);
369+ fclose(file);
370+ intraFontUnload(font);
371+ return NULL;
372+ }
373+ } else {
374+ font->charmap_compr[0] = header.charmap_min;
375+ font->charmap_compr[1] = header.charmap_len;
376+ }
377+
378+ //read charmap
379+ if (header.charmap_bpe == 16) { //read directly from file...
380+ if (fread(font->charmap, header.charmap_len*sizeof(unsigned short), 1, file) != 1) {
381+ free(advancemap);
382+ free(ucs_shadowmap);
383+ fclose(file);
384+ intraFontUnload(font);
385+ return NULL;
386+ }
387+ } else {
388+ unsigned long *id_charmap = intraFontGetTable(file, header.charmap_len, header.charmap_bpe);
389+ if (id_charmap == NULL) {
390+ free(advancemap);
391+ free(ucs_shadowmap);
392+ fclose(file);
393+ intraFontUnload(font);
394+ return NULL;
395+ }
396+ for (i=0;i<header.charmap_len;i++) {
397+ font->charmap[i]=(unsigned short)((id_charmap[i] < font->n_chars)?id_charmap[i]:65535);
398+ }
399+ free(id_charmap);
400+ }
401+
402+ //read charptr
403+ unsigned long *charptr = intraFontGetTable(file, header.charptr_len, header.charptr_bpe);
404+ if (charptr == NULL) {
405+ free(advancemap);
406+ free(ucs_shadowmap);
407+ fclose(file);
408+ intraFontUnload(font);
409+ return NULL;
410+ }
411+
412+ //read raw fontdata
413+ unsigned long start_fontdata = ftell(file);
414+ unsigned long len_fontdata = filesize-start_fontdata;
415+ font->fontdata = (unsigned char*)malloc(len_fontdata*sizeof(unsigned char));
416+ if (font->fontdata == NULL) {
417+ free(advancemap);
418+ free(ucs_shadowmap);
419+ free(charptr);
420+ fclose(file);
421+ intraFontUnload(font);
422+ return NULL;
423+ }
424+ if (fread(font->fontdata, len_fontdata*sizeof(unsigned char), 1, file) != 1) {
425+ free(advancemap);
426+ free(ucs_shadowmap);
427+ free(charptr);
428+ fclose(file);
429+ intraFontUnload(font);
430+ return NULL;
431+ }
432+
433+ //close file
434+ fclose(file);
435+
436+ //count ascii chars and reduce mem required
437+ if ((options & PGF_CACHE_MASK) == INTRAFONT_CACHE_ASCII) {
438+ font->n_chars = 1; //assume there's at least one char (needed for intraFontGetID to work properly)
439+ for (i=0; i<128; i++) {
440+ if (intraFontGetID(font,i) < 65535) (font->n_chars)++;
441+ }
442+ (font->n_chars)--; //correct the above assumption
443+ if (font->n_chars == 0) { //no ASCII chars in fontfile -> abort
444+ free(advancemap);
445+ free(ucs_shadowmap);
446+ free(charptr);
447+ intraFontUnload(font);
448+ return NULL;
449+ }
450+ font->glyph = (Glyph*)realloc(font->glyph,font->n_chars*sizeof(Glyph));
451+ font->charmap_compr[1] = 128 - font->charmap_compr[0];
452+ font->charmap = (unsigned short*)realloc(font->charmap,font->charmap_compr[1]*sizeof(unsigned short));
453+ }
454+
455+ //populate chars and count space used in cache to prebuffer all chars
456+ int x=1,y=1,ysize=0;
457+ for (i = 0; i < font->n_chars; i++) {
458+ j = charptr[i]*4*8;
459+ if (!intraFontGetGlyph(font->fontdata, &j, PGF_CHARGLYPH, advancemap, &(font->glyph[i]))) {
460+ free(advancemap);
461+ free(ucs_shadowmap);
462+ free(charptr);
463+ intraFontUnload(font);
464+ return NULL;
465+ }
466+ if (!(font->glyph[i].flags & PGF_BMP_H_ROWS) != !(font->glyph[i].flags & PGF_BMP_V_ROWS)) { //H_ROWS xor V_ROWS (real glyph, not overlay)
467+ if (font->glyph[i].height > font->texYSize) font->texYSize = font->glyph[i].height; //find max glyph height
468+ if ((x + font->glyph[i].width) > font->texWidth) {
469+ y += ysize+1;
470+ x = 1;
471+ ysize = 0;
472+ }
473+ if (font->glyph[i].height > ysize) ysize = font->glyph[i].height;
474+ x += font->glyph[i].width+1;
475+ }
476+ }
477+
478+ //populate shadows and count space (only for chars needed)
479+ unsigned short char_id, shadow_id = 0;
480+ for (i = 0; i < font->n_chars; i++) {
481+ shadow_id = font->glyph[i].shadowID;
482+ char_id = intraFontGetID(font,ucs_shadowmap[shadow_id]);
483+ if (char_id < font->n_chars && font->shadowGlyph[shadow_id].shadowID == 0) { //valid char and shadow glyph not yet loaded
484+ j = charptr[char_id]*4*8;
485+ if (!intraFontGetGlyph(font->fontdata, &j, PGF_SHADOWGLYPH, NULL, &(font->shadowGlyph[shadow_id]))) {
486+ free(advancemap);
487+ free(ucs_shadowmap);
488+ free(charptr);
489+ intraFontUnload(font);
490+ return NULL;
491+ }
492+ if (!(font->shadowGlyph[shadow_id].flags & PGF_BMP_H_ROWS) != !(font->shadowGlyph[shadow_id].flags & PGF_BMP_V_ROWS)) { //H_ROWS xor V_ROWS (real glyph, not overlay)
493+ if (font->shadowGlyph[shadow_id].height > font->texYSize) font->texYSize = font->shadowGlyph[shadow_id].height; //find max glyph height
494+ if ((x + font->shadowGlyph[shadow_id].width) > font->texWidth) {
495+ y += ysize+1;
496+ x = 1;
497+ ysize = 0;
498+ }
499+ if (font->shadowGlyph[shadow_id].height > ysize) ysize = font->shadowGlyph[shadow_id].height;
500+ x += font->shadowGlyph[shadow_id].width+1;
501+ }
502+ }
503+ }
504+
505+ //free temp stuff
506+ free(advancemap);
507+ free(ucs_shadowmap);
508+ free(charptr);
509+
510+ //cache chars, swizzle texture and free unneeded stuff (if INTRAFONT_CACHE_ALL or _ASCII)
511+ sceKernelDcacheWritebackAll();
512+ if ( (options & INTRAFONT_CACHE_ASCII) && ((y + ysize + 1) <= font->texHeight) ) { //cache all and does it fit into cache?
513+ if (!intraFontPreCache(font,options)) {
514+ intraFontUnload(font);
515+ return NULL;
516+ }
517+ }
518+ sceKernelDcacheWritebackAll();
519+
520+ return font;
521+}
522+
523+void intraFontUnload(intraFont *font) {
524+ if (!font) return;
525+ if (font->filename) free(font->filename);
526+ if (font->fontdata) free(font->fontdata);
527+ if (font->texture) free(font->texture);
528+ if (font->charmap_compr) free(font->charmap_compr);
529+ if (font->charmap) free(font->charmap);
530+ if (font->glyph) free(font->glyph);
531+ if (font->shadowGlyph) free(font->shadowGlyph);
532+ if (font) free(font);
533+ font = NULL;
534+}
535+
536+int intraFontInit(void) {
537+ int n;
538+ for(n = 0; n < 16; n++)
539+ clut[n] = ((n * 17) << 24) | 0xffffff;
540+ return 1;
541+}
542+
543+void intraFontShutdown(void) {
544+ //Nothing yet
545+}
546+
547+void intraFontActivate(intraFont *font) {
548+ if(!font) return;
549+ if(!font->texture) return;
550+
551+ sceGuClutMode(GU_PSM_8888, 0, 255, 0);
552+ sceGuClutLoad(2, clut);
553+
554+ sceGuEnable(GU_TEXTURE_2D);
555+ sceGuTexMode(GU_PSM_T4, 0, 0, (font->options & INTRAFONT_CACHE_ASCII) ? 1 : 0);
556+ sceGuTexImage(0, font->texWidth, font->texWidth, font->texWidth, font->texture);
557+ sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA);
558+ sceGuTexEnvColor(0x0);
559+ sceGuTexOffset(0.0f, 0.0f);
560+ sceGuTexWrap(GU_CLAMP, GU_CLAMP);
561+ sceGuTexFilter(GU_LINEAR, GU_LINEAR);
562+}
563+
564+void intraFontSetStyle(intraFont *font, float size, unsigned int color, unsigned int shadowColor, unsigned short options) {
565+ if (!font) return;
566+ font->size = size;
567+ font->color = color;
568+ font->shadowColor = shadowColor;
569+ font->options = (options & PGF_OPTIONS_MASK) + (font->options & PGF_STRING_MASK) + (font->options & PGF_CACHE_MASK);
570+ if ((font->options & PGF_WIDTH_MASK) == 0) font->options |= ((font->advancex / 8) & PGF_WIDTH_MASK);
571+}
572+
573+unsigned short intraFontSJIS2UCS2(unsigned char **text) {
574+
575+ unsigned short ucs2 = 0;
576+
577+#ifndef INTRAFONT_NO_SJIS
578+ static const unsigned short s2u_80[]= { 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb};
579+ static const unsigned short s2u_81[]= { 0x3000,0x3001,0x3002,0xff0c,0xff0e,0x30fb,0xff1a,0xff1b, 0xff1f,0xff01,0x309b,0x309c,0x00b4,0xff40,0x00a8,0xff3e, 0xffe3,0xff3f,0x30fd,0x30fe,0x309d,0x309e,0x3003,0x4edd, 0x3005,0x3006,0x3007,0x30fc,0x2015,0x2010,0xff0f,0xff3c, 0xff5e,0x2225,0xff5c,0x2026,0x2025,0x2018,0x2019,0x201c, 0x201d,0xff08,0xff09,0x3014,0x3015,0xff3b,0xff3d,0xff5b, 0xff5d,0x3008,0x3009,0x300a,0x300b,0x300c,0x300d,0x300e, 0x300f,0x3010,0x3011,0xff0b,0xff0d,0x00b1,0x00d7,0x30fb, 0x00f7,0xff1d,0x2260,0xff1c,0xff1e,0x2266,0x2267,0x221e, 0x2234,0x2642,0x2640,0x00b0,0x2032,0x2033,0x2103,0xffe5, 0xff04,0xffe0,0xffe1,0xff05,0xff03,0xff06,0xff0a,0xff20, 0x00a7,0x2606,0x2605,0x25cb,0x25cf,0x25ce,0x25c7,0x25c6, 0x25a1,0x25a0,0x25b3,0x25b2,0x25bd,0x25bc,0x203b,0x3012, 0x2192,0x2190,0x2191,0x2193,0x3013,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x2208,0x220b,0x2286,0x2287,0x2282,0x2283,0x222a,0x2229, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x2227,0x2228,0xffe2,0x21d2,0x21d4,0x2200,0x2203,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x2220,0x22a5,0x2312,0x2202,0x2207,0x2261, 0x2252,0x226a,0x226b,0x221a,0x223d,0x221d,0x2235,0x222b, 0x222c,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x212b,0x2030,0x266f,0x266d,0x266a,0x2020,0x2021,0x00b6, 0x30fb,0x30fb,0x30fb,0x30fb,0x25ef,0x30fb,0x30fb,0x30fb};
580+ static const unsigned short s2u_82[]= { 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0xff10, 0xff11,0xff12,0xff13,0xff14,0xff15,0xff16,0xff17,0xff18, 0xff19,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0xff21,0xff22,0xff23,0xff24,0xff25,0xff26,0xff27,0xff28, 0xff29,0xff2a,0xff2b,0xff2c,0xff2d,0xff2e,0xff2f,0xff30, 0xff31,0xff32,0xff33,0xff34,0xff35,0xff36,0xff37,0xff38, 0xff39,0xff3a,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0xff41,0xff42,0xff43,0xff44,0xff45,0xff46,0xff47, 0xff48,0xff49,0xff4a,0xff4b,0xff4c,0xff4d,0xff4e,0xff4f, 0xff50,0xff51,0xff52,0xff53,0xff54,0xff55,0xff56,0xff57, 0xff58,0xff59,0xff5a,0x30fb,0x30fb,0x30fb,0x30fb,0x3041, 0x3042,0x3043,0x3044,0x3045,0x3046,0x3047,0x3048,0x3049, 0x304a,0x304b,0x304c,0x304d,0x304e,0x304f,0x3050,0x3051, 0x3052,0x3053,0x3054,0x3055,0x3056,0x3057,0x3058,0x3059, 0x305a,0x305b,0x305c,0x305d,0x305e,0x305f,0x3060,0x3061, 0x3062,0x3063,0x3064,0x3065,0x3066,0x3067,0x3068,0x3069, 0x306a,0x306b,0x306c,0x306d,0x306e,0x306f,0x3070,0x3071, 0x3072,0x3073,0x3074,0x3075,0x3076,0x3077,0x3078,0x3079, 0x307a,0x307b,0x307c,0x307d,0x307e,0x307f,0x3080,0x3081, 0x3082,0x3083,0x3084,0x3085,0x3086,0x3087,0x3088,0x3089, 0x308a,0x308b,0x308c,0x308d,0x308e,0x308f,0x3090,0x3091, 0x3092,0x3093,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb};
581+ static const unsigned short s2u_83[]= { 0x30a1,0x30a2,0x30a3,0x30a4,0x30a5,0x30a6,0x30a7,0x30a8, 0x30a9,0x30aa,0x30ab,0x30ac,0x30ad,0x30ae,0x30af,0x30b0, 0x30b1,0x30b2,0x30b3,0x30b4,0x30b5,0x30b6,0x30b7,0x30b8, 0x30b9,0x30ba,0x30bb,0x30bc,0x30bd,0x30be,0x30bf,0x30c0, 0x30c1,0x30c2,0x30c3,0x30c4,0x30c5,0x30c6,0x30c7,0x30c8, 0x30c9,0x30ca,0x30cb,0x30cc,0x30cd,0x30ce,0x30cf,0x30d0, 0x30d1,0x30d2,0x30d3,0x30d4,0x30d5,0x30d6,0x30d7,0x30d8, 0x30d9,0x30da,0x30db,0x30dc,0x30dd,0x30de,0x30df,0x30fb, 0x30e0,0x30e1,0x30e2,0x30e3,0x30e4,0x30e5,0x30e6,0x30e7, 0x30e8,0x30e9,0x30ea,0x30eb,0x30ec,0x30ed,0x30ee,0x30ef, 0x30f0,0x30f1,0x30f2,0x30f3,0x30f4,0x30f5,0x30f6,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x0391, 0x0392,0x0393,0x0394,0x0395,0x0396,0x0397,0x0398,0x0399, 0x039a,0x039b,0x039c,0x039d,0x039e,0x039f,0x03a0,0x03a1, 0x03a3,0x03a4,0x03a5,0x03a6,0x03a7,0x03a8,0x03a9,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x03b1, 0x03b2,0x03b3,0x03b4,0x03b5,0x03b6,0x03b7,0x03b8,0x03b9, 0x03ba,0x03bb,0x03bc,0x03bd,0x03be,0x03bf,0x03c0,0x03c1, 0x03c3,0x03c4,0x03c5,0x03c6,0x03c7,0x03c8,0x03c9,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb};
582+ static const unsigned short s2u_84[]= { 0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0401,0x0416, 0x0417,0x0418,0x0419,0x041a,0x041b,0x041c,0x041d,0x041e, 0x041f,0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426, 0x0427,0x0428,0x0429,0x042a,0x042b,0x042c,0x042d,0x042e, 0x042f,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0451,0x0436, 0x0437,0x0438,0x0439,0x043a,0x043b,0x043c,0x043d,0x30fb, 0x043e,0x043f,0x0440,0x0441,0x0442,0x0443,0x0444,0x0445, 0x0446,0x0447,0x0448,0x0449,0x044a,0x044b,0x044c,0x044d, 0x044e,0x044f,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x2500, 0x2502,0x250c,0x2510,0x2518,0x2514,0x251c,0x252c,0x2524, 0x2534,0x253c,0x2501,0x2503,0x250f,0x2513,0x251b,0x2517, 0x2523,0x2533,0x252b,0x253b,0x254b,0x2520,0x252f,0x2528, 0x2537,0x253f,0x251d,0x2530,0x2525,0x2538,0x2542,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb};
583+ #define s2u_85 s2u_80
584+ #define s2u_86 s2u_80
585+ static const unsigned short s2u_87[]= { 0x2460,0x2461,0x2462,0x2463,0x2464,0x2465,0x2466,0x2467, 0x2468,0x2469,0x246a,0x246b,0x246c,0x246d,0x246e,0x246f, 0x2470,0x2471,0x2472,0x2473,0x2160,0x2161,0x2162,0x2163, 0x2164,0x2165,0x2166,0x2167,0x2168,0x2169,0x30fb,0x3349, 0x3314,0x3322,0x334d,0x3318,0x3327,0x3303,0x3336,0x3351, 0x3357,0x330d,0x3326,0x3323,0x332b,0x334a,0x333b,0x339c, 0x339d,0x339e,0x338e,0x338f,0x33c4,0x33a1,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x337b,0x30fb, 0x301d,0x301f,0x2116,0x33cd,0x2121,0x32a4,0x32a5,0x32a6, 0x32a7,0x32a8,0x3231,0x3232,0x3239,0x337e,0x337d,0x337c, 0x2252,0x2261,0x222b,0x222e,0x2211,0x221a,0x22a5,0x2220, 0x221f,0x22bf,0x2235,0x2229,0x222a,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb};
586+ static const unsigned short s2u_88[]= { 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x4e9c, 0x5516,0x5a03,0x963f,0x54c0,0x611b,0x6328,0x59f6,0x9022, 0x8475,0x831c,0x7a50,0x60aa,0x63e1,0x6e25,0x65ed,0x8466, 0x82a6,0x9bf5,0x6893,0x5727,0x65a1,0x6271,0x5b9b,0x59d0, 0x867b,0x98f4,0x7d62,0x7dbe,0x9b8e,0x6216,0x7c9f,0x88b7, 0x5b89,0x5eb5,0x6309,0x6697,0x6848,0x95c7,0x978d,0x674f, 0x4ee5,0x4f0a,0x4f4d,0x4f9d,0x5049,0x56f2,0x5937,0x59d4, 0x5a01,0x5c09,0x60df,0x610f,0x6170,0x6613,0x6905,0x70ba, 0x754f,0x7570,0x79fb,0x7dad,0x7def,0x80c3,0x840e,0x8863, 0x8b02,0x9055,0x907a,0x533b,0x4e95,0x4ea5,0x57df,0x80b2, 0x90c1,0x78ef,0x4e00,0x58f1,0x6ea2,0x9038,0x7a32,0x8328, 0x828b,0x9c2f,0x5141,0x5370,0x54bd,0x54e1,0x56e0,0x59fb, 0x5f15,0x98f2,0x6deb,0x80e4,0x852d,0x30fb,0x30fb,0x30fb};
587+ static const unsigned short s2u_89[]= { 0x9662,0x9670,0x96a0,0x97fb,0x540b,0x53f3,0x5b87,0x70cf, 0x7fbd,0x8fc2,0x96e8,0x536f,0x9d5c,0x7aba,0x4e11,0x7893, 0x81fc,0x6e26,0x5618,0x5504,0x6b1d,0x851a,0x9c3b,0x59e5, 0x53a9,0x6d66,0x74dc,0x958f,0x5642,0x4e91,0x904b,0x96f2, 0x834f,0x990c,0x53e1,0x55b6,0x5b30,0x5f71,0x6620,0x66f3, 0x6804,0x6c38,0x6cf3,0x6d29,0x745b,0x76c8,0x7a4e,0x9834, 0x82f1,0x885b,0x8a60,0x92ed,0x6db2,0x75ab,0x76ca,0x99c5, 0x60a6,0x8b01,0x8d8a,0x95b2,0x698e,0x53ad,0x5186,0x30fb, 0x5712,0x5830,0x5944,0x5bb4,0x5ef6,0x6028,0x63a9,0x63f4, 0x6cbf,0x6f14,0x708e,0x7114,0x7159,0x71d5,0x733f,0x7e01, 0x8276,0x82d1,0x8597,0x9060,0x925b,0x9d1b,0x5869,0x65bc, 0x6c5a,0x7525,0x51f9,0x592e,0x5965,0x5f80,0x5fdc,0x62bc, 0x65fa,0x6a2a,0x6b27,0x6bb4,0x738b,0x7fc1,0x8956,0x9d2c, 0x9d0e,0x9ec4,0x5ca1,0x6c96,0x837b,0x5104,0x5c4b,0x61b6, 0x81c6,0x6876,0x7261,0x4e59,0x4ffa,0x5378,0x6069,0x6e29, 0x7a4f,0x97f3,0x4e0b,0x5316,0x4eee,0x4f55,0x4f3d,0x4fa1, 0x4f73,0x52a0,0x53ef,0x5609,0x590f,0x5ac1,0x5bb6,0x5be1, 0x79d1,0x6687,0x679c,0x67b6,0x6b4c,0x6cb3,0x706b,0x73c2, 0x798d,0x79be,0x7a3c,0x7b87,0x82b1,0x82db,0x8304,0x8377, 0x83ef,0x83d3,0x8766,0x8ab2,0x5629,0x8ca8,0x8fe6,0x904e, 0x971e,0x868a,0x4fc4,0x5ce8,0x6211,0x7259,0x753b,0x81e5, 0x82bd,0x86fe,0x8cc0,0x96c5,0x9913,0x99d5,0x4ecb,0x4f1a, 0x89e3,0x56de,0x584a,0x58ca,0x5efb,0x5feb,0x602a,0x6094, 0x6062,0x61d0,0x6212,0x62d0,0x6539,0x30fb,0x30fb,0x30fb};
588+ static const unsigned short s2u_8a[]= { 0x9b41,0x6666,0x68b0,0x6d77,0x7070,0x754c,0x7686,0x7d75, 0x82a5,0x87f9,0x958b,0x968e,0x8c9d,0x51f1,0x52be,0x5916, 0x54b3,0x5bb3,0x5d16,0x6168,0x6982,0x6daf,0x788d,0x84cb, 0x8857,0x8a72,0x93a7,0x9ab8,0x6d6c,0x99a8,0x86d9,0x57a3, 0x67ff,0x86ce,0x920e,0x5283,0x5687,0x5404,0x5ed3,0x62e1, 0x64b9,0x683c,0x6838,0x6bbb,0x7372,0x78ba,0x7a6b,0x899a, 0x89d2,0x8d6b,0x8f03,0x90ed,0x95a3,0x9694,0x9769,0x5b66, 0x5cb3,0x697d,0x984d,0x984e,0x639b,0x7b20,0x6a2b,0x30fb, 0x6a7f,0x68b6,0x9c0d,0x6f5f,0x5272,0x559d,0x6070,0x62ec, 0x6d3b,0x6e07,0x6ed1,0x845b,0x8910,0x8f44,0x4e14,0x9c39, 0x53f6,0x691b,0x6a3a,0x9784,0x682a,0x515c,0x7ac3,0x84b2, 0x91dc,0x938c,0x565b,0x9d28,0x6822,0x8305,0x8431,0x7ca5, 0x5208,0x82c5,0x74e6,0x4e7e,0x4f83,0x51a0,0x5bd2,0x520a, 0x52d8,0x52e7,0x5dfb,0x559a,0x582a,0x59e6,0x5b8c,0x5b98, 0x5bdb,0x5e72,0x5e79,0x60a3,0x611f,0x6163,0x61be,0x63db, 0x6562,0x67d1,0x6853,0x68fa,0x6b3e,0x6b53,0x6c57,0x6f22, 0x6f97,0x6f45,0x74b0,0x7518,0x76e3,0x770b,0x7aff,0x7ba1, 0x7c21,0x7de9,0x7f36,0x7ff0,0x809d,0x8266,0x839e,0x89b3, 0x8acc,0x8cab,0x9084,0x9451,0x9593,0x9591,0x95a2,0x9665, 0x97d3,0x9928,0x8218,0x4e38,0x542b,0x5cb8,0x5dcc,0x73a9, 0x764c,0x773c,0x5ca9,0x7feb,0x8d0b,0x96c1,0x9811,0x9854, 0x9858,0x4f01,0x4f0e,0x5371,0x559c,0x5668,0x57fa,0x5947, 0x5b09,0x5bc4,0x5c90,0x5e0c,0x5e7e,0x5fcc,0x63ee,0x673a, 0x65d7,0x65e2,0x671f,0x68cb,0x68c4,0x30fb,0x30fb,0x30fb};
589+ static const unsigned short s2u_8b[]= { 0x6a5f,0x5e30,0x6bc5,0x6c17,0x6c7d,0x757f,0x7948,0x5b63, 0x7a00,0x7d00,0x5fbd,0x898f,0x8a18,0x8cb4,0x8d77,0x8ecc, 0x8f1d,0x98e2,0x9a0e,0x9b3c,0x4e80,0x507d,0x5100,0x5993, 0x5b9c,0x622f,0x6280,0x64ec,0x6b3a,0x72a0,0x7591,0x7947, 0x7fa9,0x87fb,0x8abc,0x8b70,0x63ac,0x83ca,0x97a0,0x5409, 0x5403,0x55ab,0x6854,0x6a58,0x8a70,0x7827,0x6775,0x9ecd, 0x5374,0x5ba2,0x811a,0x8650,0x9006,0x4e18,0x4e45,0x4ec7, 0x4f11,0x53ca,0x5438,0x5bae,0x5f13,0x6025,0x6551,0x30fb, 0x673d,0x6c42,0x6c72,0x6ce3,0x7078,0x7403,0x7a76,0x7aae, 0x7b08,0x7d1a,0x7cfe,0x7d66,0x65e7,0x725b,0x53bb,0x5c45, 0x5de8,0x62d2,0x62e0,0x6319,0x6e20,0x865a,0x8a31,0x8ddd, 0x92f8,0x6f01,0x79a6,0x9b5a,0x4ea8,0x4eab,0x4eac,0x4f9b, 0x4fa0,0x50d1,0x5147,0x7af6,0x5171,0x51f6,0x5354,0x5321, 0x537f,0x53eb,0x55ac,0x5883,0x5ce1,0x5f37,0x5f4a,0x602f, 0x6050,0x606d,0x631f,0x6559,0x6a4b,0x6cc1,0x72c2,0x72ed, 0x77ef,0x80f8,0x8105,0x8208,0x854e,0x90f7,0x93e1,0x97ff, 0x9957,0x9a5a,0x4ef0,0x51dd,0x5c2d,0x6681,0x696d,0x5c40, 0x66f2,0x6975,0x7389,0x6850,0x7c81,0x50c5,0x52e4,0x5747, 0x5dfe,0x9326,0x65a4,0x6b23,0x6b3d,0x7434,0x7981,0x79bd, 0x7b4b,0x7dca,0x82b9,0x83cc,0x887f,0x895f,0x8b39,0x8fd1, 0x91d1,0x541f,0x9280,0x4e5d,0x5036,0x53e5,0x533a,0x72d7, 0x7396,0x77e9,0x82e6,0x8eaf,0x99c6,0x99c8,0x99d2,0x5177, 0x611a,0x865e,0x55b0,0x7a7a,0x5076,0x5bd3,0x9047,0x9685, 0x4e32,0x6adb,0x91e7,0x5c51,0x5c48,0x30fb,0x30fb,0x30fb};
590+ static const unsigned short s2u_8c[]= { 0x6398,0x7a9f,0x6c93,0x9774,0x8f61,0x7aaa,0x718a,0x9688, 0x7c82,0x6817,0x7e70,0x6851,0x936c,0x52f2,0x541b,0x85ab, 0x8a13,0x7fa4,0x8ecd,0x90e1,0x5366,0x8888,0x7941,0x4fc2, 0x50be,0x5211,0x5144,0x5553,0x572d,0x73ea,0x578b,0x5951, 0x5f62,0x5f84,0x6075,0x6176,0x6167,0x61a9,0x63b2,0x643a, 0x656c,0x666f,0x6842,0x6e13,0x7566,0x7a3d,0x7cfb,0x7d4c, 0x7d99,0x7e4b,0x7f6b,0x830e,0x834a,0x86cd,0x8a08,0x8a63, 0x8b66,0x8efd,0x981a,0x9d8f,0x82b8,0x8fce,0x9be8,0x30fb, 0x5287,0x621f,0x6483,0x6fc0,0x9699,0x6841,0x5091,0x6b20, 0x6c7a,0x6f54,0x7a74,0x7d50,0x8840,0x8a23,0x6708,0x4ef6, 0x5039,0x5026,0x5065,0x517c,0x5238,0x5263,0x55a7,0x570f, 0x5805,0x5acc,0x5efa,0x61b2,0x61f8,0x62f3,0x6372,0x691c, 0x6a29,0x727d,0x72ac,0x732e,0x7814,0x786f,0x7d79,0x770c, 0x80a9,0x898b,0x8b19,0x8ce2,0x8ed2,0x9063,0x9375,0x967a, 0x9855,0x9a13,0x9e78,0x5143,0x539f,0x53b3,0x5e7b,0x5f26, 0x6e1b,0x6e90,0x7384,0x73fe,0x7d43,0x8237,0x8a00,0x8afa, 0x9650,0x4e4e,0x500b,0x53e4,0x547c,0x56fa,0x59d1,0x5b64, 0x5df1,0x5eab,0x5f27,0x6238,0x6545,0x67af,0x6e56,0x72d0, 0x7cca,0x88b4,0x80a1,0x80e1,0x83f0,0x864e,0x8a87,0x8de8, 0x9237,0x96c7,0x9867,0x9f13,0x4e94,0x4e92,0x4f0d,0x5348, 0x5449,0x543e,0x5a2f,0x5f8c,0x5fa1,0x609f,0x68a7,0x6a8e, 0x745a,0x7881,0x8a9e,0x8aa4,0x8b77,0x9190,0x4e5e,0x9bc9, 0x4ea4,0x4f7c,0x4faf,0x5019,0x5016,0x5149,0x516c,0x529f, 0x52b9,0x52fe,0x539a,0x53e3,0x5411,0x30fb,0x30fb,0x30fb};
591+ static const unsigned short s2u_8d[]= { 0x540e,0x5589,0x5751,0x57a2,0x597d,0x5b54,0x5b5d,0x5b8f, 0x5de5,0x5de7,0x5df7,0x5e78,0x5e83,0x5e9a,0x5eb7,0x5f18, 0x6052,0x614c,0x6297,0x62d8,0x63a7,0x653b,0x6602,0x6643, 0x66f4,0x676d,0x6821,0x6897,0x69cb,0x6c5f,0x6d2a,0x6d69, 0x6e2f,0x6e9d,0x7532,0x7687,0x786c,0x7a3f,0x7ce0,0x7d05, 0x7d18,0x7d5e,0x7db1,0x8015,0x8003,0x80af,0x80b1,0x8154, 0x818f,0x822a,0x8352,0x884c,0x8861,0x8b1b,0x8ca2,0x8cfc, 0x90ca,0x9175,0x9271,0x783f,0x92fc,0x95a4,0x964d,0x30fb, 0x9805,0x9999,0x9ad8,0x9d3b,0x525b,0x52ab,0x53f7,0x5408, 0x58d5,0x62f7,0x6fe0,0x8c6a,0x8f5f,0x9eb9,0x514b,0x523b, 0x544a,0x56fd,0x7a40,0x9177,0x9d60,0x9ed2,0x7344,0x6f09, 0x8170,0x7511,0x5ffd,0x60da,0x9aa8,0x72db,0x8fbc,0x6b64, 0x9803,0x4eca,0x56f0,0x5764,0x58be,0x5a5a,0x6068,0x61c7, 0x660f,0x6606,0x6839,0x68b1,0x6df7,0x75d5,0x7d3a,0x826e, 0x9b42,0x4e9b,0x4f50,0x53c9,0x5506,0x5d6f,0x5de6,0x5dee, 0x67fb,0x6c99,0x7473,0x7802,0x8a50,0x9396,0x88df,0x5750, 0x5ea7,0x632b,0x50b5,0x50ac,0x518d,0x6700,0x54c9,0x585e, 0x59bb,0x5bb0,0x5f69,0x624d,0x63a1,0x683d,0x6b73,0x6e08, 0x707d,0x91c7,0x7280,0x7815,0x7826,0x796d,0x658e,0x7d30, 0x83dc,0x88c1,0x8f09,0x969b,0x5264,0x5728,0x6750,0x7f6a, 0x8ca1,0x51b4,0x5742,0x962a,0x583a,0x698a,0x80b4,0x54b2, 0x5d0e,0x57fc,0x7895,0x9dfa,0x4f5c,0x524a,0x548b,0x643e, 0x6628,0x6714,0x67f5,0x7a84,0x7b56,0x7d22,0x932f,0x685c, 0x9bad,0x7b39,0x5319,0x518a,0x5237,0x30fb,0x30fb,0x30fb};
592+ static const unsigned short s2u_8e[]= { 0x5bdf,0x62f6,0x64ae,0x64e6,0x672d,0x6bba,0x85a9,0x96d1, 0x7690,0x9bd6,0x634c,0x9306,0x9bab,0x76bf,0x6652,0x4e09, 0x5098,0x53c2,0x5c71,0x60e8,0x6492,0x6563,0x685f,0x71e6, 0x73ca,0x7523,0x7b97,0x7e82,0x8695,0x8b83,0x8cdb,0x9178, 0x9910,0x65ac,0x66ab,0x6b8b,0x4ed5,0x4ed4,0x4f3a,0x4f7f, 0x523a,0x53f8,0x53f2,0x55e3,0x56db,0x58eb,0x59cb,0x59c9, 0x59ff,0x5b50,0x5c4d,0x5e02,0x5e2b,0x5fd7,0x601d,0x6307, 0x652f,0x5b5c,0x65af,0x65bd,0x65e8,0x679d,0x6b62,0x30fb, 0x6b7b,0x6c0f,0x7345,0x7949,0x79c1,0x7cf8,0x7d19,0x7d2b, 0x80a2,0x8102,0x81f3,0x8996,0x8a5e,0x8a69,0x8a66,0x8a8c, 0x8aee,0x8cc7,0x8cdc,0x96cc,0x98fc,0x6b6f,0x4e8b,0x4f3c, 0x4f8d,0x5150,0x5b57,0x5bfa,0x6148,0x6301,0x6642,0x6b21, 0x6ecb,0x6cbb,0x723e,0x74bd,0x75d4,0x78c1,0x793a,0x800c, 0x8033,0x81ea,0x8494,0x8f9e,0x6c50,0x9e7f,0x5f0f,0x8b58, 0x9d2b,0x7afa,0x8ef8,0x5b8d,0x96eb,0x4e03,0x53f1,0x57f7, 0x5931,0x5ac9,0x5ba4,0x6089,0x6e7f,0x6f06,0x75be,0x8cea, 0x5b9f,0x8500,0x7be0,0x5072,0x67f4,0x829d,0x5c61,0x854a, 0x7e1e,0x820e,0x5199,0x5c04,0x6368,0x8d66,0x659c,0x716e, 0x793e,0x7d17,0x8005,0x8b1d,0x8eca,0x906e,0x86c7,0x90aa, 0x501f,0x52fa,0x5c3a,0x6753,0x707c,0x7235,0x914c,0x91c8, 0x932b,0x82e5,0x5bc2,0x5f31,0x60f9,0x4e3b,0x53d6,0x5b88, 0x624b,0x6731,0x6b8a,0x72e9,0x73e0,0x7a2e,0x816b,0x8da3, 0x9152,0x9996,0x5112,0x53d7,0x546a,0x5bff,0x6388,0x6a39, 0x7dac,0x9700,0x56da,0x53ce,0x5468,0x30fb,0x30fb,0x30fb};
593+ static const unsigned short s2u_8f[]= { 0x5b97,0x5c31,0x5dde,0x4fee,0x6101,0x62fe,0x6d32,0x79c0, 0x79cb,0x7d42,0x7e4d,0x7fd2,0x81ed,0x821f,0x8490,0x8846, 0x8972,0x8b90,0x8e74,0x8f2f,0x9031,0x914b,0x916c,0x96c6, 0x919c,0x4ec0,0x4f4f,0x5145,0x5341,0x5f93,0x620e,0x67d4, 0x6c41,0x6e0b,0x7363,0x7e26,0x91cd,0x9283,0x53d4,0x5919, 0x5bbf,0x6dd1,0x795d,0x7e2e,0x7c9b,0x587e,0x719f,0x51fa, 0x8853,0x8ff0,0x4fca,0x5cfb,0x6625,0x77ac,0x7ae3,0x821c, 0x99ff,0x51c6,0x5faa,0x65ec,0x696f,0x6b89,0x6df3,0x30fb, 0x6e96,0x6f64,0x76fe,0x7d14,0x5de1,0x9075,0x9187,0x9806, 0x51e6,0x521d,0x6240,0x6691,0x66d9,0x6e1a,0x5eb6,0x7dd2, 0x7f72,0x66f8,0x85af,0x85f7,0x8af8,0x52a9,0x53d9,0x5973, 0x5e8f,0x5f90,0x6055,0x92e4,0x9664,0x50b7,0x511f,0x52dd, 0x5320,0x5347,0x53ec,0x54e8,0x5546,0x5531,0x5617,0x5968, 0x59be,0x5a3c,0x5bb5,0x5c06,0x5c0f,0x5c11,0x5c1a,0x5e84, 0x5e8a,0x5ee0,0x5f70,0x627f,0x6284,0x62db,0x638c,0x6377, 0x6607,0x660c,0x662d,0x6676,0x677e,0x68a2,0x6a1f,0x6a35, 0x6cbc,0x6d88,0x6e09,0x6e58,0x713c,0x7126,0x7167,0x75c7, 0x7701,0x785d,0x7901,0x7965,0x79f0,0x7ae0,0x7b11,0x7ca7, 0x7d39,0x8096,0x83d6,0x848b,0x8549,0x885d,0x88f3,0x8a1f, 0x8a3c,0x8a54,0x8a73,0x8c61,0x8cde,0x91a4,0x9266,0x937e, 0x9418,0x969c,0x9798,0x4e0a,0x4e08,0x4e1e,0x4e57,0x5197, 0x5270,0x57ce,0x5834,0x58cc,0x5b22,0x5e38,0x60c5,0x64fe, 0x6761,0x6756,0x6d44,0x72b6,0x7573,0x7a63,0x84b8,0x8b72, 0x91b8,0x9320,0x5631,0x57f4,0x98fe,0x30fb,0x30fb,0x30fb};
594+ static const unsigned short s2u_90[]= { 0x62ed,0x690d,0x6b96,0x71ed,0x7e54,0x8077,0x8272,0x89e6, 0x98df,0x8755,0x8fb1,0x5c3b,0x4f38,0x4fe1,0x4fb5,0x5507, 0x5a20,0x5bdd,0x5be9,0x5fc3,0x614e,0x632f,0x65b0,0x664b, 0x68ee,0x699b,0x6d78,0x6df1,0x7533,0x75b9,0x771f,0x795e, 0x79e6,0x7d33,0x81e3,0x82af,0x85aa,0x89aa,0x8a3a,0x8eab, 0x8f9b,0x9032,0x91dd,0x9707,0x4eba,0x4ec1,0x5203,0x5875, 0x58ec,0x5c0b,0x751a,0x5c3d,0x814e,0x8a0a,0x8fc5,0x9663, 0x976d,0x7b25,0x8acf,0x9808,0x9162,0x56f3,0x53a8,0x30fb, 0x9017,0x5439,0x5782,0x5e25,0x63a8,0x6c34,0x708a,0x7761, 0x7c8b,0x7fe0,0x8870,0x9042,0x9154,0x9310,0x9318,0x968f, 0x745e,0x9ac4,0x5d07,0x5d69,0x6570,0x67a2,0x8da8,0x96db, 0x636e,0x6749,0x6919,0x83c5,0x9817,0x96c0,0x88fe,0x6f84, 0x647a,0x5bf8,0x4e16,0x702c,0x755d,0x662f,0x51c4,0x5236, 0x52e2,0x59d3,0x5f81,0x6027,0x6210,0x653f,0x6574,0x661f, 0x6674,0x68f2,0x6816,0x6b63,0x6e05,0x7272,0x751f,0x76db, 0x7cbe,0x8056,0x58f0,0x88fd,0x897f,0x8aa0,0x8a93,0x8acb, 0x901d,0x9192,0x9752,0x9759,0x6589,0x7a0e,0x8106,0x96bb, 0x5e2d,0x60dc,0x621a,0x65a5,0x6614,0x6790,0x77f3,0x7a4d, 0x7c4d,0x7e3e,0x810a,0x8cac,0x8d64,0x8de1,0x8e5f,0x78a9, 0x5207,0x62d9,0x63a5,0x6442,0x6298,0x8a2d,0x7a83,0x7bc0, 0x8aac,0x96ea,0x7d76,0x820c,0x8749,0x4ed9,0x5148,0x5343, 0x5360,0x5ba3,0x5c02,0x5c16,0x5ddd,0x6226,0x6247,0x64b0, 0x6813,0x6834,0x6cc9,0x6d45,0x6d17,0x67d3,0x6f5c,0x714e, 0x717d,0x65cb,0x7a7f,0x7bad,0x7dda,0x30fb,0x30fb,0x30fb};
595+ static const unsigned short s2u_91[]= { 0x7e4a,0x7fa8,0x817a,0x821b,0x8239,0x85a6,0x8a6e,0x8cce, 0x8df5,0x9078,0x9077,0x92ad,0x9291,0x9583,0x9bae,0x524d, 0x5584,0x6f38,0x7136,0x5168,0x7985,0x7e55,0x81b3,0x7cce, 0x564c,0x5851,0x5ca8,0x63aa,0x66fe,0x66fd,0x695a,0x72d9, 0x758f,0x758e,0x790e,0x7956,0x79df,0x7c97,0x7d20,0x7d44, 0x8607,0x8a34,0x963b,0x9061,0x9f20,0x50e7,0x5275,0x53cc, 0x53e2,0x5009,0x55aa,0x58ee,0x594f,0x723d,0x5b8b,0x5c64, 0x531d,0x60e3,0x60f3,0x635c,0x6383,0x633f,0x63bb,0x30fb, 0x64cd,0x65e9,0x66f9,0x5de3,0x69cd,0x69fd,0x6f15,0x71e5, 0x4e89,0x75e9,0x76f8,0x7a93,0x7cdf,0x7dcf,0x7d9c,0x8061, 0x8349,0x8358,0x846c,0x84bc,0x85fb,0x88c5,0x8d70,0x9001, 0x906d,0x9397,0x971c,0x9a12,0x50cf,0x5897,0x618e,0x81d3, 0x8535,0x8d08,0x9020,0x4fc3,0x5074,0x5247,0x5373,0x606f, 0x6349,0x675f,0x6e2c,0x8db3,0x901f,0x4fd7,0x5c5e,0x8cca, 0x65cf,0x7d9a,0x5352,0x8896,0x5176,0x63c3,0x5b58,0x5b6b, 0x5c0a,0x640d,0x6751,0x905c,0x4ed6,0x591a,0x592a,0x6c70, 0x8a51,0x553e,0x5815,0x59a5,0x60f0,0x6253,0x67c1,0x8235, 0x6955,0x9640,0x99c4,0x9a28,0x4f53,0x5806,0x5bfe,0x8010, 0x5cb1,0x5e2f,0x5f85,0x6020,0x614b,0x6234,0x66ff,0x6cf0, 0x6ede,0x80ce,0x817f,0x82d4,0x888b,0x8cb8,0x9000,0x902e, 0x968a,0x9edb,0x9bdb,0x4ee3,0x53f0,0x5927,0x7b2c,0x918d, 0x984c,0x9df9,0x6edd,0x7027,0x5353,0x5544,0x5b85,0x6258, 0x629e,0x62d3,0x6ca2,0x6fef,0x7422,0x8a17,0x9438,0x6fc1, 0x8afe,0x8338,0x51e7,0x86f8,0x53ea,0x30fb,0x30fb,0x30fb};
596+ static const unsigned short s2u_92[]= { 0x53e9,0x4f46,0x9054,0x8fb0,0x596a,0x8131,0x5dfd,0x7aea, 0x8fbf,0x68da,0x8c37,0x72f8,0x9c48,0x6a3d,0x8ab0,0x4e39, 0x5358,0x5606,0x5766,0x62c5,0x63a2,0x65e6,0x6b4e,0x6de1, 0x6e5b,0x70ad,0x77ed,0x7aef,0x7baa,0x7dbb,0x803d,0x80c6, 0x86cb,0x8a95,0x935b,0x56e3,0x58c7,0x5f3e,0x65ad,0x6696, 0x6a80,0x6bb5,0x7537,0x8ac7,0x5024,0x77e5,0x5730,0x5f1b, 0x6065,0x667a,0x6c60,0x75f4,0x7a1a,0x7f6e,0x81f4,0x8718, 0x9045,0x99b3,0x7bc9,0x755c,0x7af9,0x7b51,0x84c4,0x30fb, 0x9010,0x79e9,0x7a92,0x8336,0x5ae1,0x7740,0x4e2d,0x4ef2, 0x5b99,0x5fe0,0x62bd,0x663c,0x67f1,0x6ce8,0x866b,0x8877, 0x8a3b,0x914e,0x92f3,0x99d0,0x6a17,0x7026,0x732a,0x82e7, 0x8457,0x8caf,0x4e01,0x5146,0x51cb,0x558b,0x5bf5,0x5e16, 0x5e33,0x5e81,0x5f14,0x5f35,0x5f6b,0x5fb4,0x61f2,0x6311, 0x66a2,0x671d,0x6f6e,0x7252,0x753a,0x773a,0x8074,0x8139, 0x8178,0x8776,0x8abf,0x8adc,0x8d85,0x8df3,0x929a,0x9577, 0x9802,0x9ce5,0x52c5,0x6357,0x76f4,0x6715,0x6c88,0x73cd, 0x8cc3,0x93ae,0x9673,0x6d25,0x589c,0x690e,0x69cc,0x8ffd, 0x939a,0x75db,0x901a,0x585a,0x6802,0x63b4,0x69fb,0x4f43, 0x6f2c,0x67d8,0x8fbb,0x8526,0x7db4,0x9354,0x693f,0x6f70, 0x576a,0x58f7,0x5b2c,0x7d2c,0x722a,0x540a,0x91e3,0x9db4, 0x4ead,0x4f4e,0x505c,0x5075,0x5243,0x8c9e,0x5448,0x5824, 0x5b9a,0x5e1d,0x5e95,0x5ead,0x5ef7,0x5f1f,0x608c,0x62b5, 0x633a,0x63d0,0x68af,0x6c40,0x7887,0x798e,0x7a0b,0x7de0, 0x8247,0x8a02,0x8ae6,0x8e44,0x9013,0x30fb,0x30fb,0x30fb};
597+ static const unsigned short s2u_93[]= { 0x90b8,0x912d,0x91d8,0x9f0e,0x6ce5,0x6458,0x64e2,0x6575, 0x6ef4,0x7684,0x7b1b,0x9069,0x93d1,0x6eba,0x54f2,0x5fb9, 0x64a4,0x8f4d,0x8fed,0x9244,0x5178,0x586b,0x5929,0x5c55, 0x5e97,0x6dfb,0x7e8f,0x751c,0x8cbc,0x8ee2,0x985b,0x70b9, 0x4f1d,0x6bbf,0x6fb1,0x7530,0x96fb,0x514e,0x5410,0x5835, 0x5857,0x59ac,0x5c60,0x5f92,0x6597,0x675c,0x6e21,0x767b, 0x83df,0x8ced,0x9014,0x90fd,0x934d,0x7825,0x783a,0x52aa, 0x5ea6,0x571f,0x5974,0x6012,0x5012,0x515a,0x51ac,0x30fb, 0x51cd,0x5200,0x5510,0x5854,0x5858,0x5957,0x5b95,0x5cf6, 0x5d8b,0x60bc,0x6295,0x642d,0x6771,0x6843,0x68bc,0x68df, 0x76d7,0x6dd8,0x6e6f,0x6d9b,0x706f,0x71c8,0x5f53,0x75d8, 0x7977,0x7b49,0x7b54,0x7b52,0x7cd6,0x7d71,0x5230,0x8463, 0x8569,0x85e4,0x8a0e,0x8b04,0x8c46,0x8e0f,0x9003,0x900f, 0x9419,0x9676,0x982d,0x9a30,0x95d8,0x50cd,0x52d5,0x540c, 0x5802,0x5c0e,0x61a7,0x649e,0x6d1e,0x77b3,0x7ae5,0x80f4, 0x8404,0x9053,0x9285,0x5ce0,0x9d07,0x533f,0x5f97,0x5fb3, 0x6d9c,0x7279,0x7763,0x79bf,0x7be4,0x6bd2,0x72ec,0x8aad, 0x6803,0x6a61,0x51f8,0x7a81,0x6934,0x5c4a,0x9cf6,0x82eb, 0x5bc5,0x9149,0x701e,0x5678,0x5c6f,0x60c7,0x6566,0x6c8c, 0x8c5a,0x9041,0x9813,0x5451,0x66c7,0x920d,0x5948,0x90a3, 0x5185,0x4e4d,0x51ea,0x8599,0x8b0e,0x7058,0x637a,0x934b, 0x6962,0x99b4,0x7e04,0x7577,0x5357,0x6960,0x8edf,0x96e3, 0x6c5d,0x4e8c,0x5c3c,0x5f10,0x8fe9,0x5302,0x8cd1,0x8089, 0x8679,0x5eff,0x65e5,0x4e73,0x5165,0x30fb,0x30fb,0x30fb};
598+ static const unsigned short s2u_94[]= { 0x5982,0x5c3f,0x97ee,0x4efb,0x598a,0x5fcd,0x8a8d,0x6fe1, 0x79b0,0x7962,0x5be7,0x8471,0x732b,0x71b1,0x5e74,0x5ff5, 0x637b,0x649a,0x71c3,0x7c98,0x4e43,0x5efc,0x4e4b,0x57dc, 0x56a2,0x60a9,0x6fc3,0x7d0d,0x80fd,0x8133,0x81bf,0x8fb2, 0x8997,0x86a4,0x5df4,0x628a,0x64ad,0x8987,0x6777,0x6ce2, 0x6d3e,0x7436,0x7834,0x5a46,0x7f75,0x82ad,0x99ac,0x4ff3, 0x5ec3,0x62dd,0x6392,0x6557,0x676f,0x76c3,0x724c,0x80cc, 0x80ba,0x8f29,0x914d,0x500d,0x57f9,0x5a92,0x6885,0x30fb, 0x6973,0x7164,0x72fd,0x8cb7,0x58f2,0x8ce0,0x966a,0x9019, 0x877f,0x79e4,0x77e7,0x8429,0x4f2f,0x5265,0x535a,0x62cd, 0x67cf,0x6cca,0x767d,0x7b94,0x7c95,0x8236,0x8584,0x8feb, 0x66dd,0x6f20,0x7206,0x7e1b,0x83ab,0x99c1,0x9ea6,0x51fd, 0x7bb1,0x7872,0x7bb8,0x8087,0x7b48,0x6ae8,0x5e61,0x808c, 0x7551,0x7560,0x516b,0x9262,0x6e8c,0x767a,0x9197,0x9aea, 0x4f10,0x7f70,0x629c,0x7b4f,0x95a5,0x9ce9,0x567a,0x5859, 0x86e4,0x96bc,0x4f34,0x5224,0x534a,0x53cd,0x53db,0x5e06, 0x642c,0x6591,0x677f,0x6c3e,0x6c4e,0x7248,0x72af,0x73ed, 0x7554,0x7e41,0x822c,0x85e9,0x8ca9,0x7bc4,0x91c6,0x7169, 0x9812,0x98ef,0x633d,0x6669,0x756a,0x76e4,0x78d0,0x8543, 0x86ee,0x532a,0x5351,0x5426,0x5983,0x5e87,0x5f7c,0x60b2, 0x6249,0x6279,0x62ab,0x6590,0x6bd4,0x6ccc,0x75b2,0x76ae, 0x7891,0x79d8,0x7dcb,0x7f77,0x80a5,0x88ab,0x8ab9,0x8cbb, 0x907f,0x975e,0x98db,0x6a0b,0x7c38,0x5099,0x5c3e,0x5fae, 0x6787,0x6bd8,0x7435,0x7709,0x7f8e,0x30fb,0x30fb,0x30fb};
599+ static const unsigned short s2u_95[]= { 0x9f3b,0x67ca,0x7a17,0x5339,0x758b,0x9aed,0x5f66,0x819d, 0x83f1,0x8098,0x5f3c,0x5fc5,0x7562,0x7b46,0x903c,0x6867, 0x59eb,0x5a9b,0x7d10,0x767e,0x8b2c,0x4ff5,0x5f6a,0x6a19, 0x6c37,0x6f02,0x74e2,0x7968,0x8868,0x8a55,0x8c79,0x5edf, 0x63cf,0x75c5,0x79d2,0x82d7,0x9328,0x92f2,0x849c,0x86ed, 0x9c2d,0x54c1,0x5f6c,0x658c,0x6d5c,0x7015,0x8ca7,0x8cd3, 0x983b,0x654f,0x74f6,0x4e0d,0x4ed8,0x57e0,0x592b,0x5a66, 0x5bcc,0x51a8,0x5e03,0x5e9c,0x6016,0x6276,0x6577,0x30fb, 0x65a7,0x666e,0x6d6e,0x7236,0x7b26,0x8150,0x819a,0x8299, 0x8b5c,0x8ca0,0x8ce6,0x8d74,0x961c,0x9644,0x4fae,0x64ab, 0x6b66,0x821e,0x8461,0x856a,0x90e8,0x5c01,0x6953,0x98a8, 0x847a,0x8557,0x4f0f,0x526f,0x5fa9,0x5e45,0x670d,0x798f, 0x8179,0x8907,0x8986,0x6df5,0x5f17,0x6255,0x6cb8,0x4ecf, 0x7269,0x9b92,0x5206,0x543b,0x5674,0x58b3,0x61a4,0x626e, 0x711a,0x596e,0x7c89,0x7cde,0x7d1b,0x96f0,0x6587,0x805e, 0x4e19,0x4f75,0x5175,0x5840,0x5e63,0x5e73,0x5f0a,0x67c4, 0x4e26,0x853d,0x9589,0x965b,0x7c73,0x9801,0x50fb,0x58c1, 0x7656,0x78a7,0x5225,0x77a5,0x8511,0x7b86,0x504f,0x5909, 0x7247,0x7bc7,0x7de8,0x8fba,0x8fd4,0x904d,0x4fbf,0x52c9, 0x5a29,0x5f01,0x97ad,0x4fdd,0x8217,0x92ea,0x5703,0x6355, 0x6b69,0x752b,0x88dc,0x8f14,0x7a42,0x52df,0x5893,0x6155, 0x620a,0x66ae,0x6bcd,0x7c3f,0x83e9,0x5023,0x4ff8,0x5305, 0x5446,0x5831,0x5949,0x5b9d,0x5cf0,0x5cef,0x5d29,0x5e96, 0x62b1,0x6367,0x653e,0x65b9,0x670b,0x30fb,0x30fb,0x30fb};
600+ static const unsigned short s2u_96[]= { 0x6cd5,0x6ce1,0x70f9,0x7832,0x7e2b,0x80de,0x82b3,0x840c, 0x84ec,0x8702,0x8912,0x8a2a,0x8c4a,0x90a6,0x92d2,0x98fd, 0x9cf3,0x9d6c,0x4e4f,0x4ea1,0x508d,0x5256,0x574a,0x59a8, 0x5e3d,0x5fd8,0x5fd9,0x623f,0x66b4,0x671b,0x67d0,0x68d2, 0x5192,0x7d21,0x80aa,0x81a8,0x8b00,0x8c8c,0x8cbf,0x927e, 0x9632,0x5420,0x982c,0x5317,0x50d5,0x535c,0x58a8,0x64b2, 0x6734,0x7267,0x7766,0x7a46,0x91e6,0x52c3,0x6ca1,0x6b86, 0x5800,0x5e4c,0x5954,0x672c,0x7ffb,0x51e1,0x76c6,0x30fb, 0x6469,0x78e8,0x9b54,0x9ebb,0x57cb,0x59b9,0x6627,0x679a, 0x6bce,0x54e9,0x69d9,0x5e55,0x819c,0x6795,0x9baa,0x67fe, 0x9c52,0x685d,0x4ea6,0x4fe3,0x53c8,0x62b9,0x672b,0x6cab, 0x8fc4,0x4fad,0x7e6d,0x9ebf,0x4e07,0x6162,0x6e80,0x6f2b, 0x8513,0x5473,0x672a,0x9b45,0x5df3,0x7b95,0x5cac,0x5bc6, 0x871c,0x6e4a,0x84d1,0x7a14,0x8108,0x5999,0x7c8d,0x6c11, 0x7720,0x52d9,0x5922,0x7121,0x725f,0x77db,0x9727,0x9d61, 0x690b,0x5a7f,0x5a18,0x51a5,0x540d,0x547d,0x660e,0x76df, 0x8ff7,0x9298,0x9cf4,0x59ea,0x725d,0x6ec5,0x514d,0x68c9, 0x7dbf,0x7dec,0x9762,0x9eba,0x6478,0x6a21,0x8302,0x5984, 0x5b5f,0x6bdb,0x731b,0x76f2,0x7db2,0x8017,0x8499,0x5132, 0x6728,0x9ed9,0x76ee,0x6762,0x52ff,0x9905,0x5c24,0x623b, 0x7c7e,0x8cb0,0x554f,0x60b6,0x7d0b,0x9580,0x5301,0x4e5f, 0x51b6,0x591c,0x723a,0x8036,0x91ce,0x5f25,0x77e2,0x5384, 0x5f79,0x7d04,0x85ac,0x8a33,0x8e8d,0x9756,0x67f3,0x85ae, 0x9453,0x6109,0x6108,0x6cb9,0x7652,0x30fb,0x30fb,0x30fb};
601+ static const unsigned short s2u_97[]= { 0x8aed,0x8f38,0x552f,0x4f51,0x512a,0x52c7,0x53cb,0x5ba5, 0x5e7d,0x60a0,0x6182,0x63d6,0x6709,0x67da,0x6e67,0x6d8c, 0x7336,0x7337,0x7531,0x7950,0x88d5,0x8a98,0x904a,0x9091, 0x90f5,0x96c4,0x878d,0x5915,0x4e88,0x4f59,0x4e0e,0x8a89, 0x8f3f,0x9810,0x50ad,0x5e7c,0x5996,0x5bb9,0x5eb8,0x63da, 0x63fa,0x64c1,0x66dc,0x694a,0x69d8,0x6d0b,0x6eb6,0x7194, 0x7528,0x7aaf,0x7f8a,0x8000,0x8449,0x84c9,0x8981,0x8b21, 0x8e0a,0x9065,0x967d,0x990a,0x617e,0x6291,0x6b32,0x30fb, 0x6c83,0x6d74,0x7fcc,0x7ffc,0x6dc0,0x7f85,0x87ba,0x88f8, 0x6765,0x83b1,0x983c,0x96f7,0x6d1b,0x7d61,0x843d,0x916a, 0x4e71,0x5375,0x5d50,0x6b04,0x6feb,0x85cd,0x862d,0x89a7, 0x5229,0x540f,0x5c65,0x674e,0x68a8,0x7406,0x7483,0x75e2, 0x88cf,0x88e1,0x91cc,0x96e2,0x9678,0x5f8b,0x7387,0x7acb, 0x844e,0x63a0,0x7565,0x5289,0x6d41,0x6e9c,0x7409,0x7559, 0x786b,0x7c92,0x9686,0x7adc,0x9f8d,0x4fb6,0x616e,0x65c5, 0x865c,0x4e86,0x4eae,0x50da,0x4e21,0x51cc,0x5bee,0x6599, 0x6881,0x6dbc,0x731f,0x7642,0x77ad,0x7a1c,0x7ce7,0x826f, 0x8ad2,0x907c,0x91cf,0x9675,0x9818,0x529b,0x7dd1,0x502b, 0x5398,0x6797,0x6dcb,0x71d0,0x7433,0x81e8,0x8f2a,0x96a3, 0x9c57,0x9e9f,0x7460,0x5841,0x6d99,0x7d2f,0x985e,0x4ee4, 0x4f36,0x4f8b,0x51b7,0x52b1,0x5dba,0x601c,0x73b2,0x793c, 0x82d3,0x9234,0x96b7,0x96f6,0x970a,0x9e97,0x9f62,0x66a6, 0x6b74,0x5217,0x52a3,0x70c8,0x88c2,0x5ec9,0x604b,0x6190, 0x6f23,0x7149,0x7c3e,0x7df4,0x806f,0x30fb,0x30fb,0x30fb};
602+ static const unsigned short s2u_98[]= { 0x84ee,0x9023,0x932c,0x5442,0x9b6f,0x6ad3,0x7089,0x8cc2, 0x8def,0x9732,0x52b4,0x5a41,0x5eca,0x5f04,0x6717,0x697c, 0x6994,0x6d6a,0x6f0f,0x7262,0x72fc,0x7bed,0x8001,0x807e, 0x874b,0x90ce,0x516d,0x9e93,0x7984,0x808b,0x9332,0x8ad6, 0x502d,0x548c,0x8a71,0x6b6a,0x8cc4,0x8107,0x60d1,0x67a0, 0x9df2,0x4e99,0x4e98,0x9c10,0x8a6b,0x85c1,0x8568,0x6900, 0x6e7e,0x7897,0x8155,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x5f0c, 0x4e10,0x4e15,0x4e2a,0x4e31,0x4e36,0x4e3c,0x4e3f,0x4e42, 0x4e56,0x4e58,0x4e82,0x4e85,0x8c6b,0x4e8a,0x8212,0x5f0d, 0x4e8e,0x4e9e,0x4e9f,0x4ea0,0x4ea2,0x4eb0,0x4eb3,0x4eb6, 0x4ece,0x4ecd,0x4ec4,0x4ec6,0x4ec2,0x4ed7,0x4ede,0x4eed, 0x4edf,0x4ef7,0x4f09,0x4f5a,0x4f30,0x4f5b,0x4f5d,0x4f57, 0x4f47,0x4f76,0x4f88,0x4f8f,0x4f98,0x4f7b,0x4f69,0x4f70, 0x4f91,0x4f6f,0x4f86,0x4f96,0x5118,0x4fd4,0x4fdf,0x4fce, 0x4fd8,0x4fdb,0x4fd1,0x4fda,0x4fd0,0x4fe4,0x4fe5,0x501a, 0x5028,0x5014,0x502a,0x5025,0x5005,0x4f1c,0x4ff6,0x5021, 0x5029,0x502c,0x4ffe,0x4fef,0x5011,0x5006,0x5043,0x5047, 0x6703,0x5055,0x5050,0x5048,0x505a,0x5056,0x506c,0x5078, 0x5080,0x509a,0x5085,0x50b4,0x50b2,0x30fb,0x30fb,0x30fb};
603+ static const unsigned short s2u_99[]= { 0x50c9,0x50ca,0x50b3,0x50c2,0x50d6,0x50de,0x50e5,0x50ed, 0x50e3,0x50ee,0x50f9,0x50f5,0x5109,0x5101,0x5102,0x5116, 0x5115,0x5114,0x511a,0x5121,0x513a,0x5137,0x513c,0x513b, 0x513f,0x5140,0x5152,0x514c,0x5154,0x5162,0x7af8,0x5169, 0x516a,0x516e,0x5180,0x5182,0x56d8,0x518c,0x5189,0x518f, 0x5191,0x5193,0x5195,0x5196,0x51a4,0x51a6,0x51a2,0x51a9, 0x51aa,0x51ab,0x51b3,0x51b1,0x51b2,0x51b0,0x51b5,0x51bd, 0x51c5,0x51c9,0x51db,0x51e0,0x8655,0x51e9,0x51ed,0x30fb, 0x51f0,0x51f5,0x51fe,0x5204,0x520b,0x5214,0x520e,0x5227, 0x522a,0x522e,0x5233,0x5239,0x524f,0x5244,0x524b,0x524c, 0x525e,0x5254,0x526a,0x5274,0x5269,0x5273,0x527f,0x527d, 0x528d,0x5294,0x5292,0x5271,0x5288,0x5291,0x8fa8,0x8fa7, 0x52ac,0x52ad,0x52bc,0x52b5,0x52c1,0x52cd,0x52d7,0x52de, 0x52e3,0x52e6,0x98ed,0x52e0,0x52f3,0x52f5,0x52f8,0x52f9, 0x5306,0x5308,0x7538,0x530d,0x5310,0x530f,0x5315,0x531a, 0x5323,0x532f,0x5331,0x5333,0x5338,0x5340,0x5346,0x5345, 0x4e17,0x5349,0x534d,0x51d6,0x535e,0x5369,0x536e,0x5918, 0x537b,0x5377,0x5382,0x5396,0x53a0,0x53a6,0x53a5,0x53ae, 0x53b0,0x53b6,0x53c3,0x7c12,0x96d9,0x53df,0x66fc,0x71ee, 0x53ee,0x53e8,0x53ed,0x53fa,0x5401,0x543d,0x5440,0x542c, 0x542d,0x543c,0x542e,0x5436,0x5429,0x541d,0x544e,0x548f, 0x5475,0x548e,0x545f,0x5471,0x5477,0x5470,0x5492,0x547b, 0x5480,0x5476,0x5484,0x5490,0x5486,0x54c7,0x54a2,0x54b8, 0x54a5,0x54ac,0x54c4,0x54c8,0x54a8,0x30fb,0x30fb,0x30fb};
604+ static const unsigned short s2u_9a[]= { 0x54ab,0x54c2,0x54a4,0x54be,0x54bc,0x54d8,0x54e5,0x54e6, 0x550f,0x5514,0x54fd,0x54ee,0x54ed,0x54fa,0x54e2,0x5539, 0x5540,0x5563,0x554c,0x552e,0x555c,0x5545,0x5556,0x5557, 0x5538,0x5533,0x555d,0x5599,0x5580,0x54af,0x558a,0x559f, 0x557b,0x557e,0x5598,0x559e,0x55ae,0x557c,0x5583,0x55a9, 0x5587,0x55a8,0x55da,0x55c5,0x55df,0x55c4,0x55dc,0x55e4, 0x55d4,0x5614,0x55f7,0x5616,0x55fe,0x55fd,0x561b,0x55f9, 0x564e,0x5650,0x71df,0x5634,0x5636,0x5632,0x5638,0x30fb, 0x566b,0x5664,0x562f,0x566c,0x566a,0x5686,0x5680,0x568a, 0x56a0,0x5694,0x568f,0x56a5,0x56ae,0x56b6,0x56b4,0x56c2, 0x56bc,0x56c1,0x56c3,0x56c0,0x56c8,0x56ce,0x56d1,0x56d3, 0x56d7,0x56ee,0x56f9,0x5700,0x56ff,0x5704,0x5709,0x5708, 0x570b,0x570d,0x5713,0x5718,0x5716,0x55c7,0x571c,0x5726, 0x5737,0x5738,0x574e,0x573b,0x5740,0x574f,0x5769,0x57c0, 0x5788,0x5761,0x577f,0x5789,0x5793,0x57a0,0x57b3,0x57a4, 0x57aa,0x57b0,0x57c3,0x57c6,0x57d4,0x57d2,0x57d3,0x580a, 0x57d6,0x57e3,0x580b,0x5819,0x581d,0x5872,0x5821,0x5862, 0x584b,0x5870,0x6bc0,0x5852,0x583d,0x5879,0x5885,0x58b9, 0x589f,0x58ab,0x58ba,0x58de,0x58bb,0x58b8,0x58ae,0x58c5, 0x58d3,0x58d1,0x58d7,0x58d9,0x58d8,0x58e5,0x58dc,0x58e4, 0x58df,0x58ef,0x58fa,0x58f9,0x58fb,0x58fc,0x58fd,0x5902, 0x590a,0x5910,0x591b,0x68a6,0x5925,0x592c,0x592d,0x5932, 0x5938,0x593e,0x7ad2,0x5955,0x5950,0x594e,0x595a,0x5958, 0x5962,0x5960,0x5967,0x596c,0x5969,0x30fb,0x30fb,0x30fb};
605+ static const unsigned short s2u_9b[]= { 0x5978,0x5981,0x599d,0x4f5e,0x4fab,0x59a3,0x59b2,0x59c6, 0x59e8,0x59dc,0x598d,0x59d9,0x59da,0x5a25,0x5a1f,0x5a11, 0x5a1c,0x5a09,0x5a1a,0x5a40,0x5a6c,0x5a49,0x5a35,0x5a36, 0x5a62,0x5a6a,0x5a9a,0x5abc,0x5abe,0x5acb,0x5ac2,0x5abd, 0x5ae3,0x5ad7,0x5ae6,0x5ae9,0x5ad6,0x5afa,0x5afb,0x5b0c, 0x5b0b,0x5b16,0x5b32,0x5ad0,0x5b2a,0x5b36,0x5b3e,0x5b43, 0x5b45,0x5b40,0x5b51,0x5b55,0x5b5a,0x5b5b,0x5b65,0x5b69, 0x5b70,0x5b73,0x5b75,0x5b78,0x6588,0x5b7a,0x5b80,0x30fb, 0x5b83,0x5ba6,0x5bb8,0x5bc3,0x5bc7,0x5bc9,0x5bd4,0x5bd0, 0x5be4,0x5be6,0x5be2,0x5bde,0x5be5,0x5beb,0x5bf0,0x5bf6, 0x5bf3,0x5c05,0x5c07,0x5c08,0x5c0d,0x5c13,0x5c20,0x5c22, 0x5c28,0x5c38,0x5c39,0x5c41,0x5c46,0x5c4e,0x5c53,0x5c50, 0x5c4f,0x5b71,0x5c6c,0x5c6e,0x4e62,0x5c76,0x5c79,0x5c8c, 0x5c91,0x5c94,0x599b,0x5cab,0x5cbb,0x5cb6,0x5cbc,0x5cb7, 0x5cc5,0x5cbe,0x5cc7,0x5cd9,0x5ce9,0x5cfd,0x5cfa,0x5ced, 0x5d8c,0x5cea,0x5d0b,0x5d15,0x5d17,0x5d5c,0x5d1f,0x5d1b, 0x5d11,0x5d14,0x5d22,0x5d1a,0x5d19,0x5d18,0x5d4c,0x5d52, 0x5d4e,0x5d4b,0x5d6c,0x5d73,0x5d76,0x5d87,0x5d84,0x5d82, 0x5da2,0x5d9d,0x5dac,0x5dae,0x5dbd,0x5d90,0x5db7,0x5dbc, 0x5dc9,0x5dcd,0x5dd3,0x5dd2,0x5dd6,0x5ddb,0x5deb,0x5df2, 0x5df5,0x5e0b,0x5e1a,0x5e19,0x5e11,0x5e1b,0x5e36,0x5e37, 0x5e44,0x5e43,0x5e40,0x5e4e,0x5e57,0x5e54,0x5e5f,0x5e62, 0x5e64,0x5e47,0x5e75,0x5e76,0x5e7a,0x9ebc,0x5e7f,0x5ea0, 0x5ec1,0x5ec2,0x5ec8,0x5ed0,0x5ecf,0x30fb,0x30fb,0x30fb};
606+ static const unsigned short s2u_9c[]= { 0x5ed6,0x5ee3,0x5edd,0x5eda,0x5edb,0x5ee2,0x5ee1,0x5ee8, 0x5ee9,0x5eec,0x5ef1,0x5ef3,0x5ef0,0x5ef4,0x5ef8,0x5efe, 0x5f03,0x5f09,0x5f5d,0x5f5c,0x5f0b,0x5f11,0x5f16,0x5f29, 0x5f2d,0x5f38,0x5f41,0x5f48,0x5f4c,0x5f4e,0x5f2f,0x5f51, 0x5f56,0x5f57,0x5f59,0x5f61,0x5f6d,0x5f73,0x5f77,0x5f83, 0x5f82,0x5f7f,0x5f8a,0x5f88,0x5f91,0x5f87,0x5f9e,0x5f99, 0x5f98,0x5fa0,0x5fa8,0x5fad,0x5fbc,0x5fd6,0x5ffb,0x5fe4, 0x5ff8,0x5ff1,0x5fdd,0x60b3,0x5fff,0x6021,0x6060,0x30fb, 0x6019,0x6010,0x6029,0x600e,0x6031,0x601b,0x6015,0x602b, 0x6026,0x600f,0x603a,0x605a,0x6041,0x606a,0x6077,0x605f, 0x604a,0x6046,0x604d,0x6063,0x6043,0x6064,0x6042,0x606c, 0x606b,0x6059,0x6081,0x608d,0x60e7,0x6083,0x609a,0x6084, 0x609b,0x6096,0x6097,0x6092,0x60a7,0x608b,0x60e1,0x60b8, 0x60e0,0x60d3,0x60b4,0x5ff0,0x60bd,0x60c6,0x60b5,0x60d8, 0x614d,0x6115,0x6106,0x60f6,0x60f7,0x6100,0x60f4,0x60fa, 0x6103,0x6121,0x60fb,0x60f1,0x610d,0x610e,0x6147,0x613e, 0x6128,0x6127,0x614a,0x613f,0x613c,0x612c,0x6134,0x613d, 0x6142,0x6144,0x6173,0x6177,0x6158,0x6159,0x615a,0x616b, 0x6174,0x616f,0x6165,0x6171,0x615f,0x615d,0x6153,0x6175, 0x6199,0x6196,0x6187,0x61ac,0x6194,0x619a,0x618a,0x6191, 0x61ab,0x61ae,0x61cc,0x61ca,0x61c9,0x61f7,0x61c8,0x61c3, 0x61c6,0x61ba,0x61cb,0x7f79,0x61cd,0x61e6,0x61e3,0x61f6, 0x61fa,0x61f4,0x61ff,0x61fd,0x61fc,0x61fe,0x6200,0x6208, 0x6209,0x620d,0x620c,0x6214,0x621b,0x30fb,0x30fb,0x30fb};
607+ static const unsigned short s2u_9d[]= { 0x621e,0x6221,0x622a,0x622e,0x6230,0x6232,0x6233,0x6241, 0x624e,0x625e,0x6263,0x625b,0x6260,0x6268,0x627c,0x6282, 0x6289,0x627e,0x6292,0x6293,0x6296,0x62d4,0x6283,0x6294, 0x62d7,0x62d1,0x62bb,0x62cf,0x62ff,0x62c6,0x64d4,0x62c8, 0x62dc,0x62cc,0x62ca,0x62c2,0x62c7,0x629b,0x62c9,0x630c, 0x62ee,0x62f1,0x6327,0x6302,0x6308,0x62ef,0x62f5,0x6350, 0x633e,0x634d,0x641c,0x634f,0x6396,0x638e,0x6380,0x63ab, 0x6376,0x63a3,0x638f,0x6389,0x639f,0x63b5,0x636b,0x30fb, 0x6369,0x63be,0x63e9,0x63c0,0x63c6,0x63e3,0x63c9,0x63d2, 0x63f6,0x63c4,0x6416,0x6434,0x6406,0x6413,0x6426,0x6436, 0x651d,0x6417,0x6428,0x640f,0x6467,0x646f,0x6476,0x644e, 0x652a,0x6495,0x6493,0x64a5,0x64a9,0x6488,0x64bc,0x64da, 0x64d2,0x64c5,0x64c7,0x64bb,0x64d8,0x64c2,0x64f1,0x64e7, 0x8209,0x64e0,0x64e1,0x62ac,0x64e3,0x64ef,0x652c,0x64f6, 0x64f4,0x64f2,0x64fa,0x6500,0x64fd,0x6518,0x651c,0x6505, 0x6524,0x6523,0x652b,0x6534,0x6535,0x6537,0x6536,0x6538, 0x754b,0x6548,0x6556,0x6555,0x654d,0x6558,0x655e,0x655d, 0x6572,0x6578,0x6582,0x6583,0x8b8a,0x659b,0x659f,0x65ab, 0x65b7,0x65c3,0x65c6,0x65c1,0x65c4,0x65cc,0x65d2,0x65db, 0x65d9,0x65e0,0x65e1,0x65f1,0x6772,0x660a,0x6603,0x65fb, 0x6773,0x6635,0x6636,0x6634,0x661c,0x664f,0x6644,0x6649, 0x6641,0x665e,0x665d,0x6664,0x6667,0x6668,0x665f,0x6662, 0x6670,0x6683,0x6688,0x668e,0x6689,0x6684,0x6698,0x669d, 0x66c1,0x66b9,0x66c9,0x66be,0x66bc,0x30fb,0x30fb,0x30fb};
608+ static const unsigned short s2u_9e[]= { 0x66c4,0x66b8,0x66d6,0x66da,0x66e0,0x663f,0x66e6,0x66e9, 0x66f0,0x66f5,0x66f7,0x670f,0x6716,0x671e,0x6726,0x6727, 0x9738,0x672e,0x673f,0x6736,0x6741,0x6738,0x6737,0x6746, 0x675e,0x6760,0x6759,0x6763,0x6764,0x6789,0x6770,0x67a9, 0x677c,0x676a,0x678c,0x678b,0x67a6,0x67a1,0x6785,0x67b7, 0x67ef,0x67b4,0x67ec,0x67b3,0x67e9,0x67b8,0x67e4,0x67de, 0x67dd,0x67e2,0x67ee,0x67b9,0x67ce,0x67c6,0x67e7,0x6a9c, 0x681e,0x6846,0x6829,0x6840,0x684d,0x6832,0x684e,0x30fb, 0x68b3,0x682b,0x6859,0x6863,0x6877,0x687f,0x689f,0x688f, 0x68ad,0x6894,0x689d,0x689b,0x6883,0x6aae,0x68b9,0x6874, 0x68b5,0x68a0,0x68ba,0x690f,0x688d,0x687e,0x6901,0x68ca, 0x6908,0x68d8,0x6922,0x6926,0x68e1,0x690c,0x68cd,0x68d4, 0x68e7,0x68d5,0x6936,0x6912,0x6904,0x68d7,0x68e3,0x6925, 0x68f9,0x68e0,0x68ef,0x6928,0x692a,0x691a,0x6923,0x6921, 0x68c6,0x6979,0x6977,0x695c,0x6978,0x696b,0x6954,0x697e, 0x696e,0x6939,0x6974,0x693d,0x6959,0x6930,0x6961,0x695e, 0x695d,0x6981,0x696a,0x69b2,0x69ae,0x69d0,0x69bf,0x69c1, 0x69d3,0x69be,0x69ce,0x5be8,0x69ca,0x69dd,0x69bb,0x69c3, 0x69a7,0x6a2e,0x6991,0x69a0,0x699c,0x6995,0x69b4,0x69de, 0x69e8,0x6a02,0x6a1b,0x69ff,0x6b0a,0x69f9,0x69f2,0x69e7, 0x6a05,0x69b1,0x6a1e,0x69ed,0x6a14,0x69eb,0x6a0a,0x6a12, 0x6ac1,0x6a23,0x6a13,0x6a44,0x6a0c,0x6a72,0x6a36,0x6a78, 0x6a47,0x6a62,0x6a59,0x6a66,0x6a48,0x6a38,0x6a22,0x6a90, 0x6a8d,0x6aa0,0x6a84,0x6aa2,0x6aa3,0x30fb,0x30fb,0x30fb};
609+ static const unsigned short s2u_9f[]= { 0x6a97,0x8617,0x6abb,0x6ac3,0x6ac2,0x6ab8,0x6ab3,0x6aac, 0x6ade,0x6ad1,0x6adf,0x6aaa,0x6ada,0x6aea,0x6afb,0x6b05, 0x8616,0x6afa,0x6b12,0x6b16,0x9b31,0x6b1f,0x6b38,0x6b37, 0x76dc,0x6b39,0x98ee,0x6b47,0x6b43,0x6b49,0x6b50,0x6b59, 0x6b54,0x6b5b,0x6b5f,0x6b61,0x6b78,0x6b79,0x6b7f,0x6b80, 0x6b84,0x6b83,0x6b8d,0x6b98,0x6b95,0x6b9e,0x6ba4,0x6baa, 0x6bab,0x6baf,0x6bb2,0x6bb1,0x6bb3,0x6bb7,0x6bbc,0x6bc6, 0x6bcb,0x6bd3,0x6bdf,0x6bec,0x6beb,0x6bf3,0x6bef,0x30fb, 0x9ebe,0x6c08,0x6c13,0x6c14,0x6c1b,0x6c24,0x6c23,0x6c5e, 0x6c55,0x6c62,0x6c6a,0x6c82,0x6c8d,0x6c9a,0x6c81,0x6c9b, 0x6c7e,0x6c68,0x6c73,0x6c92,0x6c90,0x6cc4,0x6cf1,0x6cd3, 0x6cbd,0x6cd7,0x6cc5,0x6cdd,0x6cae,0x6cb1,0x6cbe,0x6cba, 0x6cdb,0x6cef,0x6cd9,0x6cea,0x6d1f,0x884d,0x6d36,0x6d2b, 0x6d3d,0x6d38,0x6d19,0x6d35,0x6d33,0x6d12,0x6d0c,0x6d63, 0x6d93,0x6d64,0x6d5a,0x6d79,0x6d59,0x6d8e,0x6d95,0x6fe4, 0x6d85,0x6df9,0x6e15,0x6e0a,0x6db5,0x6dc7,0x6de6,0x6db8, 0x6dc6,0x6dec,0x6dde,0x6dcc,0x6de8,0x6dd2,0x6dc5,0x6dfa, 0x6dd9,0x6de4,0x6dd5,0x6dea,0x6dee,0x6e2d,0x6e6e,0x6e2e, 0x6e19,0x6e72,0x6e5f,0x6e3e,0x6e23,0x6e6b,0x6e2b,0x6e76, 0x6e4d,0x6e1f,0x6e43,0x6e3a,0x6e4e,0x6e24,0x6eff,0x6e1d, 0x6e38,0x6e82,0x6eaa,0x6e98,0x6ec9,0x6eb7,0x6ed3,0x6ebd, 0x6eaf,0x6ec4,0x6eb2,0x6ed4,0x6ed5,0x6e8f,0x6ea5,0x6ec2, 0x6e9f,0x6f41,0x6f11,0x704c,0x6eec,0x6ef8,0x6efe,0x6f3f, 0x6ef2,0x6f31,0x6eef,0x6f32,0x6ecc,0x30fb,0x30fb,0x30fb};
610+ static const unsigned short s2u_e0[]= { 0x6f3e,0x6f13,0x6ef7,0x6f86,0x6f7a,0x6f78,0x6f81,0x6f80, 0x6f6f,0x6f5b,0x6ff3,0x6f6d,0x6f82,0x6f7c,0x6f58,0x6f8e, 0x6f91,0x6fc2,0x6f66,0x6fb3,0x6fa3,0x6fa1,0x6fa4,0x6fb9, 0x6fc6,0x6faa,0x6fdf,0x6fd5,0x6fec,0x6fd4,0x6fd8,0x6ff1, 0x6fee,0x6fdb,0x7009,0x700b,0x6ffa,0x7011,0x7001,0x700f, 0x6ffe,0x701b,0x701a,0x6f74,0x701d,0x7018,0x701f,0x7030, 0x703e,0x7032,0x7051,0x7063,0x7099,0x7092,0x70af,0x70f1, 0x70ac,0x70b8,0x70b3,0x70ae,0x70df,0x70cb,0x70dd,0x30fb, 0x70d9,0x7109,0x70fd,0x711c,0x7119,0x7165,0x7155,0x7188, 0x7166,0x7162,0x714c,0x7156,0x716c,0x718f,0x71fb,0x7184, 0x7195,0x71a8,0x71ac,0x71d7,0x71b9,0x71be,0x71d2,0x71c9, 0x71d4,0x71ce,0x71e0,0x71ec,0x71e7,0x71f5,0x71fc,0x71f9, 0x71ff,0x720d,0x7210,0x721b,0x7228,0x722d,0x722c,0x7230, 0x7232,0x723b,0x723c,0x723f,0x7240,0x7246,0x724b,0x7258, 0x7274,0x727e,0x7282,0x7281,0x7287,0x7292,0x7296,0x72a2, 0x72a7,0x72b9,0x72b2,0x72c3,0x72c6,0x72c4,0x72ce,0x72d2, 0x72e2,0x72e0,0x72e1,0x72f9,0x72f7,0x500f,0x7317,0x730a, 0x731c,0x7316,0x731d,0x7334,0x732f,0x7329,0x7325,0x733e, 0x734e,0x734f,0x9ed8,0x7357,0x736a,0x7368,0x7370,0x7378, 0x7375,0x737b,0x737a,0x73c8,0x73b3,0x73ce,0x73bb,0x73c0, 0x73e5,0x73ee,0x73de,0x74a2,0x7405,0x746f,0x7425,0x73f8, 0x7432,0x743a,0x7455,0x743f,0x745f,0x7459,0x7441,0x745c, 0x7469,0x7470,0x7463,0x746a,0x7476,0x747e,0x748b,0x749e, 0x74a7,0x74ca,0x74cf,0x74d4,0x73f1,0x30fb,0x30fb,0x30fb};
611+ static const unsigned short s2u_e1[]= { 0x74e0,0x74e3,0x74e7,0x74e9,0x74ee,0x74f2,0x74f0,0x74f1, 0x74f8,0x74f7,0x7504,0x7503,0x7505,0x750c,0x750e,0x750d, 0x7515,0x7513,0x751e,0x7526,0x752c,0x753c,0x7544,0x754d, 0x754a,0x7549,0x755b,0x7546,0x755a,0x7569,0x7564,0x7567, 0x756b,0x756d,0x7578,0x7576,0x7586,0x7587,0x7574,0x758a, 0x7589,0x7582,0x7594,0x759a,0x759d,0x75a5,0x75a3,0x75c2, 0x75b3,0x75c3,0x75b5,0x75bd,0x75b8,0x75bc,0x75b1,0x75cd, 0x75ca,0x75d2,0x75d9,0x75e3,0x75de,0x75fe,0x75ff,0x30fb, 0x75fc,0x7601,0x75f0,0x75fa,0x75f2,0x75f3,0x760b,0x760d, 0x7609,0x761f,0x7627,0x7620,0x7621,0x7622,0x7624,0x7634, 0x7630,0x763b,0x7647,0x7648,0x7646,0x765c,0x7658,0x7661, 0x7662,0x7668,0x7669,0x766a,0x7667,0x766c,0x7670,0x7672, 0x7676,0x7678,0x767c,0x7680,0x7683,0x7688,0x768b,0x768e, 0x7696,0x7693,0x7699,0x769a,0x76b0,0x76b4,0x76b8,0x76b9, 0x76ba,0x76c2,0x76cd,0x76d6,0x76d2,0x76de,0x76e1,0x76e5, 0x76e7,0x76ea,0x862f,0x76fb,0x7708,0x7707,0x7704,0x7729, 0x7724,0x771e,0x7725,0x7726,0x771b,0x7737,0x7738,0x7747, 0x775a,0x7768,0x776b,0x775b,0x7765,0x777f,0x777e,0x7779, 0x778e,0x778b,0x7791,0x77a0,0x779e,0x77b0,0x77b6,0x77b9, 0x77bf,0x77bc,0x77bd,0x77bb,0x77c7,0x77cd,0x77d7,0x77da, 0x77dc,0x77e3,0x77ee,0x77fc,0x780c,0x7812,0x7926,0x7820, 0x792a,0x7845,0x788e,0x7874,0x7886,0x787c,0x789a,0x788c, 0x78a3,0x78b5,0x78aa,0x78af,0x78d1,0x78c6,0x78cb,0x78d4, 0x78be,0x78bc,0x78c5,0x78ca,0x78ec,0x30fb,0x30fb,0x30fb};
612+ static const unsigned short s2u_e2[]= { 0x78e7,0x78da,0x78fd,0x78f4,0x7907,0x7912,0x7911,0x7919, 0x792c,0x792b,0x7940,0x7960,0x7957,0x795f,0x795a,0x7955, 0x7953,0x797a,0x797f,0x798a,0x799d,0x79a7,0x9f4b,0x79aa, 0x79ae,0x79b3,0x79b9,0x79ba,0x79c9,0x79d5,0x79e7,0x79ec, 0x79e1,0x79e3,0x7a08,0x7a0d,0x7a18,0x7a19,0x7a20,0x7a1f, 0x7980,0x7a31,0x7a3b,0x7a3e,0x7a37,0x7a43,0x7a57,0x7a49, 0x7a61,0x7a62,0x7a69,0x9f9d,0x7a70,0x7a79,0x7a7d,0x7a88, 0x7a97,0x7a95,0x7a98,0x7a96,0x7aa9,0x7ac8,0x7ab0,0x30fb, 0x7ab6,0x7ac5,0x7ac4,0x7abf,0x9083,0x7ac7,0x7aca,0x7acd, 0x7acf,0x7ad5,0x7ad3,0x7ad9,0x7ada,0x7add,0x7ae1,0x7ae2, 0x7ae6,0x7aed,0x7af0,0x7b02,0x7b0f,0x7b0a,0x7b06,0x7b33, 0x7b18,0x7b19,0x7b1e,0x7b35,0x7b28,0x7b36,0x7b50,0x7b7a, 0x7b04,0x7b4d,0x7b0b,0x7b4c,0x7b45,0x7b75,0x7b65,0x7b74, 0x7b67,0x7b70,0x7b71,0x7b6c,0x7b6e,0x7b9d,0x7b98,0x7b9f, 0x7b8d,0x7b9c,0x7b9a,0x7b8b,0x7b92,0x7b8f,0x7b5d,0x7b99, 0x7bcb,0x7bc1,0x7bcc,0x7bcf,0x7bb4,0x7bc6,0x7bdd,0x7be9, 0x7c11,0x7c14,0x7be6,0x7be5,0x7c60,0x7c00,0x7c07,0x7c13, 0x7bf3,0x7bf7,0x7c17,0x7c0d,0x7bf6,0x7c23,0x7c27,0x7c2a, 0x7c1f,0x7c37,0x7c2b,0x7c3d,0x7c4c,0x7c43,0x7c54,0x7c4f, 0x7c40,0x7c50,0x7c58,0x7c5f,0x7c64,0x7c56,0x7c65,0x7c6c, 0x7c75,0x7c83,0x7c90,0x7ca4,0x7cad,0x7ca2,0x7cab,0x7ca1, 0x7ca8,0x7cb3,0x7cb2,0x7cb1,0x7cae,0x7cb9,0x7cbd,0x7cc0, 0x7cc5,0x7cc2,0x7cd8,0x7cd2,0x7cdc,0x7ce2,0x9b3b,0x7cef, 0x7cf2,0x7cf4,0x7cf6,0x7cfa,0x7d06,0x30fb,0x30fb,0x30fb};
613+ static const unsigned short s2u_e3[]= { 0x7d02,0x7d1c,0x7d15,0x7d0a,0x7d45,0x7d4b,0x7d2e,0x7d32, 0x7d3f,0x7d35,0x7d46,0x7d73,0x7d56,0x7d4e,0x7d72,0x7d68, 0x7d6e,0x7d4f,0x7d63,0x7d93,0x7d89,0x7d5b,0x7d8f,0x7d7d, 0x7d9b,0x7dba,0x7dae,0x7da3,0x7db5,0x7dc7,0x7dbd,0x7dab, 0x7e3d,0x7da2,0x7daf,0x7ddc,0x7db8,0x7d9f,0x7db0,0x7dd8, 0x7ddd,0x7de4,0x7dde,0x7dfb,0x7df2,0x7de1,0x7e05,0x7e0a, 0x7e23,0x7e21,0x7e12,0x7e31,0x7e1f,0x7e09,0x7e0b,0x7e22, 0x7e46,0x7e66,0x7e3b,0x7e35,0x7e39,0x7e43,0x7e37,0x30fb, 0x7e32,0x7e3a,0x7e67,0x7e5d,0x7e56,0x7e5e,0x7e59,0x7e5a, 0x7e79,0x7e6a,0x7e69,0x7e7c,0x7e7b,0x7e83,0x7dd5,0x7e7d, 0x8fae,0x7e7f,0x7e88,0x7e89,0x7e8c,0x7e92,0x7e90,0x7e93, 0x7e94,0x7e96,0x7e8e,0x7e9b,0x7e9c,0x7f38,0x7f3a,0x7f45, 0x7f4c,0x7f4d,0x7f4e,0x7f50,0x7f51,0x7f55,0x7f54,0x7f58, 0x7f5f,0x7f60,0x7f68,0x7f69,0x7f67,0x7f78,0x7f82,0x7f86, 0x7f83,0x7f88,0x7f87,0x7f8c,0x7f94,0x7f9e,0x7f9d,0x7f9a, 0x7fa3,0x7faf,0x7fb2,0x7fb9,0x7fae,0x7fb6,0x7fb8,0x8b71, 0x7fc5,0x7fc6,0x7fca,0x7fd5,0x7fd4,0x7fe1,0x7fe6,0x7fe9, 0x7ff3,0x7ff9,0x98dc,0x8006,0x8004,0x800b,0x8012,0x8018, 0x8019,0x801c,0x8021,0x8028,0x803f,0x803b,0x804a,0x8046, 0x8052,0x8058,0x805a,0x805f,0x8062,0x8068,0x8073,0x8072, 0x8070,0x8076,0x8079,0x807d,0x807f,0x8084,0x8086,0x8085, 0x809b,0x8093,0x809a,0x80ad,0x5190,0x80ac,0x80db,0x80e5, 0x80d9,0x80dd,0x80c4,0x80da,0x80d6,0x8109,0x80ef,0x80f1, 0x811b,0x8129,0x8123,0x812f,0x814b,0x30fb,0x30fb,0x30fb};
614+ static const unsigned short s2u_e4[]= { 0x968b,0x8146,0x813e,0x8153,0x8151,0x80fc,0x8171,0x816e, 0x8165,0x8166,0x8174,0x8183,0x8188,0x818a,0x8180,0x8182, 0x81a0,0x8195,0x81a4,0x81a3,0x815f,0x8193,0x81a9,0x81b0, 0x81b5,0x81be,0x81b8,0x81bd,0x81c0,0x81c2,0x81ba,0x81c9, 0x81cd,0x81d1,0x81d9,0x81d8,0x81c8,0x81da,0x81df,0x81e0, 0x81e7,0x81fa,0x81fb,0x81fe,0x8201,0x8202,0x8205,0x8207, 0x820a,0x820d,0x8210,0x8216,0x8229,0x822b,0x8238,0x8233, 0x8240,0x8259,0x8258,0x825d,0x825a,0x825f,0x8264,0x30fb, 0x8262,0x8268,0x826a,0x826b,0x822e,0x8271,0x8277,0x8278, 0x827e,0x828d,0x8292,0x82ab,0x829f,0x82bb,0x82ac,0x82e1, 0x82e3,0x82df,0x82d2,0x82f4,0x82f3,0x82fa,0x8393,0x8303, 0x82fb,0x82f9,0x82de,0x8306,0x82dc,0x8309,0x82d9,0x8335, 0x8334,0x8316,0x8332,0x8331,0x8340,0x8339,0x8350,0x8345, 0x832f,0x832b,0x8317,0x8318,0x8385,0x839a,0x83aa,0x839f, 0x83a2,0x8396,0x8323,0x838e,0x8387,0x838a,0x837c,0x83b5, 0x8373,0x8375,0x83a0,0x8389,0x83a8,0x83f4,0x8413,0x83eb, 0x83ce,0x83fd,0x8403,0x83d8,0x840b,0x83c1,0x83f7,0x8407, 0x83e0,0x83f2,0x840d,0x8422,0x8420,0x83bd,0x8438,0x8506, 0x83fb,0x846d,0x842a,0x843c,0x855a,0x8484,0x8477,0x846b, 0x84ad,0x846e,0x8482,0x8469,0x8446,0x842c,0x846f,0x8479, 0x8435,0x84ca,0x8462,0x84b9,0x84bf,0x849f,0x84d9,0x84cd, 0x84bb,0x84da,0x84d0,0x84c1,0x84c6,0x84d6,0x84a1,0x8521, 0x84ff,0x84f4,0x8517,0x8518,0x852c,0x851f,0x8515,0x8514, 0x84fc,0x8540,0x8563,0x8558,0x8548,0x30fb,0x30fb,0x30fb};
615+ static const unsigned short s2u_e5[]= { 0x8541,0x8602,0x854b,0x8555,0x8580,0x85a4,0x8588,0x8591, 0x858a,0x85a8,0x856d,0x8594,0x859b,0x85ea,0x8587,0x859c, 0x8577,0x857e,0x8590,0x85c9,0x85ba,0x85cf,0x85b9,0x85d0, 0x85d5,0x85dd,0x85e5,0x85dc,0x85f9,0x860a,0x8613,0x860b, 0x85fe,0x85fa,0x8606,0x8622,0x861a,0x8630,0x863f,0x864d, 0x4e55,0x8654,0x865f,0x8667,0x8671,0x8693,0x86a3,0x86a9, 0x86aa,0x868b,0x868c,0x86b6,0x86af,0x86c4,0x86c6,0x86b0, 0x86c9,0x8823,0x86ab,0x86d4,0x86de,0x86e9,0x86ec,0x30fb, 0x86df,0x86db,0x86ef,0x8712,0x8706,0x8708,0x8700,0x8703, 0x86fb,0x8711,0x8709,0x870d,0x86f9,0x870a,0x8734,0x873f, 0x8737,0x873b,0x8725,0x8729,0x871a,0x8760,0x875f,0x8778, 0x874c,0x874e,0x8774,0x8757,0x8768,0x876e,0x8759,0x8753, 0x8763,0x876a,0x8805,0x87a2,0x879f,0x8782,0x87af,0x87cb, 0x87bd,0x87c0,0x87d0,0x96d6,0x87ab,0x87c4,0x87b3,0x87c7, 0x87c6,0x87bb,0x87ef,0x87f2,0x87e0,0x880f,0x880d,0x87fe, 0x87f6,0x87f7,0x880e,0x87d2,0x8811,0x8816,0x8815,0x8822, 0x8821,0x8831,0x8836,0x8839,0x8827,0x883b,0x8844,0x8842, 0x8852,0x8859,0x885e,0x8862,0x886b,0x8881,0x887e,0x889e, 0x8875,0x887d,0x88b5,0x8872,0x8882,0x8897,0x8892,0x88ae, 0x8899,0x88a2,0x888d,0x88a4,0x88b0,0x88bf,0x88b1,0x88c3, 0x88c4,0x88d4,0x88d8,0x88d9,0x88dd,0x88f9,0x8902,0x88fc, 0x88f4,0x88e8,0x88f2,0x8904,0x890c,0x890a,0x8913,0x8943, 0x891e,0x8925,0x892a,0x892b,0x8941,0x8944,0x893b,0x8936, 0x8938,0x894c,0x891d,0x8960,0x895e,0x30fb,0x30fb,0x30fb};
616+ static const unsigned short s2u_e6[]= { 0x8966,0x8964,0x896d,0x896a,0x896f,0x8974,0x8977,0x897e, 0x8983,0x8988,0x898a,0x8993,0x8998,0x89a1,0x89a9,0x89a6, 0x89ac,0x89af,0x89b2,0x89ba,0x89bd,0x89bf,0x89c0,0x89da, 0x89dc,0x89dd,0x89e7,0x89f4,0x89f8,0x8a03,0x8a16,0x8a10, 0x8a0c,0x8a1b,0x8a1d,0x8a25,0x8a36,0x8a41,0x8a5b,0x8a52, 0x8a46,0x8a48,0x8a7c,0x8a6d,0x8a6c,0x8a62,0x8a85,0x8a82, 0x8a84,0x8aa8,0x8aa1,0x8a91,0x8aa5,0x8aa6,0x8a9a,0x8aa3, 0x8ac4,0x8acd,0x8ac2,0x8ada,0x8aeb,0x8af3,0x8ae7,0x30fb, 0x8ae4,0x8af1,0x8b14,0x8ae0,0x8ae2,0x8af7,0x8ade,0x8adb, 0x8b0c,0x8b07,0x8b1a,0x8ae1,0x8b16,0x8b10,0x8b17,0x8b20, 0x8b33,0x97ab,0x8b26,0x8b2b,0x8b3e,0x8b28,0x8b41,0x8b4c, 0x8b4f,0x8b4e,0x8b49,0x8b56,0x8b5b,0x8b5a,0x8b6b,0x8b5f, 0x8b6c,0x8b6f,0x8b74,0x8b7d,0x8b80,0x8b8c,0x8b8e,0x8b92, 0x8b93,0x8b96,0x8b99,0x8b9a,0x8c3a,0x8c41,0x8c3f,0x8c48, 0x8c4c,0x8c4e,0x8c50,0x8c55,0x8c62,0x8c6c,0x8c78,0x8c7a, 0x8c82,0x8c89,0x8c85,0x8c8a,0x8c8d,0x8c8e,0x8c94,0x8c7c, 0x8c98,0x621d,0x8cad,0x8caa,0x8cbd,0x8cb2,0x8cb3,0x8cae, 0x8cb6,0x8cc8,0x8cc1,0x8ce4,0x8ce3,0x8cda,0x8cfd,0x8cfa, 0x8cfb,0x8d04,0x8d05,0x8d0a,0x8d07,0x8d0f,0x8d0d,0x8d10, 0x9f4e,0x8d13,0x8ccd,0x8d14,0x8d16,0x8d67,0x8d6d,0x8d71, 0x8d73,0x8d81,0x8d99,0x8dc2,0x8dbe,0x8dba,0x8dcf,0x8dda, 0x8dd6,0x8dcc,0x8ddb,0x8dcb,0x8dea,0x8deb,0x8ddf,0x8de3, 0x8dfc,0x8e08,0x8e09,0x8dff,0x8e1d,0x8e1e,0x8e10,0x8e1f, 0x8e42,0x8e35,0x8e30,0x8e34,0x8e4a,0x30fb,0x30fb,0x30fb};
617+ static const unsigned short s2u_e7[]= { 0x8e47,0x8e49,0x8e4c,0x8e50,0x8e48,0x8e59,0x8e64,0x8e60, 0x8e2a,0x8e63,0x8e55,0x8e76,0x8e72,0x8e7c,0x8e81,0x8e87, 0x8e85,0x8e84,0x8e8b,0x8e8a,0x8e93,0x8e91,0x8e94,0x8e99, 0x8eaa,0x8ea1,0x8eac,0x8eb0,0x8ec6,0x8eb1,0x8ebe,0x8ec5, 0x8ec8,0x8ecb,0x8edb,0x8ee3,0x8efc,0x8efb,0x8eeb,0x8efe, 0x8f0a,0x8f05,0x8f15,0x8f12,0x8f19,0x8f13,0x8f1c,0x8f1f, 0x8f1b,0x8f0c,0x8f26,0x8f33,0x8f3b,0x8f39,0x8f45,0x8f42, 0x8f3e,0x8f4c,0x8f49,0x8f46,0x8f4e,0x8f57,0x8f5c,0x30fb, 0x8f62,0x8f63,0x8f64,0x8f9c,0x8f9f,0x8fa3,0x8fad,0x8faf, 0x8fb7,0x8fda,0x8fe5,0x8fe2,0x8fea,0x8fef,0x9087,0x8ff4, 0x9005,0x8ff9,0x8ffa,0x9011,0x9015,0x9021,0x900d,0x901e, 0x9016,0x900b,0x9027,0x9036,0x9035,0x9039,0x8ff8,0x904f, 0x9050,0x9051,0x9052,0x900e,0x9049,0x903e,0x9056,0x9058, 0x905e,0x9068,0x906f,0x9076,0x96a8,0x9072,0x9082,0x907d, 0x9081,0x9080,0x908a,0x9089,0x908f,0x90a8,0x90af,0x90b1, 0x90b5,0x90e2,0x90e4,0x6248,0x90db,0x9102,0x9112,0x9119, 0x9132,0x9130,0x914a,0x9156,0x9158,0x9163,0x9165,0x9169, 0x9173,0x9172,0x918b,0x9189,0x9182,0x91a2,0x91ab,0x91af, 0x91aa,0x91b5,0x91b4,0x91ba,0x91c0,0x91c1,0x91c9,0x91cb, 0x91d0,0x91d6,0x91df,0x91e1,0x91db,0x91fc,0x91f5,0x91f6, 0x921e,0x91ff,0x9214,0x922c,0x9215,0x9211,0x925e,0x9257, 0x9245,0x9249,0x9264,0x9248,0x9295,0x923f,0x924b,0x9250, 0x929c,0x9296,0x9293,0x929b,0x925a,0x92cf,0x92b9,0x92b7, 0x92e9,0x930f,0x92fa,0x9344,0x932e,0x30fb,0x30fb,0x30fb};
618+ static const unsigned short s2u_e8[]= { 0x9319,0x9322,0x931a,0x9323,0x933a,0x9335,0x933b,0x935c, 0x9360,0x937c,0x936e,0x9356,0x93b0,0x93ac,0x93ad,0x9394, 0x93b9,0x93d6,0x93d7,0x93e8,0x93e5,0x93d8,0x93c3,0x93dd, 0x93d0,0x93c8,0x93e4,0x941a,0x9414,0x9413,0x9403,0x9407, 0x9410,0x9436,0x942b,0x9435,0x9421,0x943a,0x9441,0x9452, 0x9444,0x945b,0x9460,0x9462,0x945e,0x946a,0x9229,0x9470, 0x9475,0x9477,0x947d,0x945a,0x947c,0x947e,0x9481,0x947f, 0x9582,0x9587,0x958a,0x9594,0x9596,0x9598,0x9599,0x30fb, 0x95a0,0x95a8,0x95a7,0x95ad,0x95bc,0x95bb,0x95b9,0x95be, 0x95ca,0x6ff6,0x95c3,0x95cd,0x95cc,0x95d5,0x95d4,0x95d6, 0x95dc,0x95e1,0x95e5,0x95e2,0x9621,0x9628,0x962e,0x962f, 0x9642,0x964c,0x964f,0x964b,0x9677,0x965c,0x965e,0x965d, 0x965f,0x9666,0x9672,0x966c,0x968d,0x9698,0x9695,0x9697, 0x96aa,0x96a7,0x96b1,0x96b2,0x96b0,0x96b4,0x96b6,0x96b8, 0x96b9,0x96ce,0x96cb,0x96c9,0x96cd,0x894d,0x96dc,0x970d, 0x96d5,0x96f9,0x9704,0x9706,0x9708,0x9713,0x970e,0x9711, 0x970f,0x9716,0x9719,0x9724,0x972a,0x9730,0x9739,0x973d, 0x973e,0x9744,0x9746,0x9748,0x9742,0x9749,0x975c,0x9760, 0x9764,0x9766,0x9768,0x52d2,0x976b,0x9771,0x9779,0x9785, 0x977c,0x9781,0x977a,0x9786,0x978b,0x978f,0x9790,0x979c, 0x97a8,0x97a6,0x97a3,0x97b3,0x97b4,0x97c3,0x97c6,0x97c8, 0x97cb,0x97dc,0x97ed,0x9f4f,0x97f2,0x7adf,0x97f6,0x97f5, 0x980f,0x980c,0x9838,0x9824,0x9821,0x9837,0x983d,0x9846, 0x984f,0x984b,0x986b,0x986f,0x9870,0x30fb,0x30fb,0x30fb};
619+ static const unsigned short s2u_e9[]= { 0x9871,0x9874,0x9873,0x98aa,0x98af,0x98b1,0x98b6,0x98c4, 0x98c3,0x98c6,0x98e9,0x98eb,0x9903,0x9909,0x9912,0x9914, 0x9918,0x9921,0x991d,0x991e,0x9924,0x9920,0x992c,0x992e, 0x993d,0x993e,0x9942,0x9949,0x9945,0x9950,0x994b,0x9951, 0x9952,0x994c,0x9955,0x9997,0x9998,0x99a5,0x99ad,0x99ae, 0x99bc,0x99df,0x99db,0x99dd,0x99d8,0x99d1,0x99ed,0x99ee, 0x99f1,0x99f2,0x99fb,0x99f8,0x9a01,0x9a0f,0x9a05,0x99e2, 0x9a19,0x9a2b,0x9a37,0x9a45,0x9a42,0x9a40,0x9a43,0x30fb, 0x9a3e,0x9a55,0x9a4d,0x9a5b,0x9a57,0x9a5f,0x9a62,0x9a65, 0x9a64,0x9a69,0x9a6b,0x9a6a,0x9aad,0x9ab0,0x9abc,0x9ac0, 0x9acf,0x9ad1,0x9ad3,0x9ad4,0x9ade,0x9adf,0x9ae2,0x9ae3, 0x9ae6,0x9aef,0x9aeb,0x9aee,0x9af4,0x9af1,0x9af7,0x9afb, 0x9b06,0x9b18,0x9b1a,0x9b1f,0x9b22,0x9b23,0x9b25,0x9b27, 0x9b28,0x9b29,0x9b2a,0x9b2e,0x9b2f,0x9b32,0x9b44,0x9b43, 0x9b4f,0x9b4d,0x9b4e,0x9b51,0x9b58,0x9b74,0x9b93,0x9b83, 0x9b91,0x9b96,0x9b97,0x9b9f,0x9ba0,0x9ba8,0x9bb4,0x9bc0, 0x9bca,0x9bb9,0x9bc6,0x9bcf,0x9bd1,0x9bd2,0x9be3,0x9be2, 0x9be4,0x9bd4,0x9be1,0x9c3a,0x9bf2,0x9bf1,0x9bf0,0x9c15, 0x9c14,0x9c09,0x9c13,0x9c0c,0x9c06,0x9c08,0x9c12,0x9c0a, 0x9c04,0x9c2e,0x9c1b,0x9c25,0x9c24,0x9c21,0x9c30,0x9c47, 0x9c32,0x9c46,0x9c3e,0x9c5a,0x9c60,0x9c67,0x9c76,0x9c78, 0x9ce7,0x9cec,0x9cf0,0x9d09,0x9d08,0x9ceb,0x9d03,0x9d06, 0x9d2a,0x9d26,0x9daf,0x9d23,0x9d1f,0x9d44,0x9d15,0x9d12, 0x9d41,0x9d3f,0x9d3e,0x9d46,0x9d48,0x30fb,0x30fb,0x30fb};
620+ static const unsigned short s2u_ea[]= { 0x9d5d,0x9d5e,0x9d64,0x9d51,0x9d50,0x9d59,0x9d72,0x9d89, 0x9d87,0x9dab,0x9d6f,0x9d7a,0x9d9a,0x9da4,0x9da9,0x9db2, 0x9dc4,0x9dc1,0x9dbb,0x9db8,0x9dba,0x9dc6,0x9dcf,0x9dc2, 0x9dd9,0x9dd3,0x9df8,0x9de6,0x9ded,0x9def,0x9dfd,0x9e1a, 0x9e1b,0x9e1e,0x9e75,0x9e79,0x9e7d,0x9e81,0x9e88,0x9e8b, 0x9e8c,0x9e92,0x9e95,0x9e91,0x9e9d,0x9ea5,0x9ea9,0x9eb8, 0x9eaa,0x9ead,0x9761,0x9ecc,0x9ece,0x9ecf,0x9ed0,0x9ed4, 0x9edc,0x9ede,0x9edd,0x9ee0,0x9ee5,0x9ee8,0x9eef,0x30fb, 0x9ef4,0x9ef6,0x9ef7,0x9ef9,0x9efb,0x9efc,0x9efd,0x9f07, 0x9f08,0x76b7,0x9f15,0x9f21,0x9f2c,0x9f3e,0x9f4a,0x9f52, 0x9f54,0x9f63,0x9f5f,0x9f60,0x9f61,0x9f66,0x9f67,0x9f6c, 0x9f6a,0x9f77,0x9f72,0x9f76,0x9f95,0x9f9c,0x9fa0,0x582f, 0x69c7,0x9059,0x7464,0x51dc,0x7199,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb};
621+ #define s2u_eb s2u_80
622+ #define s2u_ec s2u_80
623+ static const unsigned short s2u_ed[]= { 0x7e8a,0x891c,0x9348,0x9288,0x84dc,0x4fc9,0x70bb,0x6631, 0x68c8,0x92f9,0x66fb,0x5f45,0x4e28,0x4ee1,0x4efc,0x4f00, 0x4f03,0x4f39,0x4f56,0x4f92,0x4f8a,0x4f9a,0x4f94,0x4fcd, 0x5040,0x5022,0x4fff,0x501e,0x5046,0x5070,0x5042,0x5094, 0x50f4,0x50d8,0x514a,0x5164,0x519d,0x51be,0x51ec,0x5215, 0x529c,0x52a6,0x52c0,0x52db,0x5300,0x5307,0x5324,0x5372, 0x5393,0x53b2,0x53dd,0xfa0e,0x549c,0x548a,0x54a9,0x54ff, 0x5586,0x5759,0x5765,0x57ac,0x57c8,0x57c7,0xfa0f,0x30fb, 0xfa10,0x589e,0x58b2,0x590b,0x5953,0x595b,0x595d,0x5963, 0x59a4,0x59ba,0x5b56,0x5bc0,0x752f,0x5bd8,0x5bec,0x5c1e, 0x5ca6,0x5cba,0x5cf5,0x5d27,0x5d53,0xfa11,0x5d42,0x5d6d, 0x5db8,0x5db9,0x5dd0,0x5f21,0x5f34,0x5f67,0x5fb7,0x5fde, 0x605d,0x6085,0x608a,0x60de,0x60d5,0x6120,0x60f2,0x6111, 0x6137,0x6130,0x6198,0x6213,0x62a6,0x63f5,0x6460,0x649d, 0x64ce,0x654e,0x6600,0x6615,0x663b,0x6609,0x662e,0x661e, 0x6624,0x6665,0x6657,0x6659,0xfa12,0x6673,0x6699,0x66a0, 0x66b2,0x66bf,0x66fa,0x670e,0xf929,0x6766,0x67bb,0x6852, 0x67c0,0x6801,0x6844,0x68cf,0xfa13,0x6968,0xfa14,0x6998, 0x69e2,0x6a30,0x6a6b,0x6a46,0x6a73,0x6a7e,0x6ae2,0x6ae4, 0x6bd6,0x6c3f,0x6c5c,0x6c86,0x6c6f,0x6cda,0x6d04,0x6d87, 0x6d6f,0x6d96,0x6dac,0x6dcf,0x6df8,0x6df2,0x6dfc,0x6e39, 0x6e5c,0x6e27,0x6e3c,0x6ebf,0x6f88,0x6fb5,0x6ff5,0x7005, 0x7007,0x7028,0x7085,0x70ab,0x710f,0x7104,0x715c,0x7146, 0x7147,0xfa15,0x71c1,0x71fe,0x72b1,0x30fb,0x30fb,0x30fb};
624+ static const unsigned short s2u_ee[]= { 0x72be,0x7324,0xfa16,0x7377,0x73bd,0x73c9,0x73d6,0x73e3, 0x73d2,0x7407,0x73f5,0x7426,0x742a,0x7429,0x742e,0x7462, 0x7489,0x749f,0x7501,0x756f,0x7682,0x769c,0x769e,0x769b, 0x76a6,0xfa17,0x7746,0x52af,0x7821,0x784e,0x7864,0x787a, 0x7930,0xfa18,0xfa19,0xfa1a,0x7994,0xfa1b,0x799b,0x7ad1, 0x7ae7,0xfa1c,0x7aeb,0x7b9e,0xfa1d,0x7d48,0x7d5c,0x7db7, 0x7da0,0x7dd6,0x7e52,0x7f47,0x7fa1,0xfa1e,0x8301,0x8362, 0x837f,0x83c7,0x83f6,0x8448,0x84b4,0x8553,0x8559,0x30fb, 0x856b,0xfa1f,0x85b0,0xfa20,0xfa21,0x8807,0x88f5,0x8a12, 0x8a37,0x8a79,0x8aa7,0x8abe,0x8adf,0xfa22,0x8af6,0x8b53, 0x8b7f,0x8cf0,0x8cf4,0x8d12,0x8d76,0xfa23,0x8ecf,0xfa24, 0xfa25,0x9067,0x90de,0xfa26,0x9115,0x9127,0x91da,0x91d7, 0x91de,0x91ed,0x91ee,0x91e4,0x91e5,0x9206,0x9210,0x920a, 0x923a,0x9240,0x923c,0x924e,0x9259,0x9251,0x9239,0x9267, 0x92a7,0x9277,0x9278,0x92e7,0x92d7,0x92d9,0x92d0,0xfa27, 0x92d5,0x92e0,0x92d3,0x9325,0x9321,0x92fb,0xfa28,0x931e, 0x92ff,0x931d,0x9302,0x9370,0x9357,0x93a4,0x93c6,0x93de, 0x93f8,0x9431,0x9445,0x9448,0x9592,0xf9dc,0xfa29,0x969d, 0x96af,0x9733,0x973b,0x9743,0x974d,0x974f,0x9751,0x9755, 0x9857,0x9865,0xfa2a,0xfa2b,0x9927,0xfa2c,0x999e,0x9a4e, 0x9ad9,0x9adc,0x9b75,0x9b72,0x9b8f,0x9bb1,0x9bbb,0x9c00, 0x9d70,0x9d6b,0xfa2d,0x9e19,0x9ed1,0x30fb,0x30fb,0x2170, 0x2171,0x2172,0x2173,0x2174,0x2175,0x2176,0x2177,0x2178, 0x2179,0xffe2,0xffe4,0xff07,0xff02,0x30fb,0x30fb,0x30fb};
625+ #define s2u_ef s2u_80
626+ #define s2u_f0 s2u_80
627+ #define s2u_f1 s2u_80
628+ #define s2u_f2 s2u_80
629+ #define s2u_f3 s2u_80
630+ #define s2u_f3 s2u_80
631+ #define s2u_f4 s2u_80
632+ #define s2u_f5 s2u_80
633+ #define s2u_f6 s2u_80
634+ #define s2u_f7 s2u_80
635+ #define s2u_f8 s2u_80
636+ #define s2u_f9 s2u_80
637+ static const unsigned short s2u_fa[]= { 0x2170,0x2171,0x2172,0x2173,0x2174,0x2175,0x2176,0x2177, 0x2178,0x2179,0x2160,0x2161,0x2162,0x2163,0x2164,0x2165, 0x2166,0x2167,0x2168,0x2169,0xffe2,0xffe4,0xff07,0xff02, 0x3231,0x2116,0x2121,0x2235,0x7e8a,0x891c,0x9348,0x9288, 0x84dc,0x4fc9,0x70bb,0x6631,0x68c8,0x92f9,0x66fb,0x5f45, 0x4e28,0x4ee1,0x4efc,0x4f00,0x4f03,0x4f39,0x4f56,0x4f92, 0x4f8a,0x4f9a,0x4f94,0x4fcd,0x5040,0x5022,0x4fff,0x501e, 0x5046,0x5070,0x5042,0x5094,0x50f4,0x50d8,0x514a,0x30fb, 0x5164,0x519d,0x51be,0x51ec,0x5215,0x529c,0x52a6,0x52c0, 0x52db,0x5300,0x5307,0x5324,0x5372,0x5393,0x53b2,0x53dd, 0xfa0e,0x549c,0x548a,0x54a9,0x54ff,0x5586,0x5759,0x5765, 0x57ac,0x57c8,0x57c7,0xfa0f,0xfa10,0x589e,0x58b2,0x590b, 0x5953,0x595b,0x595d,0x5963,0x59a4,0x59ba,0x5b56,0x5bc0, 0x752f,0x5bd8,0x5bec,0x5c1e,0x5ca6,0x5cba,0x5cf5,0x5d27, 0x5d53,0xfa11,0x5d42,0x5d6d,0x5db8,0x5db9,0x5dd0,0x5f21, 0x5f34,0x5f67,0x5fb7,0x5fde,0x605d,0x6085,0x608a,0x60de, 0x60d5,0x6120,0x60f2,0x6111,0x6137,0x6130,0x6198,0x6213, 0x62a6,0x63f5,0x6460,0x649d,0x64ce,0x654e,0x6600,0x6615, 0x663b,0x6609,0x662e,0x661e,0x6624,0x6665,0x6657,0x6659, 0xfa12,0x6673,0x6699,0x66a0,0x66b2,0x66bf,0x66fa,0x670e, 0xf929,0x6766,0x67bb,0x6852,0x67c0,0x6801,0x6844,0x68cf, 0xfa13,0x6968,0xfa14,0x6998,0x69e2,0x6a30,0x6a6b,0x6a46, 0x6a73,0x6a7e,0x6ae2,0x6ae4,0x6bd6,0x6c3f,0x6c5c,0x6c86, 0x6c6f,0x6cda,0x6d04,0x6d87,0x6d6f,0x30fb,0x30fb,0x30fb};
638+ static const unsigned short s2u_fb[]= { 0x6d96,0x6dac,0x6dcf,0x6df8,0x6df2,0x6dfc,0x6e39,0x6e5c, 0x6e27,0x6e3c,0x6ebf,0x6f88,0x6fb5,0x6ff5,0x7005,0x7007, 0x7028,0x7085,0x70ab,0x710f,0x7104,0x715c,0x7146,0x7147, 0xfa15,0x71c1,0x71fe,0x72b1,0x72be,0x7324,0xfa16,0x7377, 0x73bd,0x73c9,0x73d6,0x73e3,0x73d2,0x7407,0x73f5,0x7426, 0x742a,0x7429,0x742e,0x7462,0x7489,0x749f,0x7501,0x756f, 0x7682,0x769c,0x769e,0x769b,0x76a6,0xfa17,0x7746,0x52af, 0x7821,0x784e,0x7864,0x787a,0x7930,0xfa18,0xfa19,0x30fb, 0xfa1a,0x7994,0xfa1b,0x799b,0x7ad1,0x7ae7,0xfa1c,0x7aeb, 0x7b9e,0xfa1d,0x7d48,0x7d5c,0x7db7,0x7da0,0x7dd6,0x7e52, 0x7f47,0x7fa1,0xfa1e,0x8301,0x8362,0x837f,0x83c7,0x83f6, 0x8448,0x84b4,0x8553,0x8559,0x856b,0xfa1f,0x85b0,0xfa20, 0xfa21,0x8807,0x88f5,0x8a12,0x8a37,0x8a79,0x8aa7,0x8abe, 0x8adf,0xfa22,0x8af6,0x8b53,0x8b7f,0x8cf0,0x8cf4,0x8d12, 0x8d76,0xfa23,0x8ecf,0xfa24,0xfa25,0x9067,0x90de,0xfa26, 0x9115,0x9127,0x91da,0x91d7,0x91de,0x91ed,0x91ee,0x91e4, 0x91e5,0x9206,0x9210,0x920a,0x923a,0x9240,0x923c,0x924e, 0x9259,0x9251,0x9239,0x9267,0x92a7,0x9277,0x9278,0x92e7, 0x92d7,0x92d9,0x92d0,0xfa27,0x92d5,0x92e0,0x92d3,0x9325, 0x9321,0x92fb,0xfa28,0x931e,0x92ff,0x931d,0x9302,0x9370, 0x9357,0x93a4,0x93c6,0x93de,0x93f8,0x9431,0x9445,0x9448, 0x9592,0xf9dc,0xfa29,0x969d,0x96af,0x9733,0x973b,0x9743, 0x974d,0x974f,0x9751,0x9755,0x9857,0x9865,0xfa2a,0xfa2b, 0x9927,0xfa2c,0x999e,0x9a4e,0x9ad9,0x30fb,0x30fb,0x30fb};
639+ static const unsigned short s2u_fc[]= { 0x9adc,0x9b75,0x9b72,0x9b8f,0x9bb1,0x9bbb,0x9c00,0x9d70, 0x9d6b,0xfa2d,0x9e19,0x9ed1,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb, 0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb,0x30fb};
640+ #define s2u_fd s2u_80
641+ #define s2u_fe s2u_80
642+ #define s2u_ff s2u_80
643+
644+ static const unsigned short __attribute__((aligned(16))) *s2u[] = {
645+ s2u_80,s2u_81,s2u_82,s2u_83,s2u_84,s2u_85,s2u_86,s2u_87,
646+ s2u_88,s2u_89,s2u_8a,s2u_8b,s2u_8c,s2u_8d,s2u_8e,s2u_8f,
647+ s2u_90,s2u_91,s2u_92,s2u_93,s2u_94,s2u_95,s2u_96,s2u_97,
648+ s2u_98,s2u_99,s2u_9a,s2u_9b,s2u_9c,s2u_9d,s2u_9e,s2u_9f,
649+ s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,
650+ s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,
651+ s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,
652+ s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,
653+ s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,
654+ s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,
655+ s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,
656+ s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,s2u_80,
657+ s2u_e0,s2u_e1,s2u_e2,s2u_e3,s2u_e4,s2u_e5,s2u_e6,s2u_e7,
658+ s2u_e8,s2u_e9,s2u_ea,s2u_eb,s2u_ec,s2u_ed,s2u_ee,s2u_ef,
659+ s2u_f0,s2u_f1,s2u_f2,s2u_f3,s2u_f4,s2u_f5,s2u_f6,s2u_f7,
660+ s2u_f8,s2u_f9,s2u_fa,s2u_fb,s2u_fc,s2u_fd,s2u_fe,s2u_ff};
661+
662+ if (**text >= 0xa0 && **text <= 0xdf) {
663+ ucs2 = 0xff60 + (**text) - 0xa0;
664+ (*text)++;
665+ } else if (**text&0x80) {
666+ ucs2 = s2u[**text - 0x80][*(*text+1) - 0x40];
667+ (*text) += 2;
668+ } else{
669+ ucs2 = **text;
670+ (*text)++;
671+ }
672+#endif
673+
674+ return ucs2;
675+}
676+
677+float intraFontPrintf(intraFont *font, float x, float y, const char *text, ...) {
678+ if(!font) return x;
679+
680+ char buffer[256];
681+ va_list ap;
682+
683+ va_start(ap, text);
684+ vsnprintf(buffer, 256, text, ap);
685+ va_end(ap);
686+ buffer[255] = 0;
687+
688+ return intraFontPrint(font, x, y, buffer);
689+}
690+
691+float intraFontPrint(intraFont *font, float x, float y, const char *text) {
692+ if (!text || strlen(text) == 0 || !font) return x;
693+
694+ int i = 0, length = 0;
695+ if (font->options & INTRAFONT_STRING_SJIS) {
696+ while (text[i]) {
697+ length++;
698+ i += ( text[i] <= 0x7FU || (text[i] >= 0xA0U && text[i] <= 0xDFU) || text[i] >= 0xFDU) ? 1 : 2; //single or double byte
699+ }
700+ } else {
701+ length = strlen(text);
702+ }
703+
704+ unsigned short* ucs2_text = (unsigned short*)malloc((length+1)*sizeof(unsigned short));
705+ if (!ucs2_text) return x;
706+
707+ unsigned char* utext = (unsigned char*)text;
708+ for (i = 0; i < length; i++) {
709+ if (font->options & INTRAFONT_STRING_SJIS) {
710+ ucs2_text[i] = intraFontSJIS2UCS2((unsigned char**)&utext);
711+ } else {
712+ ucs2_text[i] = utext[i];
713+ }
714+ }
715+ ucs2_text[i] = 0;
716+
717+ x = intraFontPrintUCS2(font, x, y, ucs2_text);
718+
719+ free(ucs2_text);
720+
721+ return x;
722+}
723+
724+float intraFontPrintUCS2(intraFont *font, float x, float y, const unsigned short *text) {
725+ if(!font) return x;
726+
727+ float glyphscale = font->size;
728+ float width = 0.0f, height = font->advancey * glyphscale / 4.0;
729+ float left = x, top = y - height;
730+ if (font->options & INTRAFONT_ALIGN_RIGHT) left -= intraFontMeasureTextUCS2(font, text);
731+ if (font->options & INTRAFONT_ALIGN_CENTER) left -= intraFontMeasureTextUCS2(font, text)/2.0;
732+
733+ typedef struct {
734+ float u, v;
735+ unsigned int c;
736+ float x, y, z;
737+ } fontVertex;
738+ fontVertex *v, *v0, *v1, *s0, *s1;
739+
740+ //count number of characters
741+ int length = 0;
742+ while (text[length] > 0) length++;
743+ if (length == 0) return x;
744+
745+ //count number of glyphs to draw and cache BMPs
746+ int i, j, n_glyphs, last_n_glyphs, n_sglyphs, changed, count = 0;
747+ unsigned short char_id, subucs2, glyph_id;
748+ do {
749+ changed = 0;
750+ n_glyphs = 0;
751+ n_sglyphs = 0;
752+ last_n_glyphs = 0;
753+ for(i = 0; i < length; i++) {
754+
755+ char_id = intraFontGetID(font,text[i]); //char
756+ if (char_id < font->n_chars) {
757+ if ((font->glyph[char_id].flags & PGF_BMP_OVERLAY) == PGF_BMP_OVERLAY) { //overlay glyph?
758+ for (j = 0; j < 3; j++) {
759+ subucs2 = font->fontdata[(font->glyph[char_id].ptr)+j*2] + font->fontdata[(font->glyph[char_id].ptr)+j*2+1] * 256;
760+ if (subucs2) {
761+ glyph_id = intraFontGetID(font, subucs2);
762+ if (glyph_id < font->n_chars) {
763+ n_glyphs++;
764+ if (!(font->glyph[glyph_id].flags & PGF_CACHED)) {
765+ if (intraFontGetBMP(font,glyph_id,PGF_CHARGLYPH)) changed = 1;
766+ }
767+ }
768+ }
769+ }
770+ } else {
771+ n_glyphs++;
772+ if (!(font->glyph[char_id].flags & PGF_CACHED)) {
773+ if (intraFontGetBMP(font,char_id,PGF_CHARGLYPH)) changed = 1;
774+ }
775+ }
776+
777+ if (n_glyphs > last_n_glyphs) {
778+ n_sglyphs++; //shadow
779+ if (!(font->shadowGlyph[font->glyph[char_id].shadowID].flags & PGF_CACHED)) {
780+ if (intraFontGetBMP(font,font->glyph[char_id].shadowID,PGF_SHADOWGLYPH)) changed = 1;
781+ }
782+ last_n_glyphs = n_glyphs;
783+ }
784+
785+ }
786+
787+ }
788+ count++;
789+ } while (changed && count <= length);
790+ if (changed) return x; //not all chars fit into texture -> abort (better solution: split up string and call intraFontPrintUCS2 twice)
791+
792+ //reserve memory in displaylist
793+ v = sceGuGetMemory(((n_glyphs+n_sglyphs)<<1) * sizeof(fontVertex));
794+
795+ int s_index = 0, c_index = n_sglyphs, last_c_index = n_sglyphs; // index for shadow and character/overlay glyphs
796+ for(i = 0; i < length; i++) {
797+ unsigned short char_id = intraFontGetID(font,text[i]);
798+ if (char_id < font->n_chars) {
799+
800+ //center glyphs for monospace
801+ if (font->options & INTRAFONT_WIDTH_FIX) {
802+ width += ( ((float)(font->options & PGF_WIDTH_MASK))/2.0f - ((float)font->glyph[char_id].advance)/8.0f ) * glyphscale ;
803+ }
804+
805+ //add vertices for subglyhs
806+ for (j = 0; j < 3; j++) {
807+ if ((font->glyph[char_id].flags & PGF_BMP_OVERLAY) == PGF_BMP_OVERLAY) {
808+ subucs2 = font->fontdata[(font->glyph[char_id].ptr)+j*2] + font->fontdata[(font->glyph[char_id].ptr)+j*2+1] * 256;
809+ glyph_id = intraFontGetID(font, subucs2);
810+ } else {
811+ glyph_id = char_id;
812+ j = 2;
813+ }
814+
815+ if (glyph_id < font->n_chars) {
816+ Glyph *glyph = &(font->glyph[glyph_id]);
817+
818+ v0 = &v[(c_index<<1) + 0];
819+ v1 = &v[(c_index<<1) + 1];
820+
821+ v0->u = glyph->x-0.25f;
822+ v0->v = glyph->y-0.25f;
823+ v0->c = font->color;
824+ v0->x = left + width + glyph->left*glyphscale;
825+ v0->y = top + height - glyph->top *glyphscale;
826+ v0->z = 0.0f;
827+
828+ v1->u = (glyph->x + glyph->width)+0.25f;
829+ v1->v = (glyph->y + glyph->height)+0.25f;
830+ v1->c = font->color;
831+ v1->x = left + width + (glyph->width+glyph->left)*glyphscale;
832+ v1->y = top + height + (glyph->height-glyph->top)*glyphscale;
833+ v1->z = 0.0f;
834+
835+ c_index++;
836+ }
837+ }
838+
839+ //add vertices for shadow
840+ if (c_index > last_c_index) {
841+ Glyph *shadowGlyph = &(font->shadowGlyph[font->glyph[char_id].shadowID]);
842+
843+ s0 = &v[(s_index<<1) + 0];
844+ s1 = &v[(s_index<<1) + 1];
845+
846+ s0->u = shadowGlyph->x-0.25f;
847+ s0->v = shadowGlyph->y-0.25f;
848+ s0->c = font->shadowColor;
849+ s0->x = left + width + shadowGlyph->left*glyphscale*64.0f/((float)font->shadowscale);
850+ s0->y = top + height - shadowGlyph->top *glyphscale*64.0f/((float)font->shadowscale);
851+ s0->z = 0.0f;
852+
853+ s1->u = (shadowGlyph->x + shadowGlyph->width)+0.25f;
854+ s1->v = (shadowGlyph->y + shadowGlyph->height)+0.25f;
855+ s1->c = font->shadowColor;
856+ s1->x = left + width + (shadowGlyph->width+shadowGlyph->left)*glyphscale*64.0f/((float)font->shadowscale);
857+ s1->y = top + height + (shadowGlyph->height-shadowGlyph->top)*glyphscale*64.0f/((float)font->shadowscale);
858+ s1->z = 0.0f;
859+
860+ s_index++;
861+ last_c_index = c_index;
862+ }
863+
864+ // advance
865+ if (font->options & INTRAFONT_WIDTH_FIX) {
866+ width += ( ((float)(font->options & PGF_WIDTH_MASK))/2.0f + ((float)font->glyph[char_id].advance)/8.0f ) * glyphscale;
867+ } else {
868+ width += font->glyph[char_id].advance * glyphscale * 0.25;
869+ }
870+
871+ }
872+
873+ if (text[i] == '\n') {
874+ left = x;
875+ if (font->options & INTRAFONT_ALIGN_RIGHT) left -= intraFontMeasureTextUCS2(font, text+i+1);
876+ if (font->options & INTRAFONT_ALIGN_CENTER) left -= intraFontMeasureTextUCS2(font, text+i+1)/2.0;
877+ width = 0.0f;
878+ height += font->advancey * glyphscale / 4.0;
879+ }
880+ }
881+
882+ //finalize and activate texture (if not already active or has been changed)
883+ sceKernelDcacheWritebackAll();
884+ if (!(font->options & INTRAFONT_ACTIVE)) intraFontActivate(font);
885+
886+ sceGuDisable(GU_DEPTH_TEST);
887+ sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF|GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_2D, (n_glyphs+n_sglyphs)<<1, 0, v);
888+ sceGuEnable(GU_DEPTH_TEST);
889+
890+ return left+width;
891+}
892+
893+float intraFontMeasureText(intraFont *font, const char *text) {
894+ if (!font) return 0.0f;
895+
896+ int i, length = 0;
897+ float x = 0.0f;
898+
899+ while ((text[length] > 0) && (text[length] != '\n')) length++; //strlen until end of string or newline
900+
901+ for(i = 0; i < length; i++) {
902+ unsigned short char_id = intraFontGetID(font,text[i]);
903+ if (char_id < font->n_chars)
904+ x += (font->options & INTRAFONT_WIDTH_FIX) ? (font->options & PGF_WIDTH_MASK)*font->size : (font->glyph[char_id].advance)*font->size*0.25f;
905+ }
906+
907+ return x;
908+}
909+
910+float intraFontMeasureTextUCS2(intraFont *font, const unsigned short *text) {
911+ if(!font) return 0.0f;
912+
913+ int i, length = 0;
914+ float x = 0.0f;
915+
916+ while ((text[length] > 0) && (text[length] != '\n')) length++; //strlen until end of string or newline
917+
918+ for(i = 0; i < length; i++) {
919+ unsigned short char_id = intraFontGetID(font,text[i]);
920+ if (char_id < font->n_chars)
921+ x += (font->options & INTRAFONT_WIDTH_FIX) ? (font->options & PGF_WIDTH_MASK)*font->size : (font->glyph[char_id].advance)*font->size*0.25f;
922+ }
923+
924+ return x;
925+}
926+
Added: svn:executable
--- trunc/src/psp2ch.h (nonexistent)
+++ trunc/src/psp2ch.h (revision 2)
@@ -0,0 +1,123 @@
1+#ifndef __PSP2CH_H__
2+#define __PSP2CH_H__
3+
4+#include <pspnet.h>
5+#include <pspnet_apctl.h>
6+#include <pspnet_inet.h>
7+#include <pspnet_resolver.h>
8+#include <sys/socket.h>
9+
10+//#define DEBUG
11+#define RES_BAR_WIDTH (8)
12+#define RES_SCR_WIDTH (SCR_WIDTH - RES_BAR_WIDTH)
13+#define RES_BAR_WIDTH_V (6)
14+#define RES_SCR_WIDTH_V (SCR_HEIGHT - RES_BAR_WIDTH_V)
15+#define THREAD_ID 26
16+#define THREAD_RES 430
17+#define RES_A_X 45
18+#define RES_A_Y 30
19+#define RES_A_WIDTH 390
20+#define RES_A_HEIGHT 195
21+#define RES_A_LINE 15
22+#define RES_A_X_V 30
23+#define RES_A_Y_V 45
24+#define RES_A_WIDTH_V 195
25+#define RES_A_HEIGHT_V 390
26+#define RES_A_LINE_V 30
27+
28+#define PAD_CUTOFF 30
29+
30+typedef struct {
31+ int Content_Length;
32+ char Content_Type[32];
33+ char Last_Modified[32];
34+ char ETag[32];
35+} HTTP_HEADERS;
36+
37+typedef struct {
38+ int count;
39+ int start;
40+ int select;
41+} S_2CH_SCREEN;
42+
43+typedef struct {
44+ int num;
45+ int name1;
46+ int name2;
47+ int mail;
48+ int date;
49+ int id1;
50+ int id2;
51+ int id3;
52+} S_2CH_HEADER_COLOR;
53+
54+typedef struct {
55+ int text;
56+ int bg;
57+ int link;
58+ int alink;
59+} S_2CH_RES_COLOR;
60+
61+typedef struct {
62+ int slider;
63+ int bg;
64+} S_2CH_BAR_COLOR;
65+
66+typedef struct {
67+ int text;
68+ int bg;
69+ int bat1;
70+ int bat2;
71+ int bat3;
72+} S_2CH_MENU_COLOR;
73+
74+typedef struct {
75+ int num;
76+ int category;
77+ int text1;
78+ int text2;
79+ int bg;
80+ int count1;
81+ int count2;
82+ int s_num;
83+ int s_category;
84+ int s_text1;
85+ int s_text2;
86+ int s_bg;
87+ int s_count1;
88+ int s_count2;
89+} S_2CH_THREAD_COLOR;
90+
91+struct sList {
92+ int text;
93+ int bg;
94+ int s_text;
95+ int s_bg;
96+};
97+
98+typedef struct {
99+ struct sList cate;
100+ struct sList ita;
101+ int base;
102+} S_2CH_ITA_COLOR;
103+
104+typedef struct {
105+ int title;
106+ int title_bg;
107+} S_2CH_FORM_COLOR;
108+
109+int psp2ch(void);
110+void psp2chStart(void);
111+int psp2chOwata(void);
112+int psp2chCursorSet(S_2CH_SCREEN* line);
113+int psp2chInit(void);
114+int psp2chTerm(void);
115+int psp2chCloseSocket(int mySocket);
116+int psp2chRequest(const char* host, const char* path, const char* header);
117+int psp2chPost(char* host, char* dir, int dat, char* cook, char* body);
118+int psp2chGetStatusLine(int mySocket);
119+int psp2chGetHttpHeaders(int mySocket, HTTP_HEADERS* header);
120+int psp2chApConnect(void);
121+void psp2chGets(char* title, char* text, int num, int lines);
122+
123+#endif
Added: svn:executable
--- trunc/src/pspdialogs.c (nonexistent)
+++ trunc/src/pspdialogs.c (revision 2)
@@ -0,0 +1,179 @@
1+#include "pspdialogs.h"
2+#include "pg.h"
3+
4+/* pspdlg list */
5+extern unsigned int list[];
6+
7+void pspShowErrorDialog(const int error, u8 language)
8+{
9+ int done = 0;
10+ pspUtilityMsgDialogParams dialog;
11+ SceSize dialog_size = sizeof(dialog);
12+
13+ memset(&dialog, 0, dialog_size);
14+ dialog.base.size = dialog_size;
15+ if(language == DIALOG_LANGUAGE_AUTO)
16+ sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_LANGUAGE,&dialog.base.language);
17+ else
18+ dialog.base.language = language;
19+ sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_UNKNOWN, &dialog.base.buttonSwap);
20+ dialog.base.graphicsThread = 0x11;
21+ dialog.base.accessThread = 0x13;
22+ dialog.base.fontThread = 0x12;
23+ dialog.base.soundThread = 0x10;
24+ //dialog.unknown2[1] = 0;
25+ //dialog.unknown2[2] = error;
26+ dialog.mode = PSP_UTILITY_MSGDIALOG_MODE_ERROR;
27+ dialog.errorValue = error;
28+
29+ sceUtilityMsgDialogInitStart(&dialog);
30+
31+ while(!done)
32+ {
33+ minimalRender();
34+
35+ switch(sceUtilityMsgDialogGetStatus())
36+ {
37+ case PSP_UTILITY_DIALOG_NONE:
38+ break;
39+ case PSP_UTILITY_DIALOG_INIT :
40+ break;
41+ case PSP_UTILITY_DIALOG_VISIBLE:
42+ sceUtilityMsgDialogUpdate(2);
43+ break;
44+ case PSP_UTILITY_DIALOG_QUIT:
45+ sceUtilityMsgDialogShutdownStart();
46+ break;
47+ case PSP_UTILITY_DIALOG_FINISHED :
48+ done = 1;
49+ break;
50+ }
51+ sceDisplayWaitVblankStart();
52+ framebuffer = sceGuSwapBuffers();
53+ }
54+}
55+
56+void pspShowMessageDialog(MESSAGE_HELPER *mh, u8 language)
57+{
58+ int done=0;
59+ pspUtilityMsgDialogParams dialog;
60+ SceSize dialog_size = sizeof(dialog);
61+
62+ memset(&dialog, 0, dialog_size);
63+ dialog.base.size = dialog_size;
64+ if(language == DIALOG_LANGUAGE_AUTO)
65+ sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_LANGUAGE,&dialog.base.language);
66+ else
67+ dialog.base.language = language;
68+ sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_UNKNOWN, &dialog.base.buttonSwap);
69+ dialog.base.graphicsThread = 0x11;
70+ dialog.base.accessThread = 0x13;
71+ dialog.base.fontThread = 0x12;
72+ dialog.base.soundThread = 0x10;
73+ //dialog.unknown2[1] = 1;
74+ dialog.mode = PSP_UTILITY_MSGDIALOG_MODE_TEXT;
75+ strcpy(dialog.message, mh->message);
76+ dialog.options = mh->options;
77+
78+ sceUtilityMsgDialogInitStart(&dialog);
79+
80+ while(!done)
81+ {
82+ minimalRender();
83+
84+ switch(sceUtilityMsgDialogGetStatus())
85+ {
86+ case PSP_UTILITY_DIALOG_NONE:
87+ break;
88+ case PSP_UTILITY_DIALOG_INIT :
89+ break;
90+ case PSP_UTILITY_DIALOG_VISIBLE:
91+ sceUtilityMsgDialogUpdate(2);
92+ break;
93+ case PSP_UTILITY_DIALOG_QUIT:
94+ sceUtilityMsgDialogShutdownStart();
95+ break;
96+ case PSP_UTILITY_DIALOG_FINISHED :
97+ done = 1;
98+ break;
99+ }
100+ sceDisplayWaitVblankStart();
101+ framebuffer = sceGuSwapBuffers();
102+ }
103+ mh->result = dialog.base.result;
104+ mh->buttonPressed = dialog.buttonPressed;
105+}
106+
107+void pspShowOSK(OSK_HELPER *oskhelper, u8 language)
108+{
109+ int done=0;
110+ SceUtilityOskData data;
111+ SceUtilityOskParams osk;
112+
113+ memset(&data, 0, sizeof(data));
114+ data.unk_00 = 1; // 1=kanji
115+ data.unk_04 = 0;
116+ data.language = 0; // key glyphs: 0-1=hiragana, 2+=western
117+ data.unk_12 = 0;
118+ data.unk_16 = 0; //12; //0;
119+ data.lines = oskhelper->lines;
120+ data.unk_24 = 0;
121+ data.desc = oskhelper->title;
122+ data.intext = oskhelper->pretext;
123+ data.outtextlength = oskhelper->textlength;
124+ data.outtextlimit = oskhelper->textlimit;
125+ data.outtext = oskhelper->text;
126+
127+ memset(&osk, 0, sizeof(osk));
128+ osk.base.size = sizeof(osk);
129+ if(language == DIALOG_LANGUAGE_AUTO)
130+ sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_LANGUAGE,&osk.base.language);
131+ else
132+ osk.base.language = language;
133+ sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_UNKNOWN, &osk.base.buttonSwap);
134+ osk.base.graphicsThread = 0x11;
135+ osk.base.accessThread = 0x13;
136+ osk.base.fontThread = 0x12;
137+ osk.base.soundThread = 0x10;
138+ osk.unk_48 = 1;
139+ osk.data = &data;
140+
141+ sceUtilityOskInitStart(&osk);
142+
143+ while(!done)
144+ {
145+ minimalRender();
146+
147+ switch(sceUtilityOskGetStatus())
148+ {
149+ case PSP_UTILITY_DIALOG_NONE :
150+ break;
151+ case PSP_UTILITY_DIALOG_INIT :
152+ break;
153+ case PSP_UTILITY_DIALOG_VISIBLE :
154+ sceUtilityOskUpdate(2); // 2 is taken from ps2dev.org recommendation
155+ break;
156+ case PSP_UTILITY_DIALOG_QUIT :
157+ sceUtilityOskShutdownStart();
158+ break;
159+ case PSP_UTILITY_DIALOG_FINISHED :
160+ done = 1;
161+ break;
162+ }
163+
164+ pgWaitVn(2);
165+ framebuffer = sceGuSwapBuffers();
166+ }
167+}
168+
169+void minimalRender()
170+{
171+ sceGuStart(GU_DIRECT,list);
172+ sceGuClearColor(0xff000000);
173+ sceGuClearDepth(0);
174+ sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);
175+ sceGuFinish();
176+ sceGuSync(0,0);
177+}
178+
179+
Added: svn:executable
--- trunc/src/psp2chRes.c (nonexistent)
+++ trunc/src/psp2chRes.c (revision 2)
@@ -0,0 +1,2308 @@
1+
2+#include "pspdialogs.h"
3+#include <stdio.h>
4+#include <malloc.h>
5+#include <time.h>
6+#include <pspdebug.h>
7+#include <pspctrl.h>
8+#include "pg.h"
9+#include "psp2chIta.h"
10+#include "psp2chThread.h"
11+#include "psp2chRes.h"
12+#include "psp2chFavorite.h"
13+#include "psp2chImageView.h"
14+#include "psp2chForm.h"
15+#include "utf8.h"
16+
17+extern int running; //main.c
18+extern char cwDir[256]; //main.c
19+extern unsigned long pgCursorX, pgCursorY; // pg.c
20+extern unsigned int pixels[BUF_WIDTH*BUF_HEIGHT]; // pg.c
21+extern unsigned int winPixels[BUF_WIDTH*BUF_HEIGHT]; // pg.c
22+extern unsigned int* printBuf; // pg.c
23+extern void* framebuffer; // pg.c
24+extern char* logDir; // psp2ch.c
25+extern int sel; // psp2ch.c
26+extern int tateFlag; // psp2ch.c
27+extern SceCtrlData pad; // psp2ch.c
28+extern SceCtrlData oldPad; // psp2ch.c
29+extern MESSAGE_HELPER mh; // psp2ch.c
30+extern S_2CH_FAVORITE* favList; // psp2chFavorite.c
31+extern S_2CH_SCREEN fav; // psp2chFavorite.c
32+extern S_2CH_ITA* itaList; // psp2chIta.c
33+extern S_2CH_SCREEN ita; // psp2chIta.c
34+extern S_2CH_THREAD* threadList; // psp2chThread.c
35+extern S_2CH_SCREEN thread; // psp2chThread.c
36+extern S_2CH_FAVORITE* findList; // psp2chSearch.c
37+extern S_2CH_SCREEN find; // psp2chSearch.c
38+extern int* threadSort; // psp2chThread.c
39+extern S_2CH_HEADER_COLOR resHeaderColor; // psp2ch.c
40+extern S_2CH_RES_COLOR resColor; // psp2ch.c
41+extern S_2CH_BAR_COLOR resBarColor; // psp2ch.c
42+extern S_2CH_HEADER_COLOR resAHeaderColor; // psp2ch.c
43+extern S_2CH_RES_COLOR resAColor; // psp2ch.c
44+extern S_2CH_BAR_COLOR resABarColor; // psp2ch.c
45+
46+int preLine = -2;
47+char* resBuffer = NULL;
48+S_2CH_RES* resList = NULL;
49+S_2CH_SCREEN res;
50+S_2CH_URL_ANCHOR urlAnchor[50];
51+S_2CH_RES_ANCHOR resAnchor[50];
52+int urlAnchorCount = 0;
53+int resAnchorCount = 0;
54+
55+static const char* cacheDir = "CACHE";
56+static S_2CH_ID_ANCHOR idAnchor[40];
57+static int idAnchorCount = 0;
58+static char jmpHost[32], jmpDir[32], jmpTitle[32];
59+static int jmpDat;
60+
61+/**************
62+ レス表示
63+***************/
64+int psp2chFavoriteRes(int ret)
65+{
66+ return psp2chRes(favList[fav.select].host, favList[fav.select].dir, favList[fav.select].title, favList[fav.select].dat, ret);
67+}
68+int psp2chThreadRes(int ret)
69+{
70+ return psp2chRes(itaList[ita.select].host, itaList[ita.select].dir,itaList[ita.select].title,threadList[threadSort[thread.select]].dat,ret);
71+}
72+int psp2chJumpRes(int ret)
73+{
74+ return psp2chRes(jmpHost, jmpDir, jmpTitle, jmpDat, ret);
75+}
76+int psp2chSearchRes(int ret)
77+{
78+ return psp2chRes(findList[find.select].host, findList[find.select].dir, findList[find.select].title, findList[find.select].dat, ret);
79+}
80+int psp2chRes(char* host, char* dir, char* title, int dat, int ret)
81+{
82+ static int cursorX = 240, cursorY = 130;
83+ static int totalLine = 0;
84+ static S_SCROLLBAR bar;
85+ static char* message = NULL;
86+ char path[256];
87+ char *p, *q;
88+ static char* menuStr = "";
89+ int i, j, tmp;
90+ static int resMenu = -1, urlMenu = -1, idMenu = -1;
91+ int lineEnd, rMenu;
92+
93+ if (tateFlag)
94+ {
95+ lineEnd = 35;
96+ }
97+ else
98+ {
99+ lineEnd = 20;
100+ }
101+ if (resList == NULL)
102+ {
103+ if (psp2chResList(host, dir, title, dat) < 0)
104+ {
105+ sel = ret;
106+ return -1;
107+ }
108+ totalLine = psp2chResSetLine(&bar);
109+ if (res.start > totalLine - lineEnd)
110+ {
111+ res.start = totalLine - lineEnd;
112+ }
113+ }
114+ if(sceCtrlPeekBufferPositive(&pad, 1))
115+ {
116+ rMenu = psp2chResCursorMove(&totalLine, &lineEnd);
117+ if (pad.Buttons != oldPad.Buttons)
118+ {
119+ oldPad = pad;
120+ // SELECTボタン
121+ if (pad.Buttons & PSP_CTRL_SELECT)
122+ {
123+ tateFlag = (tateFlag) ? 0 : 1;
124+ totalLine = psp2chResSetLine(&bar);
125+ if (res.start > totalLine - lineEnd)
126+ {
127+ res.start = totalLine - lineEnd;
128+ }
129+ for (i = 0; i < 50; i++)
130+ {
131+ resAnchor[i].x2 = 0;
132+ urlAnchor[i].x2 = 0;
133+ }
134+ preLine = -2;
135+ }
136+ // ○ボタン
137+ else if(pad.Buttons & PSP_CTRL_CIRCLE)
138+ {
139+ /* レスアンカー表示 */
140+ if (resMenu >= 0)
141+ {
142+ psp2chResAnchor(resMenu);
143+ }
144+ /* URLアンカー処理 */
145+ else if (urlMenu >= 0)
146+ {
147+ psp2chSaveIdx(title, dat);
148+ /* 2ちゃんリンク移動 */
149+ if ((p = strstr(urlAnchor[urlMenu].host, ".2ch.net")) && p[8] == '\0')
150+ {
151+ if (itaList == NULL)
152+ {
153+ if (psp2chItaList() < 0)
154+ {
155+ return ret;
156+ }
157+ }
158+ strcpy(jmpHost, urlAnchor[urlMenu].host);
159+ memcpy(path, urlAnchor[urlMenu].path, 256);
160+ path[255] = '\0';
161+ if ((p = strstr(path, "test/read.cgi/")))
162+ {
163+ p += 14;
164+ q = strchr(p, '/');
165+ if (!q)
166+ {
167+ return ret;
168+ }
169+ *q = '\0';
170+ memcpy(jmpDir, p, 32);
171+ jmpDir[31] = '\0';
172+ q++;
173+ sscanf(q, "%d", &jmpDat);
174+ jmpTitle[0] = '\0';
175+ for (i = 0; i < ita.count; i++)
176+ {
177+ if (strcmp(itaList[i].host, urlAnchor[urlMenu].host) == 0 &&
178+ strcmp(itaList[i].dir, jmpDir) == 0)
179+ {
180+ strcpy(jmpTitle, itaList[i].title);
181+ break;
182+ }
183+ }
184+ if (jmpTitle[0] == '\0')
185+ {
186+ return ret;
187+ }
188+ }
189+ else
190+ {
191+ return ret;
192+ }
193+ memset(&mh,0,sizeof(MESSAGE_HELPER));
194+ mh.options = PSP_UTILITY_MSGDIALOG_OPTION_TEXT |
195+ PSP_UTILITY_MSGDIALOG_OPTION_YESNO_BUTTONS | PSP_UTILITY_MSGDIALOG_OPTION_DEFAULT_NO;
196+ strcpy(mh.message, TEXT_11);
197+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
198+ sceCtrlPeekBufferPositive(&oldPad, 1);
199+ if (mh.buttonPressed == PSP_UTILITY_MSGDIALOG_RESULT_YES)
200+ {
201+ free(resList);
202+ resList = NULL;
203+ res.start = 0;
204+ sel = 6;
205+ return ret;
206+ }
207+ }
208+ /* 外部リンク */
209+ else
210+ {
211+ psp2chUrlAnchor(urlMenu, title, dat, res.start*LINE_PITCH);
212+ }
213+ }
214+ /* ID抽出表示 */
215+ else if (idMenu >= 0)
216+ {
217+ psp2chIdAnchor(idMenu);
218+ }
219+ /* お気に入りに追加 */
220+ else if (rMenu)
221+ {
222+ psp2chAddFavorite(host, dir, title, dat);
223+ }
224+ /* 投稿フォーム */
225+ else
226+ {
227+ tmp = tateFlag;
228+ tateFlag = 0;
229+ if (message == NULL)
230+ {
231+ message = (char*)calloc(1, 2048);
232+ }
233+ if (message == NULL)
234+ {
235+ memset(&mh,0,sizeof(MESSAGE_HELPER));
236+ sprintf(mh.message, "memorry error\n");
237+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
238+ sceCtrlPeekBufferPositive(&oldPad, 1);
239+ return 0;
240+ }
241+ if (psp2chForm(host, dir, dat, resList[0].title, message) == 1)
242+ {
243+ free(message);
244+ message = NULL;
245+ psp2chSaveIdx(title, dat);
246+ psp2chGetDat(host, dir, title, dat);
247+ psp2chResList(host, dir, title, dat);
248+ res.start++;
249+ for (i = 0, j=0; i < res.count; i++)
250+ {
251+ j += resList[i].line;
252+ j++;
253+ }
254+ totalLine = j;
255+ }
256+ tateFlag = tmp;
257+ }
258+ preLine = -2;
259+ }
260+ // ×ボタン
261+ else if(pad.Buttons & PSP_CTRL_CROSS)
262+ {
263+ if (rMenu)
264+ {
265+ }
266+ else
267+ {
268+ psp2chSaveIdx(title, dat);
269+ if (threadList)
270+ {
271+ psp2chSort(-1); // 前回のソート順で再ソート
272+ }
273+ sel = ret;
274+ return ret;
275+ }
276+ }
277+ // △ボタン
278+ else if(pad.Buttons & PSP_CTRL_TRIANGLE)
279+ {
280+ if (resMenu >= 0)
281+ {
282+ for (i = 0, j = 0; i < resAnchor[resMenu].res[0]; i++)
283+ {
284+ j += resList[i].line;
285+ j++;
286+ }
287+ res.start = j;
288+ if (res.start > totalLine - lineEnd)
289+ {
290+ res.start = totalLine - lineEnd;
291+ }
292+ }
293+ else
294+ {
295+ psp2chSaveIdx(title, dat);
296+ psp2chGetDat(host, dir, title, dat);
297+ psp2chResList(host, dir, title, dat);
298+ totalLine = psp2chResSetLine(&bar);
299+ res.start++;
300+ if (res.start > totalLine - lineEnd)
301+ {
302+ res.start = totalLine - lineEnd;
303+ }
304+ }
305+ }
306+ // □ボタン
307+ else if(pad.Buttons & PSP_CTRL_SQUARE)
308+ {
309+ if (rMenu)
310+ {
311+ psp2chDelFavorite(title, dat);
312+ }
313+ else
314+ {
315+ memset(&mh,0,sizeof(MESSAGE_HELPER));
316+ mh.options = PSP_UTILITY_MSGDIALOG_OPTION_TEXT |
317+ PSP_UTILITY_MSGDIALOG_OPTION_YESNO_BUTTONS | PSP_UTILITY_MSGDIALOG_OPTION_DEFAULT_NO;
318+ strcpy(mh.message, TEXT_5);
319+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
320+ sceCtrlPeekBufferPositive(&oldPad, 1);
321+ if (mh.buttonPressed == PSP_UTILITY_MSGDIALOG_RESULT_YES)
322+ {
323+ sprintf(path, "%s/%s/%s/%d.dat", cwDir, logDir, title, dat);
324+ sceIoRemove(path);
325+ sprintf(path, "%s/%s/%s/%d.idx", cwDir, logDir, title, dat);
326+ sceIoRemove(path);
327+ if (threadList)
328+ {
329+ threadList[threadSort[thread.select]].old = 0;
330+ psp2chSort(-1);
331+ }
332+ sel = ret;
333+ return 0;
334+ }
335+ }
336+ }
337+ }
338+ psp2chResPadMove(&cursorX, &cursorY, bar.x, bar.view);
339+ // 矢印カーソルにレスアンカーリンクがあるか
340+ for (i = 0; i < 50; i++)
341+ {
342+ if (cursorY/LINE_PITCH+res.start == resAnchor[i].line &&
343+ cursorX > resAnchor[i].x1 && cursorX < resAnchor[i].x2)
344+ {
345+ resMenu = i;
346+ break;
347+ }
348+ else
349+ {
350+ resMenu = -1;
351+ }
352+ }
353+ // URLリンクがあるか
354+ for (i = 0; i < 50; i++)
355+ {
356+ if (cursorY/LINE_PITCH+res.start == urlAnchor[i].line &&
357+ cursorX > urlAnchor[i].x1 && cursorX < urlAnchor[i].x2)
358+ {
359+ urlMenu = i;
360+ break;
361+ }
362+ else
363+ {
364+ urlMenu = -1;
365+ }
366+ }
367+ // IDの場所か
368+ for (i = 0; i < 40; i++)
369+ {
370+ if (cursorY/LINE_PITCH+res.start == idAnchor[i].line &&
371+ cursorX > idAnchor[i].x1 && cursorX < idAnchor[i].x2)
372+ {
373+ idMenu = i;
374+ break;
375+ }
376+ else
377+ {
378+ idMenu = -1;
379+ }
380+ }
381+ if (resMenu >= 0)
382+ {
383+ menuStr = " ○ : レス表\示   △ : レスに移動";
384+ }
385+ else if (urlMenu >= 0)
386+ {
387+ menuStr = " ○ : リンク表\示   ";
388+ }
389+ else if (idMenu >= 0)
390+ {
391+ menuStr = " ○ : ID抽出   ";
392+ }
393+ else if (rMenu)
394+ {
395+ // お気に入りリストにあるかチェック
396+ j = 0;
397+ if (fav.count)
398+ {
399+ for (i = 0; i < fav.count; i++)
400+ {
401+ if (favList[i].dat == dat && strcmp(favList[i].title, title) == 0)
402+ {
403+ j = 1;
404+ break;
405+ }
406+ }
407+ }
408+ // お気に入りにある
409+ if (j)
410+ {
411+ menuStr = " ↑ : 先頭   ↓ : 最後   □ : お気に入りから削除";
412+ }
413+ // お気に入りにない
414+ else
415+ {
416+ menuStr = " ↑ : 先頭   ↓ : 最後   ○ : お気に入りに登録";
417+ }
418+ }
419+ else
420+ {
421+ menuStr = " ○ : 書き込み   × : 戻る     △ : 更新     □ : 削除   R : メニュー切替";
422+ }
423+ psp2chDrawRes(res.start);
424+ pgCopy(0, res.start*LINE_PITCH);
425+ bar.start = res.start * LINE_PITCH;
426+ pgScrollbar(bar, resBarColor);
427+ pgMenuBar(menuStr);
428+ pgPadCursor(cursorX,cursorY);
429+ sceDisplayWaitVblankStart();
430+ framebuffer = sceGuSwapBuffers();
431+ }
432+ return ret;
433+}
434+
435+/*****************************
436+上下左右キーでの移動
437+*****************************/
438+int psp2chResCursorMove(int* totalLine, int* lineEnd)
439+{
440+ static int keyStart = 0, keyRepeat = 0, rMenu = 0;
441+ static clock_t keyTime = 0;
442+
443+ if(pad.Buttons & PSP_CTRL_RTRIGGER)
444+ {
445+ rMenu = 1;
446+ }
447+ else
448+ {
449+ rMenu = 0;
450+ }
451+ if (pad.Buttons != oldPad.Buttons || keyRepeat)
452+ {
453+ if (pad.Buttons != oldPad.Buttons)
454+ {
455+ keyStart = 1;
456+ }
457+ else
458+ {
459+ keyStart = 0;
460+ }
461+ keyTime = clock();
462+ keyRepeat = 0;
463+ if((pad.Buttons & PSP_CTRL_UP && !tateFlag) || (pad.Buttons & PSP_CTRL_RIGHT && tateFlag))
464+ {
465+ if (rMenu)
466+ {
467+ res.start = 0;
468+ }
469+ else
470+ {
471+ res.start--;
472+ if (res.start < 0)
473+ {
474+ res.start = 0;
475+ }
476+ }
477+ }
478+ if((pad.Buttons & PSP_CTRL_DOWN && !tateFlag) || (pad.Buttons & PSP_CTRL_LEFT && tateFlag))
479+ {
480+ if (rMenu)
481+ {
482+ res.start = *totalLine - *lineEnd;
483+ }
484+ else
485+ {
486+ res.start++;
487+ if (res.start > *totalLine - *lineEnd)
488+ {
489+ res.start = *totalLine - *lineEnd;
490+ }
491+ }
492+ }
493+ if((pad.Buttons & PSP_CTRL_LEFT && !tateFlag) || (pad.Buttons & PSP_CTRL_UP && tateFlag))
494+ {
495+ res.start -= (*lineEnd - 2);
496+ if (res.start < 0)
497+ {
498+ res.start = 0;
499+ }
500+ }
501+ if((pad.Buttons & PSP_CTRL_RIGHT && !tateFlag) || (pad.Buttons & PSP_CTRL_DOWN && tateFlag))
502+ {
503+ res.start += (*lineEnd - 2);
504+ if (res.start > *totalLine - *lineEnd)
505+ {
506+ res.start = *totalLine - *lineEnd;
507+ }
508+ }
509+ }
510+ else
511+ {
512+ if (keyStart)
513+ {
514+ if (clock() - keyTime > 400000)
515+ {
516+ keyRepeat = 1;
517+ }
518+ }
519+ else
520+ {
521+ if (clock() - keyTime > 10000)
522+ {
523+ keyRepeat = 1;
524+ }
525+ }
526+ }
527+ return rMenu;
528+}
529+
530+/*****************************
531+レスの行数をセット
532+スクロールバーの構造体をセット
533+総行数を返す
534+*****************************/
535+int psp2chResSetLine(S_SCROLLBAR* bar)
536+{
537+ int i, j;
538+
539+ if (tateFlag)
540+ {
541+ bar->view = 455;
542+ bar->x = RES_SCR_WIDTH_V;
543+ bar->y = 0;
544+ bar->w = RES_BAR_WIDTH_V;
545+ bar->h = 455;
546+ for (i = 0, j = 0; i < res.count; i++)
547+ {
548+ resList[i].line = psp2chCountRes(i, RES_SCR_WIDTH_V);
549+ j += resList[i].line;
550+ j++;
551+ }
552+ }
553+ else
554+ {
555+ bar->view = 259;
556+ bar->x = RES_SCR_WIDTH;
557+ bar->y = 0;
558+ bar->w = RES_BAR_WIDTH;
559+ bar->h = 259;
560+ for (i = 0, j = 0; i < res.count; i++)
561+ {
562+ resList[i].line = psp2chCountRes(i, RES_SCR_WIDTH);
563+ j += resList[i].line;
564+ j++;
565+ }
566+ }
567+ bar->total = j * LINE_PITCH;
568+ return j;
569+}
570+
571+/*****************************
572+アナログパッドを読み取ってカーソル座標を更新
573+*****************************/
574+void psp2chResPadMove(int* cursorX, int* cursorY, int limitX, int limitY)
575+{
576+ int padX, padY;
577+
578+ padX = pad.Lx - 127;
579+ padY = pad.Ly - 127;
580+ if(pad.Buttons & PSP_CTRL_RTRIGGER)
581+ {
582+ if (tateFlag)
583+ {
584+ if (padX < -PAD_CUTOFF)
585+ {
586+ padX *= padX;
587+ padX >>= 10; // 0-16
588+ *cursorY += padX;
589+ }
590+ else if (padX > PAD_CUTOFF)
591+ {
592+ padX *= padX;
593+ padX >>= 10;
594+ *cursorY -= padX;
595+ }
596+ if (padY < -PAD_CUTOFF)
597+ {
598+ padY *= padY;
599+ padY >>= 10;
600+ *cursorX -= padY;
601+ }
602+ else if (padY > PAD_CUTOFF)
603+ {
604+ padY *= padY;
605+ padY >>= 10;
606+ *cursorX += padY;
607+ }
608+ }
609+ else
610+ {
611+ if (padX < -PAD_CUTOFF)
612+ {
613+ padX *= padX;
614+ padX >>= 11; // 0-8
615+ *cursorX -= padX;
616+ }
617+ else if (padX > PAD_CUTOFF)
618+ {
619+ padX *= padX;
620+ padX >>= 11;
621+ *cursorX += padX;
622+ }
623+ if (padY < -PAD_CUTOFF)
624+ {
625+ padY *= padY;
626+ padY >>= 11;
627+ *cursorY -= padY;
628+ }
629+ else if (padY > PAD_CUTOFF)
630+ {
631+ padY *= padY;
632+ padY >>= 11;
633+ *cursorY += padY;
634+ }
635+ }
636+ }
637+ else
638+ {
639+ if (tateFlag)
640+ {
641+ if (padX < -PAD_CUTOFF)
642+ {
643+ padX = (padX-1)*(padX-1);
644+ padX >>= 12; // 0-4
645+ *cursorY += padX;
646+ }
647+ else if (padX > PAD_CUTOFF)
648+ {
649+ padX *= padX;
650+ padX >>= 12;
651+ *cursorY -= padX;
652+ }
653+ if (padY < -PAD_CUTOFF)
654+ {
655+ padY = (padY-1)*(padY-1);
656+ padY >>= 12;
657+ *cursorX -= padY;
658+ }
659+ else if (padY > PAD_CUTOFF)
660+ {
661+ padY *= padY;
662+ padY >>= 12;
663+ *cursorX += padY;
664+ }
665+ }
666+ else
667+ {
668+ if (padX < -PAD_CUTOFF)
669+ {
670+ padX = (padX-1)*(padX-1);
671+ padX >>= 13; // 0-2
672+ *cursorX -= padX;
673+ }
674+ else if (padX > PAD_CUTOFF)
675+ {
676+ padX *= padX;
677+ padX >>= 13;
678+ *cursorX += padX;
679+ }
680+ if (padY < -PAD_CUTOFF)
681+ {
682+ padY = (padY-1)*(padY-1);
683+ padY >>= 13;
684+ *cursorY -= padY;
685+ }
686+ else if (padY > PAD_CUTOFF)
687+ {
688+ padY *= padY;
689+ padY >>= 13;
690+ *cursorY += padY;
691+ }
692+ }
693+ }
694+ if (*cursorX < 0)
695+ {
696+ *cursorX = 0;
697+ }
698+ else if (*cursorX > limitX)
699+ {
700+ *cursorX = limitX;
701+ }
702+ if (*cursorY < 0)
703+ {
704+ *cursorY = 0;
705+ }
706+ else if (*cursorY > limitY)
707+ {
708+ *cursorY = limitY;
709+ }
710+}
711+
712+/*****************************
713+datファイルをメモリに読み込みデータの区切りを'\0'(文字列終端)に書き換える
714+resList構造体のポインタに各データのアドレスを代入
715+*****************************/
716+int psp2chResList(char* host, char* dir, char* title, int dat)
717+{
718+ const char* delimiter = "<>";
719+ SceUID fd;
720+ SceIoStat st;
721+ char path[256];
722+ char *p, *q;
723+ char *buf;
724+ int ret;
725+
726+ sprintf(path, "%s/%s/%s/%d.idx", cwDir, logDir, title, dat);
727+ fd = sceIoOpen(path, PSP_O_RDONLY, 0777);
728+ if (fd < 0)
729+ {
730+ res.start = 0;
731+ res.select = 0;
732+ }
733+ else
734+ {
735+ sceIoRead(fd, path, 128);
736+ sceIoClose(fd);
737+ p = strchr(path, '\n');
738+ p++;
739+ p = strchr(p, '\n');
740+ p++;
741+ p = strchr(p, '\n');
742+ p++;
743+ sscanf(p, "%d %d", &res.start, &res.select);
744+ }
745+ sprintf(path, "%s/%s/%s/%d.dat", cwDir, logDir, title, dat);
746+ ret = sceIoGetstat(path, &st);
747+ if (ret < 0)
748+ {
749+ res.start = 0;
750+ res.select = 0;
751+ ret = psp2chGetDat(host, dir, title, dat);
752+ if (ret < 0)
753+ {
754+ return ret;
755+ }
756+ ret = sceIoGetstat(path, &st);
757+ if (ret < 0)
758+ {
759+ memset(&mh,0,sizeof(MESSAGE_HELPER));
760+ sprintf(mh.message, "File stat error\n%s", path);
761+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
762+ sceCtrlPeekBufferPositive(&oldPad, 1);
763+ return -1;
764+ }
765+ }
766+ free(resBuffer);
767+ resBuffer = (char*)malloc(st.st_size + 1);
768+ if (resBuffer == NULL)
769+ {
770+ memset(&mh,0,sizeof(MESSAGE_HELPER));
771+ strcpy(mh.message, "memorry error\nresBuffer");
772+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
773+ sceCtrlPeekBufferPositive(&oldPad, 1);
774+ return -1;
775+ }
776+ fd = sceIoOpen(path, PSP_O_RDONLY, 0777);
777+ if (fd < 0)
778+ {
779+ memset(&mh,0,sizeof(MESSAGE_HELPER));
780+ sprintf(mh.message, "File open error\n%s", path);
781+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
782+ sceCtrlPeekBufferPositive(&oldPad, 1);
783+ return -1;
784+ }
785+ sceIoRead(fd, resBuffer, st.st_size);
786+ sceIoClose(fd);
787+ resBuffer[st.st_size] = '\0';
788+ res.count = 0;
789+ p = resBuffer;
790+ while (*p)
791+ {
792+ if (*p++ == '\n')
793+ {
794+ res.count++;
795+ }
796+ }
797+ free(resList);
798+ resList = (S_2CH_RES*)malloc(sizeof(S_2CH_RES) * res.count);
799+ if (resList == NULL)
800+ {
801+ free(resBuffer);
802+ resBuffer = NULL;
803+ memset(&mh,0,sizeof(MESSAGE_HELPER));
804+ strcpy(mh.message, "memorry error\nresList");
805+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
806+ sceCtrlPeekBufferPositive(&oldPad, 1);
807+ return -1;
808+ }
809+ p = resBuffer;
810+ buf = resBuffer;
811+ for (ret = 0; ret < res.count; ret++)
812+ {
813+ p = strstr(buf, delimiter);
814+ if (p == NULL)
815+ {
816+ free(resList);
817+ resList = NULL;
818+ free(resBuffer);
819+ resBuffer = NULL;
820+ memset(&mh,0,sizeof(MESSAGE_HELPER));
821+ sprintf(mh.message, "DAT log error1\n%d/%d", ret, res.count);
822+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
823+ sceCtrlPeekBufferPositive(&oldPad, 1);
824+ return -1;
825+ }
826+ *p = '\0';
827+ resList[ret].name = buf;
828+ p += 2;
829+ buf = p;
830+ p = strstr(buf, delimiter);
831+ if (p == NULL)
832+ {
833+ free(resList);
834+ resList = NULL;
835+ free(resBuffer);
836+ resBuffer = NULL;
837+ memset(&mh,0,sizeof(MESSAGE_HELPER));
838+ sprintf(mh.message, "DAT log error2\n%d", ret);
839+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
840+ sceCtrlPeekBufferPositive(&oldPad, 1);
841+ return -1;
842+ }
843+ *p = '\0';
844+ resList[ret].mail = buf;
845+ p += 2;
846+ buf = p;
847+ p = strstr(buf, delimiter);
848+ if (p == NULL)
849+ {
850+ free(resList);
851+ resList = NULL;
852+ free(resBuffer);
853+ resBuffer = NULL;
854+ memset(&mh,0,sizeof(MESSAGE_HELPER));
855+ sprintf(mh.message, "DAT log error3\n%d", ret);
856+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
857+ sceCtrlPeekBufferPositive(&oldPad, 1);
858+ return -1;
859+ }
860+ *p = '\0';
861+ resList[ret].date = buf;
862+ q = strstr(buf, " BE:");
863+ if (q)
864+ {
865+ *q = '\0';
866+ q += 4;
867+ resList[ret].be = q;
868+ }
869+ else
870+ {
871+ resList[ret].be = NULL;
872+ }
873+ q = strstr(buf, " ID:");
874+ if (q)
875+ {
876+ *q = '\0';
877+ q += 4;
878+ resList[ret].id = q;
879+ }
880+ else
881+ {
882+ resList[ret].id = NULL;
883+ }
884+ p += 2;
885+ buf = p;
886+ p = strstr(buf, delimiter);
887+ if (p == NULL)
888+ {
889+ free(resList);
890+ resList = NULL;
891+ free(resBuffer);
892+ resBuffer = NULL;
893+ memset(&mh,0,sizeof(MESSAGE_HELPER));
894+ sprintf(mh.message, "DAT log error4\n%d", ret);
895+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
896+ sceCtrlPeekBufferPositive(&oldPad, 1);
897+ return -1;
898+ }
899+ *p = '\0';
900+ resList[ret].text = buf;
901+ p += 2;
902+ buf = p;
903+ p = strstr(buf, "\n");
904+ if (p == NULL)
905+ {
906+ free(resList);
907+ resList = NULL;
908+ free(resBuffer);
909+ resBuffer = NULL;
910+ memset(&mh,0,sizeof(MESSAGE_HELPER));
911+ sprintf(mh.message, "DAT log error5\n%d", ret);
912+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
913+ sceCtrlPeekBufferPositive(&oldPad, 1);
914+ return -1;
915+ }
916+ *p = '\0';
917+ resList[ret].title = buf;
918+ p++;
919+ buf = p;
920+ }
921+ psp2chSaveIdx(title, dat);
922+ return 0;
923+}
924+
925+/*****************************
926+datファイルにアクセスして保存
927+*****************************/
928+int psp2chGetDat(char* host, char* dir, char* title, int dat)
929+{
930+ int ret, mySocket, contentLength, range;
931+ HTTP_HEADERS resHeader;
932+ SceUID fd;
933+ char path[256];
934+ char buf[256];
935+ char lastModified[32];
936+ char eTag[32];
937+ char *p, *q;
938+
939+ // Make ita directory
940+ sprintf(path, "%s/%s/%s", cwDir, logDir, title);
941+ if ((fd = sceIoDopen(path)) < 0)
942+ {
943+ if (sceIoMkdir(path, 0777) < 0)
944+ {
945+ memset(&mh,0,sizeof(MESSAGE_HELPER));
946+ sprintf(mh.message, "Make dir error\n%s", path);
947+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
948+ sceCtrlPeekBufferPositive(&oldPad, 1);
949+ return -1;
950+ }
951+ }
952+ else
953+ {
954+ sceIoDclose(fd);
955+ }
956+ // check ita idx
957+ sprintf(path, "%s/%s/%s/%d.idx", cwDir, logDir, title, dat);
958+ fd = sceIoOpen(path, PSP_O_RDONLY, 0777);
959+ if (fd < 0)
960+ {
961+ buf[0] = '\0';
962+ range = 0;
963+ res.start = 0;
964+ res.select = 0;
965+ }
966+ else
967+ {
968+ sceIoRead(fd, buf, 128);
969+ sceIoClose(fd);
970+ p = strchr(buf, '\n');
971+ *p = '\0';
972+ strcpy(lastModified, buf);
973+ p++;
974+ q = strchr(p, '\n');
975+ *q = 0;
976+ strcpy(eTag, p);
977+ q++;
978+ sscanf(q, "%d %d %d", &range, &res.start, &res.select);
979+ sprintf(buf, "If-Modified-Since: %s\r\nIf-None-Match: %s\r\nRange: bytes=%d-\r\n", lastModified, eTag, range - 1);
980+ }
981+ sprintf(path, "%s/dat/%d.dat", dir, dat);
982+ mySocket = psp2chRequest(host, path, buf);
983+ if (mySocket < 0)
984+ {
985+ return mySocket;
986+ }
987+ ret = psp2chGetStatusLine(mySocket);
988+ switch(ret)
989+ {
990+ case 200: // OK
991+ break;
992+ case 206: // Partial content
993+ break;
994+ case 302: // Found
995+ memset(&mh,0,sizeof(MESSAGE_HELPER));
996+ strcpy(mh.message, TEXT_10);
997+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
998+ psp2chCloseSocket(mySocket);
999+ sceCtrlPeekBufferPositive(&oldPad, 1);
1000+ return -1;
1001+ break;
1002+ case 304: // Not modified
1003+ psp2chCloseSocket(mySocket);
1004+ return 0;
1005+ default:
1006+ memset(&mh,0,sizeof(MESSAGE_HELPER));
1007+ sprintf(mh.message, "HTTP error\nhost %s path %s\nStatus code %d", host, path, ret);
1008+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
1009+ psp2chCloseSocket(mySocket);
1010+ sceCtrlPeekBufferPositive(&oldPad, 1);
1011+ return -1;
1012+ }
1013+ // Receive and Save dat
1014+ contentLength = psp2chGetHttpHeaders(mySocket, &resHeader);
1015+ if (contentLength <= 0)
1016+ {
1017+ psp2chCloseSocket(mySocket);
1018+ return -1;
1019+ }
1020+ // save dat.dat
1021+ sprintf(path, "%s/%s/%s/%d.dat", cwDir, logDir, title, dat);
1022+ fd = sceIoOpen(path, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_APPEND, 0777);
1023+ if (fd < 0)
1024+ {
1025+ psp2chCloseSocket(mySocket);
1026+ memset(&mh,0,sizeof(MESSAGE_HELPER));
1027+ sprintf(mh.message, "File open error\n%s", path);
1028+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
1029+ sceCtrlPeekBufferPositive(&oldPad, 1);
1030+ return fd;
1031+ }
1032+ sprintf(buf, "http://%s/%s/dat/%d.dat からデータを転送しています...", host, dir, dat);
1033+ pgMenuBar(buf);
1034+ sceDisplayWaitVblankStart();
1035+ framebuffer = sceGuSwapBuffers();
1036+ if (range && (recv(mySocket, buf, 1, 0) <= 0 || buf[0] !='\n'))
1037+ {
1038+ psp2chCloseSocket(mySocket);
1039+ memset(&mh,0,sizeof(MESSAGE_HELPER));
1040+ strcpy(mh.message, TEXT_4);
1041+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
1042+ sceCtrlPeekBufferPositive(&oldPad, 1);
1043+ return -1;
1044+ }
1045+ while((ret = recv(mySocket, buf, sizeof(buf), 0)) > 0)
1046+ {
1047+ sceIoWrite(fd, buf, ret);
1048+ range += ret;
1049+ }
1050+ psp2chCloseSocket(mySocket);
1051+ sceIoClose(fd);
1052+ // save dat.idx
1053+ sprintf(path, "%s/%s/%s/%d.idx", cwDir, logDir, title, dat);
1054+ fd = sceIoOpen(path, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
1055+ if (fd < 0)
1056+ {
1057+ psp2chCloseSocket(mySocket);
1058+ memset(&mh,0,sizeof(MESSAGE_HELPER));
1059+ sprintf(mh.message, "File open error\n%s", path);
1060+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
1061+ sceCtrlPeekBufferPositive(&oldPad, 1);
1062+ return fd;
1063+ }
1064+ sceIoWrite(fd, resHeader.Last_Modified, strlen(resHeader.Last_Modified));
1065+ sceIoWrite(fd, resHeader.ETag, strlen(resHeader.ETag));
1066+ sprintf(buf, "%d\n%d\n%d\n", range,res.start, res.select);
1067+ sceIoWrite(fd, buf, strlen(buf));
1068+ sceIoClose(fd);
1069+ return 0;
1070+}
1071+
1072+/*****************************
1073+スレッドの情報ファイル保存
1074+ファイル名:dat番号.idx
1075+Last-Modified\n
1076+ETag\n
1077+range(現在取得したバイト数)\n
1078+スレッド表示行\n
1079+未使用\n(最初は表示レスの行に使っていた)
1080+取得レス数\n
1081+*****************************/
1082+void psp2chSaveIdx(char* title, int dat)
1083+{
1084+ SceUID fd;
1085+ char path[256];
1086+ char buf[256];
1087+ char lastModified[32];
1088+ char eTag[32];
1089+ char *p, *q;
1090+ int range, r, l;
1091+
1092+ sprintf(path, "%s/%s/%s/%d.idx", cwDir, logDir, title, dat);
1093+ fd = sceIoOpen(path, PSP_O_RDONLY, 0777);
1094+ if (fd < 0)
1095+ {
1096+ return;
1097+ }
1098+ else
1099+ {
1100+ sceIoRead(fd, buf, 128);
1101+ sceIoClose(fd);
1102+ p = strchr(buf, '\n');
1103+ *p = '\0';
1104+ strcpy(lastModified, buf);
1105+ p++;
1106+ q = strchr(p, '\n');
1107+ *q = 0;
1108+ strcpy(eTag, p);
1109+ q++;
1110+ sscanf(q, "%d %d %d", &range, &r, &l);
1111+ }
1112+ fd = sceIoOpen(path, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
1113+ if (fd < 0)
1114+ {
1115+ return;
1116+ }
1117+ else
1118+ {
1119+ sprintf(buf, "%s\n%s\n%d\n%d\n%d\n%d\n", lastModified, eTag, range, res.start, res.select, res.count);
1120+ sceIoWrite(fd, buf, strlen(buf));
1121+ sceIoClose(fd);
1122+ }
1123+ if (threadList)
1124+ {
1125+ threadList[threadSort[thread.select]].old = res.count;
1126+ }
1127+}
1128+
1129+int psp2chDrawResStr(char* str, S_2CH_RES_COLOR c, int line, int lineEnd, int startX, int endX, int *drawLine)
1130+{
1131+ while ((str = pgPrintHtml(str, c, startX, endX, *drawLine)))
1132+ {
1133+ pgCursorX = startX;
1134+ pgCursorY += LINE_PITCH;
1135+ (*drawLine)++;
1136+ if (++line > lineEnd)
1137+ {
1138+ break;
1139+ }
1140+ pgFillvram(c.bg, startX, pgCursorY, endX-startX, LINE_PITCH);
1141+ }
1142+ return line;
1143+}
1144+
1145+/*****************************
1146+レスのヘッダ部分の表示(名前、日付、ID等)
1147+*****************************/
1148+// ID 出現回数で色を変える
1149+#define ID_COUNT 5
1150+int psp2chDrawResHeader(int re, int* skip, int line, int lineEnd, int startX, int endX,S_2CH_RES_COLOR c,S_2CH_HEADER_COLOR hc, int* drawLine)
1151+{
1152+ char* str;
1153+ char buf[128];
1154+ int i, j;
1155+
1156+ sprintf(buf, " %d ", re + 1);
1157+ str = buf;
1158+ c.text = hc.num;
1159+ if (*skip)
1160+ {
1161+ while ((str = pgCountHtml(str, endX, 1)))
1162+ {
1163+ pgCursorX = startX;
1164+ if (--(*skip) == 0)
1165+ {
1166+ pgFillvram(c.bg, startX, pgCursorY, endX-startX, LINE_PITCH);
1167+ line = psp2chDrawResStr(str, c, line, lineEnd, startX, endX, drawLine);
1168+ break;
1169+ }
1170+ }
1171+ }
1172+ else
1173+ {
1174+ pgFillvram(c.bg, startX, pgCursorY, endX-startX, LINE_PITCH);
1175+ line = psp2chDrawResStr(str, c, line, lineEnd, startX, endX, drawLine);
1176+ }
1177+ sprintf(buf, "名前:");
1178+ str = buf;
1179+ c.text = hc.name1;
1180+ if (*skip)
1181+ {
1182+ while ((str = pgCountHtml(str, endX, 1)))
1183+ {
1184+ pgCursorX = startX;
1185+ if (--(*skip) == 0)
1186+ {
1187+ pgFillvram(c.bg, startX, pgCursorY, endX-startX, LINE_PITCH);
1188+ line = psp2chDrawResStr(str, c, line, lineEnd, startX, endX, drawLine);
1189+ break;
1190+ }
1191+ }
1192+ }
1193+ else
1194+ {
1195+ line = psp2chDrawResStr(str, c, line, lineEnd, startX, endX, drawLine);
1196+ }
1197+ if (line > lineEnd)
1198+ {
1199+ return line;
1200+ }
1201+ str = resList[re].name;
1202+ c.text = hc.name2;
1203+ if (*skip)
1204+ {
1205+ while ((str = pgCountHtml(str, endX, 1)))
1206+ {
1207+ pgCursorX = startX;
1208+ if (--(*skip) == 0)
1209+ {
1210+ pgFillvram(c.bg, startX, pgCursorY, endX-startX, LINE_PITCH);
1211+ line = psp2chDrawResStr(str, c, line, lineEnd, startX, endX, drawLine);
1212+ break;
1213+ }
1214+ }
1215+ }
1216+ else
1217+ {
1218+ line = psp2chDrawResStr(str, c, line, lineEnd, startX, endX, drawLine);
1219+ }
1220+ if (line > lineEnd)
1221+ {
1222+ return line;
1223+ }
1224+ sprintf(buf, "[%s] ", resList[re].mail);
1225+ str = buf;
1226+ c.text = hc.mail;
1227+ if (*skip)
1228+ {
1229+ while ((str = pgCountHtml(str, endX, 1)))
1230+ {
1231+ pgCursorX = startX;
1232+ if (--(*skip) == 0)
1233+ {
1234+ pgFillvram(c.bg, startX, pgCursorY, endX-startX, LINE_PITCH);
1235+ line = psp2chDrawResStr(str, c, line, lineEnd, startX, endX, drawLine);
1236+ break;
1237+ }
1238+ }
1239+ }
1240+ else
1241+ {
1242+ line = psp2chDrawResStr(str, c, line, lineEnd, startX, endX, drawLine);
1243+ }
1244+ if (line > lineEnd)
1245+ {
1246+ return line;
1247+ }
1248+ str = resList[re].date;
1249+ c.text = hc.date;
1250+ if (*skip)
1251+ {
1252+ while ((str = pgCountHtml(str, endX, 1)))
1253+ {
1254+ pgCursorX = startX;
1255+ if (--(*skip) == 0)
1256+ {
1257+ pgFillvram(c.bg, startX, pgCursorY, endX-startX, LINE_PITCH);
1258+ line = psp2chDrawResStr(str, c, line, lineEnd, startX, endX, drawLine);
1259+ break;
1260+ }
1261+ }
1262+ }
1263+ else
1264+ {
1265+ line = psp2chDrawResStr(str, c, line, lineEnd, startX, endX, drawLine);
1266+ }
1267+ if (line > lineEnd)
1268+ {
1269+ return line;
1270+ }
1271+ if (resList[re].id)
1272+ {
1273+ sprintf(buf, " ID:");
1274+ str = buf;
1275+ c.text = hc.id1;
1276+ for (i = 0, j = 0; i < res.count; i++)
1277+ {
1278+ if (resList[i].id && (strcmp(resList[i].id, resList[re].id) == 0))
1279+ {
1280+ if (++j == ID_COUNT)
1281+ {
1282+ c.text = hc.id2;
1283+ break;
1284+ }
1285+ }
1286+ }
1287+ if (*skip)
1288+ {
1289+ while ((str = pgCountHtml(str, endX, 1)))
1290+ {
1291+ pgCursorX = startX;
1292+ if (--(*skip) == 0)
1293+ {
1294+ idAnchor[idAnchorCount].x1 = pgCursorX;
1295+ idAnchor[idAnchorCount].line = *drawLine;
1296+ strcpy(idAnchor[idAnchorCount].id, resList[re].id);
1297+ pgFillvram(c.bg, startX, pgCursorY, endX-startX, LINE_PITCH);
1298+ line = psp2chDrawResStr(str, c, line, lineEnd, startX, endX, drawLine);
1299+ break;
1300+ }
1301+ }
1302+ }
1303+ else
1304+ {
1305+ idAnchor[idAnchorCount].x1 = pgCursorX;
1306+ idAnchor[idAnchorCount].line = *drawLine;
1307+ strcpy(idAnchor[idAnchorCount].id, resList[re].id);
1308+ line = psp2chDrawResStr(str, c, line, lineEnd, startX, endX, drawLine);
1309+ }
1310+ if (line > lineEnd)
1311+ {
1312+ idAnchor[idAnchorCount].x2 = endX;
1313+ return line;
1314+ }
1315+ str = resList[re].id;
1316+ c.text = hc.id3;
1317+ if (*skip)
1318+ {
1319+ while ((str = pgCountHtml(str, endX, 1)))
1320+ {
1321+ pgCursorX = startX;
1322+ if (--(*skip) == 0)
1323+ {
1324+ pgFillvram(c.bg, startX, pgCursorY, endX-startX, LINE_PITCH);
1325+ line = psp2chDrawResStr(str, c, line, lineEnd, startX, endX, drawLine);
1326+ line++;
1327+ (*drawLine)++;
1328+ pgCursorX = startX;
1329+ pgCursorY += LINE_PITCH;
1330+ return line;
1331+ }
1332+ }
1333+ pgCursorX = startX;
1334+ (*skip)--;
1335+ }
1336+ else
1337+ {
1338+ line = psp2chDrawResStr(str, c, line, lineEnd, startX, endX, drawLine);
1339+ if (*drawLine == idAnchor[idAnchorCount].line)
1340+ {
1341+ idAnchor[idAnchorCount].x2 = pgCursorX;
1342+ }
1343+ else
1344+ {
1345+ idAnchor[idAnchorCount].x2 = endX;
1346+ idAnchorCount++;
1347+ if (idAnchorCount >= 40)
1348+ {
1349+ idAnchorCount = 0;
1350+ }
1351+ idAnchor[idAnchorCount].x1 = startX;
1352+ idAnchor[idAnchorCount].line = *drawLine;
1353+ strcpy(idAnchor[idAnchorCount].id, resList[re].id);
1354+ idAnchor[idAnchorCount].x2 = pgCursorX;
1355+ }
1356+ idAnchorCount++;
1357+ if (idAnchorCount >= 40)
1358+ {
1359+ idAnchorCount = 0;
1360+ }
1361+ line++;
1362+ (*drawLine)++;
1363+ pgCursorX = startX;
1364+ pgCursorY += LINE_PITCH;
1365+ }
1366+ }
1367+ else
1368+ {
1369+ if (*skip)
1370+ {
1371+ pgCursorX = startX;
1372+ (*skip)--;
1373+ }
1374+ else
1375+ {
1376+ line++;
1377+ (*drawLine)++;
1378+ pgCursorX = startX;
1379+ pgCursorY += LINE_PITCH;
1380+ }
1381+ }
1382+ return line;
1383+}
1384+
1385+/*****************************
1386+レスの本文部分の表示
1387+*****************************/
1388+int psp2chDrawResText(int res, int* skip, int line, int lineEnd, int startX, int endX, S_2CH_RES_COLOR c, int* drawLine)
1389+{
1390+ char* str;
1391+
1392+ str = resList[res].text;
1393+ if (*skip)
1394+ {
1395+ while (str)
1396+ {
1397+ str = pgCountHtml(str, endX, 1);
1398+ pgCursorX = startX;
1399+ if (--(*skip) == 0)
1400+ {
1401+ while (str)
1402+ {
1403+ pgFillvram(c.bg, startX, pgCursorY, endX-startX, LINE_PITCH);
1404+ str = pgPrintHtml(str, c, startX, endX, *drawLine);
1405+ (*drawLine)++;
1406+ if (++line > lineEnd)
1407+ {
1408+ return line;
1409+ }
1410+ pgCursorX = startX;
1411+ pgCursorY += LINE_PITCH;
1412+ }
1413+ }
1414+ }
1415+ pgFillvram(c.bg, startX, pgCursorY, endX-startX, LINE_PITCH);
1416+ }
1417+ else
1418+ {
1419+ while (str)
1420+ {
1421+ pgFillvram(c.bg, startX, pgCursorY, endX-startX, LINE_PITCH);
1422+ str = pgPrintHtml(str, c, startX, endX, *drawLine);
1423+ (*drawLine)++;
1424+ if (++line > lineEnd)
1425+ {
1426+ return line;
1427+ }
1428+ pgCursorX = startX;
1429+ pgCursorY += LINE_PITCH;
1430+ }
1431+ pgFillvram(c.bg, startX, pgCursorY, endX-startX, LINE_PITCH);
1432+ }
1433+ pgCursorX = startX;
1434+ pgCursorY += LINE_PITCH ;
1435+ line++;
1436+ (*drawLine)++;
1437+ return line;
1438+}
1439+
1440+/*****************************
1441+レスの表示
1442+drawLine:画面一番上に表示する行
1443+*****************************/
1444+void psp2chDrawRes(int drawLine)
1445+{
1446+ int re;
1447+ int skip;
1448+ int line = 0;
1449+ int i;
1450+ int endX, lineEnd;
1451+
1452+ if (tateFlag)
1453+ {
1454+ endX = RES_SCR_WIDTH_V;
1455+ lineEnd = 35;
1456+ }
1457+ else
1458+ {
1459+ endX = RES_SCR_WIDTH;
1460+ lineEnd = 20;
1461+ }
1462+ // 表示行に変化なし
1463+ if (drawLine == preLine)
1464+ {
1465+ return;
1466+ }
1467+ // 1行下に移動
1468+ else if (drawLine == preLine+1)
1469+ {
1470+ preLine = drawLine;
1471+ i = 0;
1472+ drawLine += lineEnd-1;
1473+ skip = drawLine;
1474+ while (skip >= 0)
1475+ {
1476+ skip -= resList[i].line;
1477+ skip--;
1478+ i++;
1479+ if (i >= res.count)
1480+ {
1481+ break;
1482+ }
1483+ }
1484+ re = --i;
1485+ skip++;
1486+ skip += resList[i].line;
1487+ pgCursorX = 0;
1488+ pgCursorY = (LINE_PITCH*drawLine)&0x01FF;
1489+ //pspDebugScreenInit();
1490+ //pspDebugScreenPrintf("Y=%d\n", (int)pgCursorY);
1491+ //pgWaitVn(200);
1492+ line = psp2chDrawResHeader(re, &skip, lineEnd, lineEnd, 0, endX, resColor, resHeaderColor, &drawLine);
1493+ if (line > lineEnd)
1494+ {
1495+ return;
1496+ }
1497+ line = psp2chDrawResText(re, &skip, lineEnd, lineEnd, 0, endX, resColor, &drawLine);
1498+ }
1499+ // 1行上に移動
1500+ else if (drawLine == preLine-1)
1501+ {
1502+ preLine = drawLine;
1503+ skip = drawLine;
1504+ i = 0;
1505+ while (skip >= 0)
1506+ {
1507+ skip -= resList[i].line;
1508+ skip--;
1509+ i++;
1510+ if (i >= res.count)
1511+ {
1512+ break;
1513+ }
1514+ }
1515+ re = --i;
1516+ skip++;
1517+ skip += resList[i].line;
1518+ pgCursorX = 0;
1519+ pgCursorY = (LINE_PITCH*drawLine)&0x01FF;
1520+ line = psp2chDrawResHeader(re, &skip, lineEnd, lineEnd, 0, endX, resColor, resHeaderColor, &drawLine);
1521+ if (line > lineEnd)
1522+ {
1523+ return;
1524+ }
1525+ line = psp2chDrawResText(re, &skip, lineEnd, lineEnd, 0, endX, resColor, &drawLine);
1526+ }
1527+ // 全画面書き直し
1528+ else
1529+ {
1530+ preLine = drawLine;
1531+ skip = drawLine;
1532+ i = 0;
1533+ while (skip >= 0)
1534+ {
1535+ skip -= resList[i].line;
1536+ skip--;
1537+ i++;
1538+ if (i >= res.count)
1539+ {
1540+ break;
1541+ }
1542+ }
1543+ re = --i;
1544+ skip++;
1545+ skip += resList[i].line;
1546+ pgCursorX = 0;
1547+ pgCursorY = (LINE_PITCH*drawLine)&0x01FF;
1548+ resAnchorCount = 0;
1549+ resAnchor[0].x1 = 0;
1550+ line = 0;
1551+ while (line <= lineEnd)
1552+ {
1553+ line = psp2chDrawResHeader(re, &skip, line, lineEnd, 0, endX, resColor, resHeaderColor, &drawLine);
1554+ if (line > lineEnd)
1555+ {
1556+ break;
1557+ }
1558+ line = psp2chDrawResText(re, &skip, line, lineEnd, 0, endX, resColor, &drawLine);
1559+ re++;
1560+ if (re >= res.count)
1561+ {
1562+ pgFillvram(resColor.bg, 0, pgCursorY, endX, (lineEnd + 1 - line)*LINE_PITCH);
1563+ break;
1564+ }
1565+ }
1566+ }
1567+}
1568+
1569+/*****************************
1570+res:レス番号
1571+width:レス表示画面の幅
1572+戻り値:レスを画面幅で表示したときの行数
1573+*****************************/
1574+int psp2chCountRes(int res, int width)
1575+{
1576+ char* str;
1577+ char buf[128];
1578+ int count = 0;
1579+
1580+ pgCursorX = 0;
1581+ pgCursorY = 0;
1582+ sprintf(buf, " %d 名前:", res + 1);
1583+ str = buf;
1584+ while ((str = pgCountHtml(str, width, 1)))
1585+ {
1586+ pgCursorX = 0;
1587+ count++;
1588+ }
1589+ str = resList[res].name;
1590+ while ((str = pgCountHtml(str, width, 1)))
1591+ {
1592+ pgCursorX = 0;
1593+ count++;
1594+ }
1595+ sprintf(buf, "[%s] ", resList[res].mail);
1596+ str = buf;
1597+ while ((str = pgCountHtml(str, width, 1)))
1598+ {
1599+ pgCursorX = 0;
1600+ count++;
1601+ }
1602+ str = resList[res].date;
1603+ while ((str = pgCountHtml(str, width, 1)))
1604+ {
1605+ pgCursorX = 0;
1606+ count++;
1607+ }
1608+ if (resList[res].id)
1609+ {
1610+ sprintf(buf, " ID:");
1611+ str = buf;
1612+ while ((str = pgCountHtml(str, width, 1)))
1613+ {
1614+ pgCursorX = 0;
1615+ count++;
1616+ }
1617+ str = resList[res].id;
1618+ while ((str = pgCountHtml(str, width, 1)))
1619+ {
1620+ pgCursorX = 0;
1621+ count++;
1622+ }
1623+ }
1624+ pgCursorX = 0;
1625+ count++;
1626+ str = resList[res].text;
1627+ while ((str = pgCountHtml(str, width, 1)))
1628+ {
1629+ pgCursorX = 0;
1630+ count++;
1631+ }
1632+ pgCursorX = 0;
1633+ count++;
1634+ return count;
1635+}
1636+
1637+/*****************************
1638+レスのウィンドウ表示
1639+lineFlag:0=変更なし; 1=下に1行追加; 2=上に1行追加; その他:全画面再描画
1640+*****************************/
1641+void psp2chDrawResAnchor(S_2CH_RES_ANCHOR a, S_2CH_SCREEN anchor, int lineFlag)
1642+{
1643+ int re;
1644+ int skip;
1645+ int line = 0, i, drawLine;
1646+ int startX, startY, scrW, lineEnd;
1647+
1648+ if (tateFlag)
1649+ {
1650+ startX = RES_A_X_V;
1651+ scrW = RES_A_WIDTH_V;
1652+ startY = RES_A_Y_V+1;
1653+ lineEnd = RES_A_LINE_V;
1654+ }
1655+ else
1656+ {
1657+ startX = RES_A_X;
1658+ scrW = RES_A_WIDTH;
1659+ startY = RES_A_Y;
1660+ lineEnd = RES_A_LINE;
1661+ }
1662+ //pspDebugScreenInit();
1663+ //pspDebugScreenPrintf("res=%d\n", a.res[re]);
1664+ //pgWaitVn(200);
1665+ drawLine = anchor.start;
1666+ if (lineFlag == 0 && drawLine)
1667+ {
1668+ return;
1669+ }
1670+ else if (lineFlag == 1)
1671+ {
1672+ drawLine += lineEnd-1;
1673+ skip = drawLine;
1674+ i = 0;
1675+ while (skip >= 0)
1676+ {
1677+ skip -= psp2chCountRes(a.res[i], scrW);
1678+ skip--;
1679+ i++;
1680+ if (i >= a.resCount)
1681+ {
1682+ break;
1683+ }
1684+ }
1685+ re = --i;
1686+ skip++;
1687+ skip += psp2chCountRes(a.res[i], scrW);
1688+ pgCursorX = startX;
1689+ pgCursorY = (LINE_PITCH*drawLine+startY)&0x01FF;
1690+ line = psp2chDrawResHeader(a.res[re], &skip, lineEnd, lineEnd, startX, scrW+startX, resAColor, resAHeaderColor, &drawLine);
1691+ if (line > lineEnd)
1692+ {
1693+ return;
1694+ }
1695+ line = psp2chDrawResText(a.res[re], &skip, lineEnd, lineEnd, startX, scrW+startX, resAColor, &drawLine);
1696+ }
1697+ else if (lineFlag == 2)
1698+ {
1699+ skip = drawLine;
1700+ i = 0;
1701+ while (skip >= 0)
1702+ {
1703+ skip -= psp2chCountRes(a.res[i], scrW);
1704+ skip--;
1705+ i++;
1706+ if (i >= a.resCount)
1707+ {
1708+ break;
1709+ }
1710+ }
1711+ re = --i;
1712+ skip++;
1713+ skip += psp2chCountRes(a.res[i], scrW);
1714+ pgCursorX = startX;
1715+ pgCursorY = (LINE_PITCH*drawLine+startY)&0x01FF;
1716+ line = psp2chDrawResHeader(a.res[re], &skip, lineEnd, lineEnd, startX, scrW+startX, resAColor, resAHeaderColor, &drawLine);
1717+ if (line > lineEnd)
1718+ {
1719+ return;
1720+ }
1721+ line = psp2chDrawResText(a.res[re], &skip, lineEnd, lineEnd, startX, scrW+startX, resAColor, &drawLine);
1722+ }
1723+ else
1724+ {
1725+ skip = drawLine;
1726+ i = 0;
1727+ while (skip >= 0)
1728+ {
1729+ skip -= psp2chCountRes(a.res[i], scrW);
1730+ skip--;
1731+ i++;
1732+ if (i >= a.resCount)
1733+ {
1734+ break;
1735+ }
1736+ }
1737+ re = --i;
1738+ skip++;
1739+ skip += psp2chCountRes(a.res[i], scrW);
1740+ pgCursorX = startX;
1741+ pgCursorY = (LINE_PITCH*drawLine+startY)&0x01FF;
1742+ resAnchorCount = 0;
1743+ resAnchor[0].x1 = 0;
1744+ line = 0;
1745+ while (line <= lineEnd)
1746+ {
1747+ line = psp2chDrawResHeader(a.res[re], &skip, line, lineEnd, startX, scrW+startX, resAColor, resAHeaderColor, &drawLine);
1748+ if (line > lineEnd)
1749+ {
1750+ break;
1751+ }
1752+ line = psp2chDrawResText(a.res[re], &skip, line, lineEnd, startX, scrW+startX, resAColor, &drawLine);
1753+ re++;
1754+ if (re >= a.resCount || a.res[re] >= res.count)
1755+ {
1756+ pgFillvram(resAColor.bg, startX-2, pgCursorY, scrW+2, (lineEnd - line + 1)*LINE_PITCH);
1757+ break;
1758+ }
1759+ }
1760+ }
1761+}
1762+
1763+void psp2chResAnchor(int anc)
1764+{
1765+ int keyStart = 0, keyRepeat = 0;
1766+ int totalLine = 0;
1767+ int i, j, lineFlag;
1768+ clock_t keyTime = 0;
1769+ S_SCROLLBAR bar;
1770+ S_2CH_SCREEN anchor;
1771+ S_2CH_RES_ANCHOR a = resAnchor[anc];
1772+ int startX, startY, scrX, scrY, lineEnd, barW;
1773+
1774+ if (a.resCount <= 0)
1775+ {
1776+ return;
1777+ }
1778+ if (tateFlag)
1779+ {
1780+ startX = RES_A_X_V;
1781+ scrX = RES_A_WIDTH_V;
1782+ startY = RES_A_Y_V;
1783+ scrY = RES_A_HEIGHT_V;
1784+ lineEnd = RES_A_LINE_V;
1785+ barW = RES_BAR_WIDTH_V;
1786+ bar.view = RES_A_HEIGHT_V;
1787+ bar.x = startX + scrX;
1788+ bar.y = RES_A_Y_V;
1789+ bar.w = RES_BAR_WIDTH_V;
1790+ bar.h = RES_A_HEIGHT_V;
1791+ }
1792+ else
1793+ {
1794+ startX = RES_A_X;
1795+ scrX = RES_A_WIDTH;
1796+ startY = RES_A_Y;
1797+ scrY = RES_A_HEIGHT;
1798+ lineEnd = RES_A_LINE;
1799+ barW = RES_BAR_WIDTH;
1800+ bar.view = RES_A_HEIGHT;
1801+ bar.x = startX + scrX;
1802+ bar.y = RES_A_Y;
1803+ bar.w = RES_BAR_WIDTH;
1804+ bar.h = RES_A_HEIGHT;
1805+ }
1806+ for (i = 0, j=0; i < a.resCount; i++)
1807+ {
1808+ j += psp2chCountRes(a.res[i], scrX);
1809+ j++;
1810+ }
1811+ if (j < lineEnd)
1812+ {
1813+ j = lineEnd;
1814+ }
1815+ totalLine = j;
1816+ bar.total = j * LINE_PITCH;
1817+ bar.start = 0;
1818+ anchor.start = 0;
1819+ anchor.select = 0;
1820+ printBuf = winPixels;
1821+ while (running)
1822+ {
1823+ if(sceCtrlPeekBufferPositive(&pad, 1))
1824+ {
1825+ lineFlag = 0;
1826+ if (pad.Buttons != oldPad.Buttons || keyRepeat)
1827+ {
1828+ if (pad.Buttons != oldPad.Buttons)
1829+ {
1830+ keyStart = 1;
1831+ }
1832+ else
1833+ {
1834+ keyStart = 0;
1835+ }
1836+ keyTime = clock();
1837+ keyRepeat = 0;
1838+ if((pad.Buttons & PSP_CTRL_UP && !tateFlag) || (pad.Buttons & PSP_CTRL_RIGHT && tateFlag))
1839+ {
1840+ lineFlag = 2;
1841+ anchor.start--;
1842+ if (anchor.start < 0)
1843+ {
1844+ anchor.start = 0;
1845+ }
1846+ }
1847+ if((pad.Buttons & PSP_CTRL_DOWN && !tateFlag) || (pad.Buttons & PSP_CTRL_LEFT && tateFlag))
1848+ {
1849+ lineFlag = 1;
1850+ anchor.start++;
1851+ if (anchor.start > totalLine - lineEnd)
1852+ {
1853+ anchor.start = totalLine - lineEnd;
1854+ }
1855+ }
1856+ if((pad.Buttons & PSP_CTRL_LEFT && !tateFlag) || (pad.Buttons & PSP_CTRL_UP && tateFlag))
1857+ {
1858+ lineFlag = 3;
1859+ anchor.start -= 13;
1860+ if (anchor.start < 0)
1861+ {
1862+ anchor.start = 0;
1863+ }
1864+ }
1865+ if((pad.Buttons & PSP_CTRL_RIGHT && !tateFlag) || (pad.Buttons & PSP_CTRL_DOWN && tateFlag))
1866+ {
1867+ lineFlag = 3;
1868+ anchor.start += 13;
1869+ if (anchor.start > totalLine - lineEnd)
1870+ {
1871+ anchor.start = totalLine - lineEnd;
1872+ }
1873+ }
1874+ /*
1875+ if (!keyRepeat && (pad.Buttons & PSP_CTRL_SELECT))
1876+ {
1877+ tateFlag = (tateFlag) ? 0 : 1;
1878+ if (tateFlag)
1879+ {
1880+ startX = RES_A_X_V;
1881+ scrX = RES_A_WIDTH_V;
1882+ startY = RES_A_Y_V;
1883+ scrY = RES_A_HEIGHT_V;
1884+ lineEnd = RES_A_LINE_V;
1885+ barW = RES_BAR_WIDTH_V;
1886+ bar.view = RES_A_HEIGHT_V;
1887+ bar.x = startX + scrX;
1888+ bar.y = RES_A_Y_V;
1889+ bar.w = RES_BAR_WIDTH_V;
1890+ bar.h = RES_A_HEIGHT_V;
1891+ }
1892+ else
1893+ {
1894+ startX = RES_A_X;
1895+ scrX = RES_A_WIDTH;
1896+ startY = RES_A_Y;
1897+ scrY = RES_A_HEIGHT;
1898+ lineEnd = RES_A_LINE;
1899+ barW = RES_BAR_WIDTH;
1900+ bar.view = RES_A_HEIGHT;
1901+ bar.x = startX + scrX;
1902+ bar.y = RES_A_Y;
1903+ bar.w = RES_BAR_WIDTH;
1904+ bar.h = RES_A_HEIGHT;
1905+ }
1906+ for (i = 0, j=0; i < a.resCount; i++)
1907+ {
1908+ j += psp2chCountRes(a.res[i], scrX);
1909+ j++;
1910+ }
1911+ if (j < lineEnd)
1912+ {
1913+ j = lineEnd;
1914+ }
1915+ totalLine = j;
1916+ bar.total = j * LINE_PITCH;
1917+ totalLine = j;
1918+ bar.total = j * LINE_PITCH;
1919+ if (res.start > totalLine - lineEnd)
1920+ {
1921+ res.start = totalLine - lineEnd;
1922+ }
1923+ lineFlag = 3;
1924+ }
1925+ */
1926+ psp2chDrawResAnchor(a, anchor, lineFlag);
1927+ }
1928+ else
1929+ {
1930+ if (keyStart)
1931+ {
1932+ if (clock() - keyTime > 400000)
1933+ {
1934+ keyRepeat = 1;
1935+ }
1936+ }
1937+ else
1938+ {
1939+ if (clock() - keyTime > 10000)
1940+ {
1941+ keyRepeat = 1;
1942+ }
1943+ }
1944+ }
1945+ if (pad.Buttons != oldPad.Buttons)
1946+ {
1947+ oldPad = pad;
1948+ if(pad.Buttons & PSP_CTRL_CROSS)
1949+ {
1950+ printBuf = pixels;
1951+ preLine = -2;
1952+ return;
1953+ }
1954+ }
1955+ pgCopyWindow(anchor.start * LINE_PITCH, startX, startY, scrX, scrY);
1956+ pgWindowFrame(startX, startY, startX + scrX + barW, startY + scrY);
1957+ bar.start = anchor.start * LINE_PITCH;
1958+ pgScrollbar(bar, resABarColor);
1959+ pgMenuBar(" × : 戻る   ");
1960+ sceDisplayWaitVblankStart();
1961+ framebuffer = sceGuSwapBuffers();
1962+ }
1963+ }
1964+ return;
1965+}
1966+
1967+int psp2chUrlAnchor(int anchor, char* title, int dat, int offset)
1968+{
1969+ SceUID fd;
1970+ int ret, mySocket, contentLength;
1971+ HTTP_HEADERS resHeader;
1972+ char path[256];
1973+ char ext[16];
1974+ char *p;
1975+
1976+ sprintf(path, "%s/%s", cwDir, cacheDir);
1977+ if ((fd = sceIoDopen(path)) < 0)
1978+ {
1979+ if (sceIoMkdir(path, 0777) < 0)
1980+ {
1981+ memset(&mh,0,sizeof(MESSAGE_HELPER));
1982+ sprintf(mh.message, "Make dir error\n%s", path);
1983+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
1984+ sceCtrlPeekBufferPositive(&oldPad, 1);
1985+ return -1;
1986+ }
1987+ }
1988+ else
1989+ {
1990+ sceIoDclose(fd);
1991+ }
1992+ sprintf(path, "%s/%s/%s", cwDir, cacheDir, title);
1993+ if ((fd = sceIoDopen(path)) < 0)
1994+ {
1995+ if (sceIoMkdir(path, 0777) < 0)
1996+ {
1997+ memset(&mh,0,sizeof(MESSAGE_HELPER));
1998+ sprintf(mh.message, "Make dir error\n%s", path);
1999+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
2000+ sceCtrlPeekBufferPositive(&oldPad, 1);
2001+ return -1;
2002+ }
2003+ }
2004+ else
2005+ {
2006+ sceIoDclose(fd);
2007+ }
2008+ p = strrchr(urlAnchor[anchor].path, '#');
2009+ if (p)
2010+ {
2011+ *p = '\0';
2012+ }
2013+ p = strrchr(urlAnchor[anchor].path, '.');
2014+ if (p)
2015+ {
2016+ memcpy(ext, p, 15);
2017+ ext[15] = '\0';
2018+ }
2019+ else
2020+ {
2021+ ext[0] = '\0';
2022+ }
2023+ sprintf(path, "%s/%s/%s/%X_%X_%X_%d%s", cwDir, cacheDir, title, dat, urlAnchor[anchor].line, urlAnchor[anchor].x1, tateFlag, ext);
2024+ fd = sceIoOpen(path, PSP_O_RDONLY, 0777);
2025+ if (fd >= 0)
2026+ {
2027+ sceIoClose(fd);
2028+ if ((ext[1] == 'j' || ext[1] == 'J') && (ext[2] == 'p' || ext[2] == 'P') && (ext[3] == 'g' || ext[3] == 'G'))
2029+ {
2030+ psp2chImageViewJpeg(path);
2031+ sceCtrlPeekBufferPositive(&oldPad, 1);
2032+ }
2033+ else if ((ext[1] == 'p' || ext[1] == 'P') && (ext[2] == 'n' || ext[2] == 'N') && (ext[3] == 'g' || ext[3] == 'G'))
2034+ {
2035+ psp2chImageViewPng(path);
2036+ sceCtrlPeekBufferPositive(&oldPad, 1);
2037+ }
2038+ return 0;
2039+ }
2040+ mySocket = psp2chRequest(urlAnchor[anchor].host, urlAnchor[anchor].path, "");
2041+ if (mySocket < 0)
2042+ {
2043+ return mySocket;
2044+ }
2045+ ret = psp2chGetStatusLine(mySocket);
2046+ switch(ret)
2047+ {
2048+ case 200: // OK
2049+ break;
2050+ default:
2051+ memset(&mh,0,sizeof(MESSAGE_HELPER));
2052+ sprintf(mh.message, "HTTP error\nhost %s path %s\nStatus code %d", urlAnchor[anchor].host, urlAnchor[anchor].path, ret);
2053+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
2054+ psp2chCloseSocket(mySocket);
2055+ sceCtrlPeekBufferPositive(&oldPad, 1);
2056+ return -1;
2057+ }
2058+ // Receive and Save dat
2059+ contentLength = psp2chGetHttpHeaders(mySocket, &resHeader);
2060+ if (contentLength < 0)
2061+ {
2062+ psp2chCloseSocket(mySocket);
2063+ return -1;
2064+ }
2065+ // save
2066+ fd = sceIoOpen(path, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
2067+ if (fd < 0)
2068+ {
2069+ psp2chCloseSocket(mySocket);
2070+ memset(&mh,0,sizeof(MESSAGE_HELPER));
2071+ sprintf(mh.message, "File open error\n dat %d\n", dat);
2072+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
2073+ sceCtrlPeekBufferPositive(&oldPad, 1);
2074+ return fd;
2075+ }
2076+ sprintf(path, "http://%s/%s からデータを転送しています...", urlAnchor[anchor].host, urlAnchor[anchor].path);
2077+ pgCopy(0, offset);
2078+ pgMenuBar(path);
2079+ sceDisplayWaitVblankStart();
2080+ framebuffer = sceGuSwapBuffers();
2081+ while((ret = recv(mySocket, path, sizeof(path), 0)) > 0)
2082+ {
2083+ sceIoWrite(fd, path, ret);
2084+ }
2085+ psp2chCloseSocket(mySocket);
2086+ sceIoClose(fd);
2087+ sprintf(path, "%s/%s/%s/%X_%X_%X_%d%s", cwDir, cacheDir, title, dat, urlAnchor[anchor].line, urlAnchor[anchor].x1, tateFlag, ext);
2088+ if ((ext[1] == 'j' || ext[1] == 'J') && (ext[2] == 'p' || ext[2] == 'P') && (ext[3] == 'g' || ext[3] == 'G'))
2089+ {
2090+ psp2chImageViewJpeg(path);
2091+ sceCtrlPeekBufferPositive(&oldPad, 1);
2092+ }
2093+ else if ((ext[1] == 'p' || ext[1] == 'P') && (ext[2] == 'n' || ext[2] == 'N') && (ext[3] == 'g' || ext[3] == 'G'))
2094+ {
2095+ psp2chImageViewPng(path);
2096+ sceCtrlPeekBufferPositive(&oldPad, 1);
2097+ }
2098+ return 0;
2099+}
2100+
2101+void psp2chIdAnchor(int anc)
2102+{
2103+ int keyStart = 0, keyRepeat = 0;
2104+ int totalLine = 0;
2105+ int i, j, lineFlag;
2106+ clock_t keyTime = 0;
2107+ S_SCROLLBAR bar;
2108+ S_2CH_SCREEN anchor;
2109+ S_2CH_RES_ANCHOR a;
2110+ int startX, startY, scrX, scrY, lineEnd, barW;
2111+
2112+ if (tateFlag)
2113+ {
2114+ startX = RES_A_X_V;
2115+ scrX = RES_A_WIDTH_V;
2116+ startY = RES_A_Y_V;
2117+ scrY = RES_A_HEIGHT_V;
2118+ lineEnd = RES_A_LINE_V;
2119+ barW = RES_BAR_WIDTH_V;
2120+ bar.view = RES_A_HEIGHT_V;
2121+ bar.x = startX + scrX;
2122+ bar.y = RES_A_Y_V;
2123+ bar.w = RES_BAR_WIDTH_V;
2124+ bar.h = RES_A_HEIGHT_V;
2125+ }
2126+ else
2127+ {
2128+ startX = RES_A_X;
2129+ scrX = RES_A_WIDTH;
2130+ startY = RES_A_Y;
2131+ scrY = RES_A_HEIGHT;
2132+ lineEnd = RES_A_LINE;
2133+ barW = RES_BAR_WIDTH;
2134+ bar.view = RES_A_HEIGHT;
2135+ bar.x = startX + scrX;
2136+ bar.y = RES_A_Y;
2137+ bar.w = RES_BAR_WIDTH;
2138+ bar.h = RES_A_HEIGHT;
2139+ }
2140+ a.resCount = 0;
2141+ for (i = 0; i < res.count; i++)
2142+ {
2143+ if (resList[i].id && strcmp(resList[i].id, idAnchor[anc].id) == 0)
2144+ {
2145+ a.res[a.resCount] = i;
2146+ a.resCount++;
2147+ }
2148+ }
2149+ for (i = 0, j=0; i < a.resCount; i++)
2150+ {
2151+ j += psp2chCountRes(a.res[i], scrX);
2152+ j++;
2153+ }
2154+ if (j < lineEnd)
2155+ {
2156+ j = lineEnd;
2157+ }
2158+ totalLine = j;
2159+ bar.total = j * LINE_PITCH;
2160+ bar.start = 0;
2161+ anchor.start = 0;
2162+ anchor.select = 0;
2163+ printBuf = winPixels;
2164+ while (running)
2165+ {
2166+ if(sceCtrlPeekBufferPositive(&pad, 1))
2167+ {
2168+ lineFlag = 0;
2169+ if (pad.Buttons != oldPad.Buttons || keyRepeat)
2170+ {
2171+ if (pad.Buttons != oldPad.Buttons)
2172+ {
2173+ keyStart = 1;
2174+ }
2175+ else
2176+ {
2177+ keyStart = 0;
2178+ }
2179+ keyTime = clock();
2180+ keyRepeat = 0;
2181+ if((pad.Buttons & PSP_CTRL_UP && !tateFlag) || (pad.Buttons & PSP_CTRL_RIGHT && tateFlag))
2182+ {
2183+ lineFlag = 2;
2184+ anchor.start--;
2185+ if (anchor.start < 0)
2186+ {
2187+ anchor.start = 0;
2188+ }
2189+ }
2190+ if((pad.Buttons & PSP_CTRL_DOWN && !tateFlag) || (pad.Buttons & PSP_CTRL_LEFT && tateFlag))
2191+ {
2192+ lineFlag = 1;
2193+ anchor.start++;
2194+ if (anchor.start > totalLine - lineEnd)
2195+ {
2196+ anchor.start = totalLine - lineEnd;
2197+ }
2198+ }
2199+ if((pad.Buttons & PSP_CTRL_LEFT && !tateFlag) || (pad.Buttons & PSP_CTRL_UP && tateFlag))
2200+ {
2201+ lineFlag = 3;
2202+ anchor.start -= 13;
2203+ if (anchor.start < 0)
2204+ {
2205+ anchor.start = 0;
2206+ }
2207+ }
2208+ if((pad.Buttons & PSP_CTRL_RIGHT && !tateFlag) || (pad.Buttons & PSP_CTRL_DOWN && tateFlag))
2209+ {
2210+ lineFlag = 3;
2211+ anchor.start += 13;
2212+ if (anchor.start > totalLine - lineEnd)
2213+ {
2214+ anchor.start = totalLine - lineEnd;
2215+ }
2216+ }
2217+ /*
2218+ if (!keyRepeat && (pad.Buttons & PSP_CTRL_SELECT))
2219+ {
2220+ tateFlag = (tateFlag) ? 0 : 1;
2221+ if (tateFlag)
2222+ {
2223+ startX = RES_A_X_V;
2224+ scrX = RES_A_WIDTH_V;
2225+ startY = RES_A_Y_V;
2226+ scrY = RES_A_HEIGHT_V;
2227+ lineEnd = RES_A_LINE_V;
2228+ barW = RES_BAR_WIDTH_V;
2229+ bar.view = RES_A_HEIGHT_V;
2230+ bar.x = startX + scrX;
2231+ bar.y = RES_A_Y_V;
2232+ bar.w = RES_BAR_WIDTH_V;
2233+ bar.h = RES_A_HEIGHT_V;
2234+ }
2235+ else
2236+ {
2237+ startX = RES_A_X;
2238+ scrX = RES_A_WIDTH;
2239+ startY = RES_A_Y;
2240+ scrY = RES_A_HEIGHT;
2241+ lineEnd = RES_A_LINE;
2242+ barW = RES_BAR_WIDTH;
2243+ bar.view = RES_A_HEIGHT;
2244+ bar.x = startX + scrX;
2245+ bar.y = RES_A_Y;
2246+ bar.w = RES_BAR_WIDTH;
2247+ bar.h = RES_A_HEIGHT;
2248+ }
2249+ for (i = 0, j=0; i < a.resCount; i++)
2250+ {
2251+ j += psp2chCountRes(a.res[i], scrX);
2252+ j++;
2253+ }
2254+ if (j < lineEnd)
2255+ {
2256+ j = lineEnd;
2257+ }
2258+ totalLine = j;
2259+ bar.total = j * LINE_PITCH;
2260+ totalLine = j;
2261+ bar.total = j * LINE_PITCH;
2262+ if (res.start > totalLine - lineEnd)
2263+ {
2264+ res.start = totalLine - lineEnd;
2265+ }
2266+ lineFlag = 3;
2267+ }
2268+ */
2269+ psp2chDrawResAnchor(a, anchor, lineFlag);
2270+ }
2271+ else
2272+ {
2273+ if (keyStart)
2274+ {
2275+ if (clock() - keyTime > 400000)
2276+ {
2277+ keyRepeat = 1;
2278+ }
2279+ }
2280+ else
2281+ {
2282+ if (clock() - keyTime > 10000)
2283+ {
2284+ keyRepeat = 1;
2285+ }
2286+ }
2287+ }
2288+ if (pad.Buttons != oldPad.Buttons)
2289+ {
2290+ oldPad = pad;
2291+ if(pad.Buttons & PSP_CTRL_CROSS)
2292+ {
2293+ printBuf = pixels;
2294+ preLine = -2;
2295+ return;
2296+ }
2297+ }
2298+ pgCopyWindow(anchor.start * LINE_PITCH, startX, startY, scrX, scrY);
2299+ pgWindowFrame(startX, startY, startX + scrX + barW, startY + scrY);
2300+ bar.start = anchor.start * LINE_PITCH;
2301+ pgScrollbar(bar, resABarColor);
2302+ pgMenuBar(" × : 戻る   ");
2303+ sceDisplayWaitVblankStart();
2304+ framebuffer = sceGuSwapBuffers();
2305+ }
2306+ }
2307+ return;
2308+}
Added: svn:executable
--- trunc/src/intraFont.h (nonexistent)
+++ trunc/src/intraFont.h (revision 2)
@@ -0,0 +1,276 @@
1+/*
2+ * intraFont.h
3+ * This file is used to display the PSP's internal font (pgf firmware files)
4+ * intraFont Version 0.22 by BenHur - http://www.psp-programming.com/benhur
5+ *
6+ * Uses parts of pgeFont by InsertWittyName - http://insomniac.0x89.org
7+ *
8+ * This work is licensed under the Creative Commons Attribution-Share Alike 3.0 License.
9+ * See LICENSE for more details.
10+ *
11+ */
12+
13+#ifndef __INTRAFONT_H__
14+#define __INTRAFONT_H__
15+
16+#ifdef __cplusplus
17+extern "C" {
18+#endif
19+
20+/** @defgroup intraFont Font Library
21+ * @{
22+ */
23+
24+#define INTRAFONT_ADVANCE_H 0x0000 //default: advance horizontaly from one char to the next
25+#define INTRAFONT_ADVANCE_V 0x0100
26+#define INTRAFONT_ALIGN_LEFT 0x0000 //default: left-align the text
27+#define INTRAFONT_ALIGN_CENTER 0x0200
28+#define INTRAFONT_ALIGN_RIGHT 0x0400
29+#define INTRAFONT_WIDTH_VAR 0x0000 //default: variable-width
30+#define INTRAFONT_WIDTH_FIX 0x0800 //set your custom fixed witdh to 24 pixels: INTRAFONT_WIDTH_FIX | 24
31+ //(max is 255, set to 0 to use default fixed width, this width will be scaled by size)
32+#define INTRAFONT_ACTIVE 0x1000 //assumes the font-texture resides inside sceGuTex already, prevents unecessary reloading -> very small speed-gain
33+#define INTRAFONT_STRING_ASCII 0x0000 //default: interpret strings as ascii text
34+#define INTRAFONT_STRING_SJIS 0x2000 //interpret strings as shifted-jis (japanese)
35+#define INTRAFONT_CACHE_MED 0x0000 //default: 256x256 texture (enough to cache about 100 chars)
36+#define INTRAFONT_CACHE_LARGE 0x4000 //512x512 texture(enough to cache all chars of ltn0.pgf or ... or ltn15.pgf or kr0.pgf)
37+#define INTRAFONT_CACHE_ASCII 0x8000 //try to cache all ASCII chars during fontload (uses less memory and is faster to draw text, but slower to load font)
38+ //if it fails: (because the cache is too small) it will automatically switch to chache on-the-fly with a medium texture
39+ //if it succeeds: (all chars and shadows fit into chache) it will free some now unneeded memory
40+#define INTRAFONT_CACHE_ALL 0xC000 //try to cache all chars during fontload (uses less memory and is faster to draw text, but slower to load font)
41+ //if it fails: (because the cache is too small) it will automatically switch to chache on-the-fly with a large texture
42+ //if it succeeds: (all chars and shadows fit into chache) it will free some now unneeded memory
43+
44+/** @note The following definitions are used internally by ::intraFont and have no other relevance.*/
45+#define PGF_BMP_H_ROWS 0x01
46+#define PGF_BMP_V_ROWS 0x02
47+#define PGF_BMP_OVERLAY 0x03
48+#define PGF_NO_EXTRA1 0x04
49+#define PGF_NO_EXTRA2 0x08
50+#define PGF_NO_EXTRA3 0x10
51+#define PGF_CHARGLYPH 0x20
52+#define PGF_SHADOWGLYPH 0x40 //warning: this flag is not contained in the metric header flags and is only provided for simpler call to intraFontGetGlyph - ONLY check with (flags & PGF_CHARGLYPH)
53+#define PGF_CACHED 0x80
54+#define PGF_WIDTH_MASK 0x00FF
55+#define PGF_OPTIONS_MASK 0x1FFF
56+#define PGF_STRING_MASK 0x2000
57+#define PGF_CACHE_MASK 0xC000
58+
59+
60+/**
61+ * A Glyph struct
62+ *
63+ * @note This is used internally by ::intraFont and has no other relevance.
64+ */
65+typedef struct {
66+ unsigned short x; //in pixels
67+ unsigned short y; //in pixels
68+ unsigned char width; //in pixels
69+ unsigned char height; //in pixels
70+ char left; //in pixels
71+ char top; //in pixels
72+ unsigned char flags;
73+ unsigned short shadowID; //to look up in shadowmap
74+ char advance; //in quarterpixels
75+ unsigned long ptr; //offset
76+} Glyph;
77+
78+/**
79+ * A PGF_Header struct
80+ *
81+ * @note This is used internally by ::intraFont and has no other relevance.
82+ */
83+typedef struct {
84+ unsigned short header_start;
85+ unsigned short header_len;
86+ char pgf_id[4];
87+ unsigned long revision;
88+ unsigned long version;
89+ unsigned long charmap_len;
90+ unsigned long charptr_len;
91+ unsigned long charmap_bpe;
92+ unsigned long charptr_bpe;
93+ unsigned char junk00[21];
94+ unsigned char family[64];
95+ unsigned char style[64];
96+ unsigned char junk01[1];
97+ unsigned short charmap_min;
98+ unsigned short charmap_max;
99+ unsigned char junk02[50];
100+ unsigned long fixedsize[2];
101+ unsigned char junk03[14];
102+ unsigned char table1_len;
103+ unsigned char table2_len;
104+ unsigned char table3_len;
105+ unsigned char advance_len;
106+ unsigned char junk04[102];
107+ unsigned long shadowmap_len;
108+ unsigned long shadowmap_bpe;
109+ unsigned char junk05[4];
110+ unsigned long shadowscale[2];
111+ //currently no need ;
112+} PGF_Header;
113+
114+/**
115+ * A Font struct
116+ */
117+typedef struct {
118+ char *filename;
119+ unsigned char *fontdata;
120+
121+ unsigned char *texture; /**< The bitmap data */
122+ unsigned int texWidth; /**< Texture size (power2) */
123+ unsigned int texHeight; /**< Texture height (power2) */
124+ unsigned short texX;
125+ unsigned short texY;
126+ unsigned short texYSize;
127+
128+ unsigned short n_chars;
129+ char advancex; //in quarterpixels
130+ char advancey; //in quarterpixels
131+ unsigned char charmap_compr_len; /**<length of compression info*/
132+ unsigned short *charmap_compr; /**< Compression info on compressed charmap*/
133+ unsigned short *charmap; /**< Character map */
134+ Glyph* glyph; /**< Character glyphs */
135+
136+ unsigned short n_shadows;
137+ unsigned char shadowscale; /**< shadows in pgf file (width, height, left and top properties as well) are scaled by factor of (shadowscale>>6) */
138+ Glyph* shadowGlyph; /**< Shadow glyphs */
139+
140+ float size;
141+ unsigned int color;
142+ unsigned int shadowColor;
143+ unsigned short options;
144+} intraFont;
145+
146+
147+/**
148+ * Initialise the Font library
149+ *
150+ * @returns 1 on success.
151+ */
152+int intraFontInit(void);
153+
154+/**
155+ * Shutdown the Font library
156+ */
157+void intraFontShutdown(void);
158+
159+/**
160+ * Load a pgf font.
161+ *
162+ * @param filename - Path to the font
163+ *
164+ * @param options - INTRAFONT_XXX flags as defined above including flags related to CACHE (ored together)
165+ *
166+ * @returns A ::intraFont struct
167+ */
168+intraFont* intraFontLoad(const char *filename,unsigned short options);
169+
170+/**
171+ * Free the specified font.
172+ *
173+ * @param font - A valid ::intraFont
174+ */
175+void intraFontUnload(intraFont *font);
176+
177+/**
178+ * Activate the specified font.
179+ *
180+ * @param font - A valid ::intraFont
181+ */
182+void intraFontActivate(intraFont *font);
183+
184+/**
185+ * Set font style
186+ *
187+ * @param font - A valid ::intraFont
188+ *
189+ * @param size - Text size
190+ *
191+ * @param color - Text color
192+ *
193+ * @param shadowColor - Shadow color (use 0 for no shadow)
194+ *
195+ * @param options - INTRAFONT_XXX flags as defined above except flags related to CACHE (ored together)
196+ */
197+void intraFontSetStyle(intraFont *font, float size, unsigned int color, unsigned int shadowColor, unsigned short options);
198+
199+/**
200+ * Draw UCS-2 encoded text along the baseline starting at x, y.
201+ *
202+ * @param font - A valid ::intraFont
203+ *
204+ * @param x - X position on screen
205+ *
206+ * @param y - Y position on screen
207+ *
208+ * @param color - Text color
209+ *
210+ * @param shadowColor - Shadow color (use 0 for no shadow)
211+ *
212+ * @param text - UCS-2 encoded text to draw
213+ *
214+ * @returns The x position after the last char
215+ */
216+float intraFontPrintUCS2(intraFont *font, float x, float y, const unsigned short *text);
217+
218+/**
219+ * Draw text along the baseline starting at x, y.
220+ *
221+ * @param font - A valid ::intraFont
222+ *
223+ * @param x - X position on screen
224+ *
225+ * @param y - Y position on screen
226+ *
227+ * @param text - (ASCII or S-JIS) Text to draw
228+ *
229+ * @returns The x position after the last char
230+ */
231+float intraFontPrint(intraFont *font, float x, float y, const char *text);
232+
233+/**
234+ * Draw text along the baseline starting at x, y (with formatting).
235+ *
236+ * @param font - A valid ::intraFont
237+ *
238+ * @param x - X position on screen
239+ *
240+ * @param y - Y position on screen
241+ *
242+ * @param text - (ASCII or S-JIS) Text to draw
243+ *
244+ * @returns The x position after the last char
245+ */
246+float intraFontPrintf(intraFont *font, float x, float y, const char *text, ...);
247+
248+/**
249+ * Measure a length of text if it were to be drawn
250+ *
251+ * @param font - A valid ::intraFont
252+ *
253+ * @param text - (ASCII or S-JIS) Text to measure
254+ *
255+ * @returns The total width of the text (until the first newline char)
256+ */
257+float intraFontMeasureText(intraFont *font, const char *text);
258+
259+/**
260+ * Measure a length of UCS-2 encoded text if it were to be drawn
261+ *
262+ * @param font - A valid ::intraFont
263+ *
264+ * @param text - UCS-2 encoded text to measure
265+ *
266+ * @returns The total width of the text (until the first newline char)
267+ */
268+float intraFontMeasureTextUCS2(intraFont *font, const unsigned short *text);
269+
270+/** @} */
271+
272+#ifdef __cplusplus
273+}
274+#endif // __cplusplus
275+
276+#endif // __INTRAFONT_H__
Added: svn:executable
--- trunc/src/pspdialogs.h (nonexistent)
+++ trunc/src/pspdialogs.h (revision 2)
@@ -0,0 +1,93 @@
1+/*
2+ *PSP DIALOGS LIBRARY
3+ *Thomas Klein tommydanger@aon.at
4+
5+ *This library will provide some
6+ *basic functions to call the
7+ *psp internal
8+ * -messagebox
9+ * -error
10+ * -keyboard
11+ *dialogs as seen in psp games
12+ */
13+
14+#ifndef __PSP_DIALOGS_H__
15+#define __PSP_DIALGOS_H__
16+
17+#include <pspkernel.h>
18+#include <pspdisplay.h>
19+#include <string.h>
20+#include <psputility.h>
21+#include <psputility_osk.h>
22+#include <pspgu.h>
23+
24+/*
25+ Autoset language according to your psp system
26+ see psputility_sysparam.h for language codes
27+*/
28+#define DIALOG_LANGUAGE_AUTO (100)
29+
30+extern void* framebuffer;
31+
32+typedef struct
33+{
34+ char message[512];
35+ int options;
36+ pspUtilityMsgDialogPressed buttonPressed;
37+ int result;
38+}MESSAGE_HELPER;
39+
40+typedef struct
41+{
42+ int action;
43+ int result;
44+}NETCONF_HELPER;
45+
46+/*
47+ Struct to help initialize OSK
48+*/
49+typedef struct
50+{
51+ unsigned short *title; /* Title of the OSK */
52+ unsigned short *pretext; /* Text at startup */
53+ u16 textlength; /* Size of textarray */
54+ u16 textlimit; /* Limit for entering text */
55+ unsigned short text[128]; /* After OSK is called the entered text will be here */
56+ u16 lines; /* Textbox lines*/
57+}OSK_HELPER;
58+
59+/*
60+ Show a message dialog
61+
62+ msg - Message to show
63+ language - set the language to display the message box in
64+ pass DIALOG_LANGUAGE_AUTO or see psputility_sysparam.h
65+*/
66+void pspShowMessageDialog(MESSAGE_HELPER *mh, u8 language);
67+
68+/*
69+ Display a error code
70+
71+ error - error to display, see pspkerror.h
72+ language - set the language to display the message box in
73+ pass DIALOG_LANGUAGE_AUTO or see psputility_sysparam.h
74+*/
75+void pspShowErrorDialog(const int error, u8 language);
76+
77+/*
78+ Show Onscreenkeyboard
79+
80+ oskhelper - structure to initialize OSK, recieved text will be stored in here
81+ language - set the language to display the message box in
82+ pass DIALOG_LANGUAGE_AUTO or see psputility_sysparam.h
83+*/
84+void pspShowOSK(OSK_HELPER *oskhelper, u8 language);
85+
86+/*
87+ Minimal rendering routine during dialog is active
88+*/
89+void minimalRender();
90+
91+
92+#endif
93+
Added: svn:executable
--- trunc/src/psp2chRes.h (nonexistent)
+++ trunc/src/psp2chRes.h (revision 2)
@@ -0,0 +1,68 @@
1+#ifndef __PSP2CH_RES_H__
2+#define __PSP2CH_RES_H__
3+
4+typedef struct {
5+ int x;
6+ int y;
7+ int w;
8+ int h;
9+ int total;
10+ int view;
11+ int start;
12+} S_SCROLLBAR;
13+
14+typedef struct {
15+ char* name;
16+ char* mail;
17+ char* date;
18+ char* id;
19+ char* text;
20+ char* title;
21+ char* be;
22+ int line;
23+ int ng;
24+} S_2CH_RES;
25+
26+typedef struct {
27+ int x1;
28+ int x2;
29+ int line;
30+ int res[1001];
31+ int resCount;
32+} S_2CH_RES_ANCHOR;
33+
34+typedef struct {
35+ int x1;
36+ int x2;
37+ int line;
38+ char host[64];
39+ char path[256];
40+} S_2CH_URL_ANCHOR;
41+
42+typedef struct {
43+ int x1;
44+ int x2;
45+ int line;
46+ char id[12];
47+} S_2CH_ID_ANCHOR;
48+
49+int psp2chFavoriteRes(int ret);
50+int psp2chThreadRes(int ret);
51+int psp2chJumpRes(int ret);
52+int psp2chSearchRes(int ret);
53+int psp2chRes(char* host, char* dir, char* title, int dat, int ret);
54+int psp2chResCursorMove(int* totalLine, int* lineEnd);;
55+int psp2chResSetLine(S_SCROLLBAR* bar);
56+void psp2chResPadMove(int* cursorX, int* cursorY, int limitX, int limitY);
57+int psp2chResList(char* host, char* dir, char* title, int dat);
58+int psp2chGetDat(char* host, char* dir, char* title, int dat);
59+void psp2chSaveIdx(char* title, int dat);
60+void psp2chDrawRes(int line);
61+void psp2chResAnchor(int anchor);
62+int psp2chUrlAnchor(int anchor, char* title, int dat, int offset);
63+void psp2chIdAnchor(int anchor);
64+int psp2chCountRes(int res, int width);
65+void psp2chUrlEncode(char* dst, char* src);
66+int psp2chForm(char* host, char* dir, int dat, char* subject, char* message);
67+
68+#endif
Added: svn:executable
--- trunc/src/license.txt (nonexistent)
+++ trunc/src/license.txt (revision 2)
@@ -0,0 +1,278 @@
1+ GNU GENERAL PUBLIC LICENSE
2+ Version 2, June 1991
3+
4+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6+ Everyone is permitted to copy and distribute verbatim copies
7+ of this license document, but changing it is not allowed.
8+
9+ Preamble
10+
11+ The licenses for most software are designed to take away your
12+freedom to share and change it. By contrast, the GNU General Public
13+License is intended to guarantee your freedom to share and change free
14+software--to make sure the software is free for all its users. This
15+General Public License applies to most of the Free Software
16+Foundation's software and to any other program whose authors commit to
17+using it. (Some other Free Software Foundation software is covered by
18+the GNU Lesser General Public License instead.) You can apply it to
19+your programs, too.
20+
21+ When we speak of free software, we are referring to freedom, not
22+price. Our General Public Licenses are designed to make sure that you
23+have the freedom to distribute copies of free software (and charge for
24+this service if you wish), that you receive source code or can get it
25+if you want it, that you can change the software or use pieces of it
26+in new free programs; and that you know you can do these things.
27+
28+ To protect your rights, we need to make restrictions that forbid
29+anyone to deny you these rights or to ask you to surrender the rights.
30+These restrictions translate to certain responsibilities for you if you
31+distribute copies of the software, or if you modify it.
32+
33+ For example, if you distribute copies of such a program, whether
34+gratis or for a fee, you must give the recipients all the rights that
35+you have. You must make sure that they, too, receive or can get the
36+source code. And you must show them these terms so they know their
37+rights.
38+
39+ We protect your rights with two steps: (1) copyright the software, and
40+(2) offer you this license which gives you legal permission to copy,
41+distribute and/or modify the software.
42+
43+ Also, for each author's protection and ours, we want to make certain
44+that everyone understands that there is no warranty for this free
45+software. If the software is modified by someone else and passed on, we
46+want its recipients to know that what they have is not the original, so
47+that any problems introduced by others will not reflect on the original
48+authors' reputations.
49+
50+ Finally, any free program is threatened constantly by software
51+patents. We wish to avoid the danger that redistributors of a free
52+program will individually obtain patent licenses, in effect making the
53+program proprietary. To prevent this, we have made it clear that any
54+patent must be licensed for everyone's free use or not licensed at all.
55+
56+ The precise terms and conditions for copying, distribution and
57+modification follow.
58+
59+ GNU GENERAL PUBLIC LICENSE
60+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61+
62+ 0. This License applies to any program or other work which contains
63+a notice placed by the copyright holder saying it may be distributed
64+under the terms of this General Public License. The "Program", below,
65+refers to any such program or work, and a "work based on the Program"
66+means either the Program or any derivative work under copyright law:
67+that is to say, a work containing the Program or a portion of it,
68+either verbatim or with modifications and/or translated into another
69+language. (Hereinafter, translation is included without limitation in
70+the term "modification".) Each licensee is addressed as "you".
71+
72+Activities other than copying, distribution and modification are not
73+covered by this License; they are outside its scope. The act of
74+running the Program is not restricted, and the output from the Program
75+is covered only if its contents constitute a work based on the
76+Program (independent of having been made by running the Program).
77+Whether that is true depends on what the Program does.
78+
79+ 1. You may copy and distribute verbatim copies of the Program's
80+source code as you receive it, in any medium, provided that you
81+conspicuously and appropriately publish on each copy an appropriate
82+copyright notice and disclaimer of warranty; keep intact all the
83+notices that refer to this License and to the absence of any warranty;
84+and give any other recipients of the Program a copy of this License
85+along with the Program.
86+
87+You may charge a fee for the physical act of transferring a copy, and
88+you may at your option offer warranty protection in exchange for a fee.
89+
90+ 2. You may modify your copy or copies of the Program or any portion
91+of it, thus forming a work based on the Program, and copy and
92+distribute such modifications or work under the terms of Section 1
93+above, provided that you also meet all of these conditions:
94+
95+ a) You must cause the modified files to carry prominent notices
96+ stating that you changed the files and the date of any change.
97+
98+ b) You must cause any work that you distribute or publish, that in
99+ whole or in part contains or is derived from the Program or any
100+ part thereof, to be licensed as a whole at no charge to all third
101+ parties under the terms of this License.
102+
103+ c) If the modified program normally reads commands interactively
104+ when run, you must cause it, when started running for such
105+ interactive use in the most ordinary way, to print or display an
106+ announcement including an appropriate copyright notice and a
107+ notice that there is no warranty (or else, saying that you provide
108+ a warranty) and that users may redistribute the program under
109+ these conditions, and telling the user how to view a copy of this
110+ License. (Exception: if the Program itself is interactive but
111+ does not normally print such an announcement, your work based on
112+ the Program is not required to print an announcement.)
113+
114+These requirements apply to the modified work as a whole. If
115+identifiable sections of that work are not derived from the Program,
116+and can be reasonably considered independent and separate works in
117+themselves, then this License, and its terms, do not apply to those
118+sections when you distribute them as separate works. But when you
119+distribute the same sections as part of a whole which is a work based
120+on the Program, the distribution of the whole must be on the terms of
121+this License, whose permissions for other licensees extend to the
122+entire whole, and thus to each and every part regardless of who wrote it.
123+
124+Thus, it is not the intent of this section to claim rights or contest
125+your rights to work written entirely by you; rather, the intent is to
126+exercise the right to control the distribution of derivative or
127+collective works based on the Program.
128+
129+In addition, mere aggregation of another work not based on the Program
130+with the Program (or with a work based on the Program) on a volume of
131+a storage or distribution medium does not bring the other work under
132+the scope of this License.
133+
134+ 3. You may copy and distribute the Program (or a work based on it,
135+under Section 2) in object code or executable form under the terms of
136+Sections 1 and 2 above provided that you also do one of the following:
137+
138+ a) Accompany it with the complete corresponding machine-readable
139+ source code, which must be distributed under the terms of Sections
140+ 1 and 2 above on a medium customarily used for software interchange; or,
141+
142+ b) Accompany it with a written offer, valid for at least three
143+ years, to give any third party, for a charge no more than your
144+ cost of physically performing source distribution, a complete
145+ machine-readable copy of the corresponding source code, to be
146+ distributed under the terms of Sections 1 and 2 above on a medium
147+ customarily used for software interchange; or,
148+
149+ c) Accompany it with the information you received as to the offer
150+ to distribute corresponding source code. (This alternative is
151+ allowed only for noncommercial distribution and only if you
152+ received the program in object code or executable form with such
153+ an offer, in accord with Subsection b above.)
154+
155+The source code for a work means the preferred form of the work for
156+making modifications to it. For an executable work, complete source
157+code means all the source code for all modules it contains, plus any
158+associated interface definition files, plus the scripts used to
159+control compilation and installation of the executable. However, as a
160+special exception, the source code distributed need not include
161+anything that is normally distributed (in either source or binary
162+form) with the major components (compiler, kernel, and so on) of the
163+operating system on which the executable runs, unless that component
164+itself accompanies the executable.
165+
166+If distribution of executable or object code is made by offering
167+access to copy from a designated place, then offering equivalent
168+access to copy the source code from the same place counts as
169+distribution of the source code, even though third parties are not
170+compelled to copy the source along with the object code.
171+
172+ 4. You may not copy, modify, sublicense, or distribute the Program
173+except as expressly provided under this License. Any attempt
174+otherwise to copy, modify, sublicense or distribute the Program is
175+void, and will automatically terminate your rights under this License.
176+However, parties who have received copies, or rights, from you under
177+this License will not have their licenses terminated so long as such
178+parties remain in full compliance.
179+
180+ 5. You are not required to accept this License, since you have not
181+signed it. However, nothing else grants you permission to modify or
182+distribute the Program or its derivative works. These actions are
183+prohibited by law if you do not accept this License. Therefore, by
184+modifying or distributing the Program (or any work based on the
185+Program), you indicate your acceptance of this License to do so, and
186+all its terms and conditions for copying, distributing or modifying
187+the Program or works based on it.
188+
189+ 6. Each time you redistribute the Program (or any work based on the
190+Program), the recipient automatically receives a license from the
191+original licensor to copy, distribute or modify the Program subject to
192+these terms and conditions. You may not impose any further
193+restrictions on the recipients' exercise of the rights granted herein.
194+You are not responsible for enforcing compliance by third parties to
195+this License.
196+
197+ 7. If, as a consequence of a court judgment or allegation of patent
198+infringement or for any other reason (not limited to patent issues),
199+conditions are imposed on you (whether by court order, agreement or
200+otherwise) that contradict the conditions of this License, they do not
201+excuse you from the conditions of this License. If you cannot
202+distribute so as to satisfy simultaneously your obligations under this
203+License and any other pertinent obligations, then as a consequence you
204+may not distribute the Program at all. For example, if a patent
205+license would not permit royalty-free redistribution of the Program by
206+all those who receive copies directly or indirectly through you, then
207+the only way you could satisfy both it and this License would be to
208+refrain entirely from distribution of the Program.
209+
210+If any portion of this section is held invalid or unenforceable under
211+any particular circumstance, the balance of the section is intended to
212+apply and the section as a whole is intended to apply in other
213+circumstances.
214+
215+It is not the purpose of this section to induce you to infringe any
216+patents or other property right claims or to contest validity of any
217+such claims; this section has the sole purpose of protecting the
218+integrity of the free software distribution system, which is
219+implemented by public license practices. Many people have made
220+generous contributions to the wide range of software distributed
221+through that system in reliance on consistent application of that
222+system; it is up to the author/donor to decide if he or she is willing
223+to distribute software through any other system and a licensee cannot
224+impose that choice.
225+
226+This section is intended to make thoroughly clear what is believed to
227+be a consequence of the rest of this License.
228+
229+ 8. If the distribution and/or use of the Program is restricted in
230+certain countries either by patents or by copyrighted interfaces, the
231+original copyright holder who places the Program under this License
232+may add an explicit geographical distribution limitation excluding
233+those countries, so that distribution is permitted only in or among
234+countries not thus excluded. In such case, this License incorporates
235+the limitation as if written in the body of this License.
236+
237+ 9. The Free Software Foundation may publish revised and/or new versions
238+of the General Public License from time to time. Such new versions will
239+be similar in spirit to the present version, but may differ in detail to
240+address new problems or concerns.
241+
242+Each version is given a distinguishing version number. If the Program
243+specifies a version number of this License which applies to it and "any
244+later version", you have the option of following the terms and conditions
245+either of that version or of any later version published by the Free
246+Software Foundation. If the Program does not specify a version number of
247+this License, you may choose any version ever published by the Free Software
248+Foundation.
249+
250+ 10. If you wish to incorporate parts of the Program into other free
251+programs whose distribution conditions are different, write to the author
252+to ask for permission. For software which is copyrighted by the Free
253+Software Foundation, write to the Free Software Foundation; we sometimes
254+make exceptions for this. Our decision will be guided by the two goals
255+of preserving the free status of all derivatives of our free software and
256+of promoting the sharing and reuse of software generally.
257+
258+ NO WARRANTY
259+
260+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268+REPAIR OR CORRECTION.
269+
270+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278+POSSIBILITY OF SUCH DAMAGES.
Added: svn:executable
--- trunc/src/psp2chForm.c (nonexistent)
+++ trunc/src/psp2chForm.c (revision 2)
@@ -0,0 +1,420 @@
1+
2+#include "pspdialogs.h"
3+#include <stdio.h>
4+#include <malloc.h>
5+#include <pspctrl.h>
6+#include "pg.h"
7+#include "utf8.h"
8+
9+extern int running; //main.c
10+extern char cwDir[256]; //main.c
11+extern char* logDir; // psp2ch.c
12+extern SceCtrlData pad; // psp2ch.c
13+extern SceCtrlData oldPad; // psp2ch.c
14+extern MESSAGE_HELPER mh; // psp2ch.c
15+extern unsigned long pgCursorX, pgCursorY; // pg.c
16+extern void* framebuffer; // pg.c
17+extern S_2CH_FORM_COLOR formColor; // psp2ch.c
18+extern char cookie[128]; // psp2ch.c
19+
20+/*********************
21+src文字列をURLエンコードしてdst文字列に格納 
22+dstの容量に注意(srcの3倍あればOK)
23+*********************/
24+void psp2chUrlEncode(char* dst, char* src)
25+{
26+ char buf[4];
27+
28+ while (*src)
29+ {
30+ if ((*src >= 0x30 && *src <= 0x39) || // '0'-'9'
31+ (*src >= 0x41 && *src <= 0x59) || // 'A'-'Z'
32+ (*src >= 0x61 && *src <= 0x79) || // 'a'-'z'
33+ *src == '-' || *src == '.' || *src == '_')
34+ {
35+ *dst++ = *src++;
36+ }
37+ else if (*src == ' ')
38+ {
39+ *dst++ = '+';
40+ src++;
41+ }
42+ else
43+ {
44+ sprintf(buf, "%02X", *(unsigned char*)src++);
45+ *dst++ = '%';
46+ *dst++ = buf[0];
47+ *dst++ = buf[1];
48+ }
49+ }
50+ *dst = '\0';
51+}
52+
53+int psp2chForm(char* host, char* dir, int dat, char* subject, char* message)
54+{
55+ static char name[64] = {0};
56+ static char mail[64] = {0};
57+ SceUID fd;
58+ HTTP_HEADERS resHeader;
59+ int focus, sage, ret, mySocket, sendOk = 0;
60+ char buf[256];
61+ char *encode, *buffer, *str, *p;
62+
63+ encode = (char*)malloc(2048*4);
64+ if (encode == NULL)
65+ {
66+ memset(&mh,0,sizeof(MESSAGE_HELPER));
67+ sprintf(mh.message, "memorry error\n");
68+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
69+ sceCtrlPeekBufferPositive(&oldPad, 1);
70+ return -1;
71+ }
72+ buffer = (char*)malloc(2048*2);
73+ if (buffer == NULL)
74+ {
75+ free(encode);
76+ memset(&mh,0,sizeof(MESSAGE_HELPER));
77+ sprintf(mh.message, "memorry error\n");
78+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
79+ sceCtrlPeekBufferPositive(&oldPad, 1);
80+ return -1;
81+ }
82+ focus = 0;
83+ if (mail[0] == '\0' && name[0] == '\0')
84+ {
85+ sprintf(buf, "%s/%s/form.ini", cwDir, logDir);
86+ fd = sceIoOpen(buf, PSP_O_RDONLY, 0777);
87+ if (fd >= 0)
88+ {
89+ sceIoRead(fd, buf, 256);
90+ sceIoClose(fd);
91+ str = strchr(buf, '\n');
92+ *str = '\0';
93+ strcpy(name, buf);
94+ str++;
95+ p = strchr(str, '\n');
96+ *p = '\0';
97+ strcpy(mail, str);
98+ }
99+ }
100+ if (mail[0])
101+ {
102+ sage = 0;
103+ }
104+ else
105+ {
106+ sage = 1;
107+ }
108+ while (running)
109+ {
110+ if(sceCtrlPeekBufferPositive(&pad, 1))
111+ {
112+ if (pad.Buttons != oldPad.Buttons)
113+ {
114+ oldPad = pad;
115+ if(pad.Buttons & PSP_CTRL_UP)
116+ {
117+ focus--;
118+ if (focus < 0)
119+ {
120+ focus = 0;
121+ }
122+ }
123+ if(pad.Buttons & PSP_CTRL_DOWN)
124+ {
125+ focus++;
126+ if (focus > 2)
127+ {
128+ focus = 2;
129+ }
130+ }
131+ if(pad.Buttons & PSP_CTRL_LEFT)
132+ {
133+ if (focus == 1)
134+ {
135+ sage = sage ? 0 : 1;
136+ }
137+ }
138+ if(pad.Buttons & PSP_CTRL_RIGHT)
139+ {
140+ if (focus == 1)
141+ {
142+ sage = sage ? 0 : 1;
143+ }
144+ }
145+ if(pad.Buttons & PSP_CTRL_CIRCLE)
146+ {
147+ switch (focus)
148+ {
149+ case 0:
150+ psp2chGets("名前", name, 64, 1);
151+ break;
152+ case 1:
153+ psp2chGets("mail", mail, 64, 1);
154+ break;
155+ case 2:
156+ psp2chGets(NULL, message, 2048, 32);
157+ break;
158+ }
159+ }
160+ else if(pad.Buttons & PSP_CTRL_CROSS)
161+ {
162+ break;
163+ }
164+ else if(pad.Buttons & PSP_CTRL_TRIANGLE)
165+ {
166+ memset(&mh,0,sizeof(MESSAGE_HELPER));
167+ mh.options = PSP_UTILITY_MSGDIALOG_OPTION_TEXT |
168+ PSP_UTILITY_MSGDIALOG_OPTION_YESNO_BUTTONS | PSP_UTILITY_MSGDIALOG_OPTION_DEFAULT_NO;
169+ strcpy(mh.message, TEXT_6);
170+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
171+ sceCtrlPeekBufferPositive(&oldPad, 1);
172+ if (mh.buttonPressed == PSP_UTILITY_MSGDIALOG_RESULT_YES)
173+ {
174+ sendOk = 1;
175+ }
176+ }
177+ else if(pad.Buttons & PSP_CTRL_SQUARE)
178+ {
179+ }
180+ }
181+ if (sage)
182+ {
183+ strcpy(mail, "sage");
184+ }
185+ pgFillvram(RGB(0xCC, 0xFF, 0xCC), 0, 0, SCR_WIDTH, SCR_HEIGHT);
186+ pgFillvram(formColor.title_bg, 0, 0, SCR_WIDTH, 15);
187+ pgCursorX = 10;
188+ pgCursorY = 1;
189+ pgPrint(subject, formColor.title, formColor.title_bg, SCR_WIDTH);
190+ pgCursorX = 10;
191+ pgCursorY = 30;
192+ pgPrint(" 名前:", GRAY, RGB(0xCC, 0xFF, 0xCC), 58);
193+ pgCursorX = 60;
194+ pgEditBox(GRAY, 58, 28, 400, 44);
195+ pgPrint(name, BLACK, GRAY, 400);
196+ pgCursorX = 10;
197+ pgCursorY = 60;
198+ pgPrint("メール:", GRAY, RGB(0xCC, 0xFF, 0xCC), 58);
199+ pgCursorX = 60;
200+ pgEditBox(GRAY, 58, 58, 300, 74);
201+ pgPrint(mail, BLACK, GRAY, 400);
202+ pgCursorX = 310;
203+ pgCursorY = 60;
204+ if (sage)
205+ {
206+ pgPrint("●", GRAY, RGB(0xCC, 0xFF, 0xCC), SCR_WIDTH);
207+ }
208+ else
209+ {
210+ pgPrint("○", GRAY, RGB(0xCC, 0xFF, 0xCC), SCR_WIDTH);
211+ }
212+ pgPrint("sage (← →キーで切替)", GRAY, RGB(0xCC, 0xFF, 0xCC), SCR_WIDTH);
213+ pgCursorX = 10;
214+ pgCursorY = 90;
215+ pgEditBox(GRAY, 8, 88, 470, 250);
216+ str = message;
217+ while ((str = pgPrint(str, BLACK, GRAY, 470)))
218+ {
219+ pgCursorX = 10;
220+ pgCursorY += LINE_PITCH;
221+ if (pgCursorY >= 250)
222+ {
223+ break;
224+ }
225+ }
226+ switch (focus)
227+ {
228+ case 0:
229+ pgCursorX = 10;
230+ pgCursorY = 30;
231+ pgPrint(" 名前:", BLACK, RGB(0xCC, 0xFF, 0xCC), 58);
232+ pgCursorX = 60;
233+ pgEditBox(WHITE, 58, 28, 400, 44);
234+ pgPrint(name, BLACK, WHITE, 400);
235+ break;
236+ case 1:
237+ pgCursorX = 10;
238+ pgCursorY = 60;
239+ pgPrint("メール:", BLACK, RGB(0xCC, 0xFF, 0xCC), 58);
240+ pgCursorX = 60;
241+ pgEditBox(WHITE, 58, 58, 300, 74);
242+ pgPrint(mail, BLACK, WHITE, 300);
243+ pgCursorX = 310;
244+ pgCursorY = 60;
245+ if (sage)
246+ {
247+ pgPrint("●", BLACK, RGB(0xCC, 0xFF, 0xCC), SCR_WIDTH);
248+ }
249+ else
250+ {
251+ pgPrint("○", BLACK, RGB(0xCC, 0xFF, 0xCC), SCR_WIDTH);
252+ }
253+ pgPrint("sage (← →キーで切替)", BLACK, RGB(0xCC, 0xFF, 0xCC), SCR_WIDTH);
254+ break;
255+ case 2:
256+ pgCursorX = 10;
257+ pgCursorY = 90;
258+ pgEditBox(WHITE, 8, 88, 470, 250);
259+ str = message;
260+ while ((str = pgPrint(str, BLACK, WHITE, 470)))
261+ {
262+ pgCursorX = 10;
263+ pgCursorY += LINE_PITCH;
264+ if (pgCursorY >= 250)
265+ {
266+ break;
267+ }
268+ }
269+ break;
270+ }
271+ }
272+ pgCopy(0, 0);
273+ pgMenuBar(" ○ : 入力   × : 戻る   △ : 送信");
274+ sceDisplayWaitVblankStart();
275+ framebuffer = sceGuSwapBuffers();
276+ if (sendOk)
277+ {
278+ pgCopy(0, 0);
279+ sceDisplayWaitVblankStart();
280+ framebuffer = sceGuSwapBuffers();
281+ strcpy(encode, "submit=%8F%91%82%AB%8D%9E%82%DE&FROM=");
282+ psp2chUrlEncode(buffer, name);
283+ strcat(encode, buffer);
284+ strcat(encode, "&mail=");
285+ psp2chUrlEncode(buffer, mail);
286+ strcat(encode, buffer);
287+ strcat(encode, "&MESSAGE=");
288+ psp2chUrlEncode(buffer, message);
289+ strcat(encode, buffer);
290+ sprintf(buffer, "&bbs=%s&key=%d&time=1", dir, dat);
291+ strcat(encode, buffer);
292+ /* 仮送信して2ちゃんからSet-CookieのPON HAP 取得 */
293+ if (cookie[0] == 0)
294+ {
295+ mySocket = psp2chPost(host, dir, dat, cookie, encode);
296+ if (mySocket < 0)
297+ {
298+ free(buffer);
299+ free(encode);
300+ memset(&mh,0,sizeof(MESSAGE_HELPER));
301+ sprintf(mh.message, "POST error");
302+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
303+ sceCtrlPeekBufferPositive(&oldPad, 1);
304+ return mySocket;
305+ }
306+ ret = psp2chGetStatusLine(mySocket);
307+ switch(ret)
308+ {
309+ case 200: // OK
310+ break;
311+ default:
312+ free(buffer);
313+ free(encode);
314+ memset(&mh,0,sizeof(MESSAGE_HELPER));
315+ sprintf(mh.message, "Status code %d", ret);
316+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
317+ sceCtrlPeekBufferPositive(&oldPad, 1);
318+ psp2chCloseSocket(mySocket);
319+ return -1;
320+ }
321+ psp2chGetHttpHeaders(mySocket, &resHeader);
322+ strcat(cookie, "; NAME=\"\"; MAIL=\"\"; hana=mogera");
323+ psp2chCloseSocket(mySocket);
324+ }
325+ /* Cookieをセットして本送信 */
326+ mySocket = psp2chPost(host, dir, dat, cookie, encode);
327+ if (mySocket < 0)
328+ {
329+ free(buffer);
330+ free(encode);
331+ memset(&mh,0,sizeof(MESSAGE_HELPER));
332+ sprintf(mh.message, "POST error");
333+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
334+ sceCtrlPeekBufferPositive(&oldPad, 1);
335+ return -1;
336+ }
337+ ret = psp2chGetStatusLine(mySocket);
338+ switch(ret)
339+ {
340+ case 200: // OK
341+ break;
342+ default:
343+ free(buffer);
344+ free(encode);
345+ memset(&mh,0,sizeof(MESSAGE_HELPER));
346+ sprintf(mh.message, "Status code %d", ret);
347+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
348+ sceCtrlPeekBufferPositive(&oldPad, 1);
349+ psp2chCloseSocket(mySocket);
350+ return -1;
351+ }
352+ psp2chGetHttpHeaders(mySocket, &resHeader);
353+ str = message;
354+ while((ret = recv(mySocket, buf, sizeof(buf), 0)) > 0)
355+ {
356+ memcpy(str, buf, ret);
357+ str += ret;
358+ }
359+ *str = '\0';
360+ psp2chCloseSocket(mySocket);
361+#ifdef DEBUG
362+ fd = sceIoOpen("log.txt", PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
363+ if (fd >= 0)
364+ {
365+ sceIoWrite(fd, message, strlen(message));
366+ sceIoClose(fd);
367+ }
368+ S_2CH_RES_COLOR c;
369+ c.text = BLACK;
370+ c.bg = WHITE;
371+ c.link = BLUE;
372+ pgFillvram(WHITE, 0, 0, SCR_WIDTH, SCR_HEIGHT);
373+ pgCursorX = 0;
374+ pgCursorY = 0;
375+ while (1)
376+ {
377+ str = strstr(message, "</html");
378+ if (str) *str = 0;
379+ str = strstr(message, "<html");
380+ while ((str = pgPrintHtml(str, c, 0, SCR_WIDTH)))
381+ {
382+ pgCursorX = 0;
383+ pgCursorY += LINE_PITCH;
384+ if (pgCursorY >= 260)
385+ {
386+ break;
387+ }
388+ }
389+ pgMenuBar(" × : 戻る");
390+ sceDisplayWaitVblankStart();
391+ framebuffer = sceGuSwapBuffers();
392+ sceCtrlPeekBufferPositive(&pad, 1);
393+ if (pad.Buttons != oldPad.Buttons)
394+ {
395+ oldPad = pad;
396+ if(pad.Buttons & PSP_CTRL_CROSS)
397+ {
398+ break;
399+ }
400+ }
401+ }
402+#endif
403+ free(buffer);
404+ free(encode);
405+ sprintf(buf, "%s/%s/form.ini", cwDir, logDir);
406+ fd = sceIoOpen(buf, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
407+ if (fd >= 0)
408+ {
409+ sprintf(buf, "%s\n%s\n", name, mail);
410+ sceIoWrite(fd, buf, strlen(buf));
411+ sceIoClose(fd);
412+ }
413+ return 1;
414+ }
415+ }
416+ free(buffer);
417+ free(encode);
418+ return 0;
419+}
420+
Added: svn:executable
--- trunc/src/monafontA.h (nonexistent)
+++ trunc/src/monafontA.h (revision 2)
@@ -0,0 +1,326 @@
1+#ifndef __monafontA__
2+#define __monafontA__
3+
4+static unsigned int size_monafontA = 5088;
5+static unsigned char monafontA[] __attribute__((aligned(16))) = {
6+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40,
9+ 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
10+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x50, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
11+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
12+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x50, 0x00, 0xf8, 0x00, 0x50, 0x00, 0x50, 0x00, 0x50,
13+ 0x00, 0xf8, 0x00, 0x50, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
14+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x70, 0x00, 0xa8, 0x00, 0xa8, 0x00, 0x60, 0x00, 0x30,
15+ 0x00, 0x28, 0x00, 0xa8, 0x00, 0x70, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
16+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0xa8, 0x00, 0x50, 0x00, 0x10, 0x00, 0x20, 0x00, 0x20,
17+ 0x00, 0x50, 0x00, 0x68, 0x00, 0x90, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
18+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x90, 0x00, 0x90, 0x00, 0x60, 0x00, 0x40, 0x00, 0xa8,
19+ 0x00, 0x98, 0x00, 0x90, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
20+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
21+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
22+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x20, 0x00, 0x20, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40,
23+ 0x00, 0x40, 0x00, 0x20, 0x00, 0x20, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
24+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x40, 0x00, 0x40, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20,
25+ 0x00, 0x20, 0x00, 0x40, 0x00, 0x40, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
26+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0xa8, 0x00, 0x70, 0x00, 0xa8,
27+ 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
28+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0xf8, 0x00, 0x20,
29+ 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
30+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
31+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
32+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00,
33+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
34+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
35+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
36+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, 0x00, 0x10, 0x00, 0x20, 0x00, 0x20,
37+ 0x00, 0x40, 0x00, 0x40, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
38+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x48, 0x00, 0x48, 0x00, 0x48, 0x00, 0x48, 0x00, 0x48,
39+ 0x00, 0x48, 0x00, 0x48, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
40+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0xe0, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20,
41+ 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
42+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x88, 0x00, 0x88, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20,
43+ 0x00, 0x40, 0x00, 0x80, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
44+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x88, 0x00, 0x08, 0x00, 0x30, 0x00, 0x08, 0x00, 0x08,
45+ 0x00, 0x88, 0x00, 0x88, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
46+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x30, 0x00, 0x30, 0x00, 0x50, 0x00, 0x50, 0x00, 0x90,
47+ 0x00, 0xf8, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
48+ 0x06, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x80, 0x00, 0x80, 0x00, 0xf0, 0x00, 0x88, 0x00, 0x08,
49+ 0x00, 0x08, 0x00, 0x88, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
50+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x40, 0x00, 0x80, 0x00, 0xf0, 0x00, 0x88, 0x00, 0x88,
51+ 0x00, 0x88, 0x00, 0x88, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
52+ 0x06, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x08, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x20,
53+ 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
54+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x88, 0x00, 0x88, 0x00, 0x70, 0x00, 0x88, 0x00, 0x88,
55+ 0x00, 0x88, 0x00, 0x88, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
56+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x88, 0x00, 0x88, 0x00, 0x88, 0x00, 0x78, 0x00, 0x08,
57+ 0x00, 0x08, 0x00, 0x10, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
58+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
59+ 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
60+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
61+ 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
62+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x20,
63+ 0x00, 0x10, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
64+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0xf8,
65+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
66+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x20, 0x00, 0x10, 0x00, 0x08, 0x00, 0x10,
67+ 0x00, 0x20, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
68+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x90, 0x00, 0x90, 0x00, 0x10, 0x00, 0x20, 0x00, 0x20,
69+ 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
70+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x22, 0x00, 0x4e, 0x00, 0x52, 0x00, 0x52, 0x00, 0x52,
71+ 0x00, 0x4c, 0x00, 0x20, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
72+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x24, 0x00, 0x24, 0x00, 0x3c,
73+ 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
74+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x7c, 0x00, 0x42,
75+ 0x00, 0x42, 0x00, 0x42, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
76+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x22, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40,
77+ 0x00, 0x40, 0x00, 0x22, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
78+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x44, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42,
79+ 0x00, 0x42, 0x00, 0x44, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
80+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x78, 0x00, 0x40,
81+ 0x00, 0x40, 0x00, 0x40, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
82+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x78, 0x00, 0x40,
83+ 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
84+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x22, 0x00, 0x42, 0x00, 0x40, 0x00, 0x4e, 0x00, 0x42,
85+ 0x00, 0x42, 0x00, 0x26, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
86+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x7e, 0x00, 0x42,
87+ 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
88+ 0x03, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40,
89+ 0x00, 0x40, 0x00, 0x40, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
90+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04,
91+ 0x00, 0x44, 0x00, 0x48, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
92+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x48, 0x00, 0x48, 0x00, 0x50, 0x00, 0x60, 0x00, 0x50,
93+ 0x00, 0x48, 0x00, 0x48, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
94+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40,
95+ 0x00, 0x40, 0x00, 0x40, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
96+ 0x09, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x63, 0x00, 0x63, 0x00, 0x55, 0x00, 0x55, 0x00, 0x55,
97+ 0x00, 0x49, 0x00, 0x41, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
98+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x62, 0x00, 0x62, 0x00, 0x52, 0x00, 0x4a, 0x00, 0x4a,
99+ 0x00, 0x46, 0x00, 0x46, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
100+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x24, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42,
101+ 0x00, 0x42, 0x00, 0x24, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
102+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x44, 0x00, 0x44, 0x00, 0x44, 0x00, 0x78, 0x00, 0x40,
103+ 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
104+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x24, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42,
105+ 0x00, 0x4a, 0x00, 0x24, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
106+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x7c, 0x00, 0x44,
107+ 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
108+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x44, 0x00, 0x40, 0x00, 0x20, 0x00, 0x18, 0x00, 0x04,
109+ 0x00, 0x44, 0x00, 0x44, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
110+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
111+ 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
112+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42,
113+ 0x00, 0x42, 0x00, 0x42, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
114+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x24, 0x00, 0x24, 0x00, 0x24,
115+ 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
116+ 0x09, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x41, 0x00, 0x49, 0x00, 0x49, 0x00, 0x49, 0x00, 0x55,
117+ 0x00, 0x36, 0x00, 0x22, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
118+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x44, 0x00, 0x28, 0x00, 0x28, 0x00, 0x10, 0x00, 0x28,
119+ 0x00, 0x28, 0x00, 0x44, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
120+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x44, 0x00, 0x44, 0x00, 0x28, 0x00, 0x28, 0x00, 0x10,
121+ 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
122+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, 0x00, 0x10,
123+ 0x00, 0x20, 0x00, 0x40, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
124+ 0x04, 0x00, 0x00, 0xe0, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80,
125+ 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
126+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x88, 0x00, 0x50, 0x00, 0xf8, 0x00, 0x20, 0x00, 0xf8,
127+ 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
128+ 0x04, 0x00, 0x00, 0xe0, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20,
129+ 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
130+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x50, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
131+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
132+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
133+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
134+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
135+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
136+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x88, 0x00, 0x18, 0x00, 0x68,
137+ 0x00, 0x88, 0x00, 0x98, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
138+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0xb0, 0x00, 0xc8, 0x00, 0x88, 0x00, 0x88,
139+ 0x00, 0x88, 0x00, 0xc8, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
140+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x88, 0x00, 0x80, 0x00, 0x80,
141+ 0x00, 0x80, 0x00, 0x88, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
142+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x68, 0x00, 0x98, 0x00, 0x88, 0x00, 0x88,
143+ 0x00, 0x88, 0x00, 0x98, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
144+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x88, 0x00, 0x88, 0x00, 0xf8,
145+ 0x00, 0x80, 0x00, 0x88, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
146+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x40, 0x00, 0xe0, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40,
147+ 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
148+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x88, 0x00, 0x88, 0x00, 0x88,
149+ 0x00, 0x98, 0x00, 0x68, 0x00, 0x08, 0x00, 0x88, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
150+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0xb0, 0x00, 0xc8, 0x00, 0x88, 0x00, 0x88,
151+ 0x00, 0x88, 0x00, 0x88, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
152+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40,
153+ 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
154+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40,
155+ 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
156+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x88, 0x00, 0x90, 0x00, 0xa0, 0x00, 0xc0,
157+ 0x00, 0xa0, 0x00, 0x90, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
158+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40,
159+ 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
160+ 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x6d, 0x00, 0x49, 0x00, 0x49,
161+ 0x00, 0x49, 0x00, 0x49, 0x00, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
162+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x00, 0xc8, 0x00, 0x88, 0x00, 0x88,
163+ 0x00, 0x88, 0x00, 0x88, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
164+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x88, 0x00, 0x88, 0x00, 0x88,
165+ 0x00, 0x88, 0x00, 0x88, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
166+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x00, 0xc8, 0x00, 0x88, 0x00, 0x88,
167+ 0x00, 0x88, 0x00, 0xc8, 0x00, 0xb0, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
168+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x98, 0x00, 0x88, 0x00, 0x88,
169+ 0x00, 0x88, 0x00, 0x98, 0x00, 0x68, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
170+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0xc0, 0x00, 0x80, 0x00, 0x80,
171+ 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
172+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x88, 0x00, 0x40, 0x00, 0x30,
173+ 0x00, 0x08, 0x00, 0x88, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
174+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0xe0, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40,
175+ 0x00, 0x40, 0x00, 0x40, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
176+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x88, 0x00, 0x88, 0x00, 0x88,
177+ 0x00, 0x88, 0x00, 0x98, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
178+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x88, 0x00, 0x88, 0x00, 0x50,
179+ 0x00, 0x50, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
180+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x00, 0x82, 0x00, 0x92, 0x00, 0x92,
181+ 0x00, 0xaa, 0x00, 0x44, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
182+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x50, 0x00, 0x50, 0x00, 0x20,
183+ 0x00, 0x50, 0x00, 0x50, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x88, 0x00, 0x48, 0x00, 0x50,
185+ 0x00, 0x50, 0x00, 0x20, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
186+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x10, 0x00, 0x20, 0x00, 0x20,
187+ 0x00, 0x40, 0x00, 0x40, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
188+ 0x03, 0x00, 0x00, 0x20, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x80, 0x00, 0x40,
189+ 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
190+ 0x03, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40,
191+ 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
192+ 0x03, 0x00, 0x00, 0x80, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x20, 0x00, 0x40,
193+ 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
194+ 0x05, 0x00, 0x00, 0x40, 0x00, 0xa8, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
195+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
196+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
197+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
198+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
199+ 0x00, 0x00, 0x00, 0x20, 0x00, 0x50, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
200+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00,
201+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
202+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
203+ 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
204+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
205+ 0x00, 0x00, 0x00, 0x40, 0x00, 0x20, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
206+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60,
207+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
208+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x04, 0x00, 0x04, 0x00, 0x7c, 0x00, 0x04,
209+ 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
210+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x08, 0x00, 0x28,
211+ 0x00, 0x30, 0x00, 0x20, 0x00, 0x20, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
212+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x20,
213+ 0x00, 0x60, 0x00, 0xa0, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
214+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0xf8, 0x00, 0x88,
215+ 0x00, 0x88, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
216+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x20,
217+ 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
218+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0xf8, 0x00, 0x30,
219+ 0x00, 0x50, 0x00, 0x50, 0x00, 0x90, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
220+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x58, 0x00, 0xe8,
221+ 0x00, 0x50, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
222+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x10, 0x00, 0x10,
223+ 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
224+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x10, 0x00, 0x10,
225+ 0x00, 0xf0, 0x00, 0x10, 0x00, 0x10, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
226+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x00, 0xa8, 0x00, 0xa8,
227+ 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
228+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x7e,
229+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
230+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x04, 0x00, 0x14, 0x00, 0x14, 0x00, 0x18,
231+ 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
232+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x30, 0x00, 0x50,
233+ 0x00, 0x90, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
234+ 0x08, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x7e, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42,
235+ 0x00, 0x04, 0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
236+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
237+ 0x00, 0x10, 0x00, 0x10, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
238+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x7e, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x14,
239+ 0x00, 0x14, 0x00, 0x24, 0x00, 0x44, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
240+ 0x07, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x7c, 0x00, 0x14, 0x00, 0x14, 0x00, 0x14,
241+ 0x00, 0x14, 0x00, 0x24, 0x00, 0x24, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
242+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x1c, 0x00, 0x70, 0x00, 0x10, 0x00, 0x1e,
243+ 0x00, 0x78, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
244+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x78, 0x00, 0x48, 0x00, 0x88, 0x00, 0x08,
245+ 0x00, 0x10, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
246+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x3e, 0x00, 0x44, 0x00, 0x04,
247+ 0x00, 0x04, 0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
248+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08,
249+ 0x00, 0x08, 0x00, 0x08, 0x00, 0xf8, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
250+ 0x08, 0x00, 0x00, 0x04, 0x00, 0x24, 0x00, 0x24, 0x00, 0x7e, 0x00, 0x24, 0x00, 0x24, 0x00, 0x04,
251+ 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
252+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x24, 0x00, 0x04, 0x00, 0x44, 0x00, 0x24, 0x00, 0x04,
253+ 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
254+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x02, 0x00, 0x04, 0x00, 0x04, 0x00, 0x08,
255+ 0x00, 0x14, 0x00, 0x14, 0x00, 0x22, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
256+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1a, 0x00, 0x72, 0x00, 0x14,
257+ 0x00, 0x14, 0x00, 0x10, 0x00, 0x10, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
258+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x44, 0x00, 0x24, 0x00, 0x24, 0x00, 0x04,
259+ 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
260+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x78, 0x00, 0x48, 0x00, 0x48, 0x00, 0x68, 0x00, 0x98,
261+ 0x00, 0x10, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
262+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x70, 0x00, 0x10, 0x00, 0x10, 0x00, 0x7c, 0x00, 0x10,
263+ 0x00, 0x10, 0x00, 0x20, 0x00, 0x20, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
264+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x54, 0x00, 0x54, 0x00, 0x54, 0x00, 0x44, 0x00, 0x04,
265+ 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
266+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x10,
267+ 0x00, 0x10, 0x00, 0x20, 0x00, 0x20, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
268+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x60, 0x00, 0x50, 0x00, 0x48,
269+ 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
270+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x7e, 0x00, 0x08, 0x00, 0x08,
271+ 0x00, 0x08, 0x00, 0x10, 0x00, 0x10, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
272+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
273+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
274+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x04, 0x00, 0x24, 0x00, 0x18, 0x00, 0x08,
275+ 0x00, 0x14, 0x00, 0x14, 0x00, 0x20, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
276+ 0x08, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x7c, 0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x38,
277+ 0x00, 0x54, 0x00, 0x54, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
278+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, 0x00, 0x10,
279+ 0x00, 0x20, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
280+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x24, 0x00, 0x24, 0x00, 0x24, 0x00, 0x22,
281+ 0x00, 0x22, 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
282+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x58, 0x00, 0x60, 0x00, 0x40,
283+ 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
284+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04,
285+ 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
286+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0x50, 0x00, 0x50, 0x00, 0x88,
287+ 0x00, 0x08, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
288+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0xfe, 0x00, 0x10, 0x00, 0x54,
289+ 0x00, 0x54, 0x00, 0x54, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
290+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x28,
291+ 0x00, 0x28, 0x00, 0x10, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
292+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x20, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x20,
293+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
294+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x44,
295+ 0x00, 0x44, 0x00, 0x4e, 0x00, 0x72, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
296+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x88, 0x00, 0x50, 0x00, 0x30, 0x00, 0x10,
297+ 0x00, 0x28, 0x00, 0x28, 0x00, 0x40, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
298+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x7c,
299+ 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
300+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x16, 0x00, 0x1a, 0x00, 0x72, 0x00, 0x14,
301+ 0x00, 0x10, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
302+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04,
303+ 0x00, 0x04, 0x00, 0x04, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
304+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x08, 0x00, 0x08, 0x00, 0xf8, 0x00, 0x08,
305+ 0x00, 0x08, 0x00, 0x08, 0x00, 0xf8, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
306+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x04, 0x00, 0x04,
307+ 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
308+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x48, 0x00, 0x48, 0x00, 0x48, 0x00, 0x48, 0x00, 0x48,
309+ 0x00, 0x10, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
310+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x28, 0x00, 0x28, 0x00, 0x28, 0x00, 0x28, 0x00, 0x28,
311+ 0x00, 0x2a, 0x00, 0x4a, 0x00, 0x4c, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
312+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x44,
313+ 0x00, 0x44, 0x00, 0x48, 0x00, 0x50, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
314+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x44, 0x00, 0x44, 0x00, 0x44, 0x00, 0x44,
315+ 0x00, 0x44, 0x00, 0x44, 0x00, 0x7c, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
316+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x44, 0x00, 0x44, 0x00, 0x44, 0x00, 0x04,
317+ 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
318+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x24, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04,
319+ 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
320+ 0x03, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
321+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
322+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
323+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
324+};
325+
326+#endif
Added: svn:executable
--- trunc/src/psp2chForm.h (nonexistent)
+++ trunc/src/psp2chForm.h (revision 2)
@@ -0,0 +1,8 @@
1+#ifndef __PSP2CH_FORM_H__
2+#define __PSP2CH_FORM_H__
3+
4+
5+void psp2chUrlEncode(char* dst, char* src);
6+int psp2chForm(char* host, char* dir, int dat, char* subject, char* message);
7+
8+#endif
Added: svn:executable
--- trunc/src/Makefile (nonexistent)
+++ trunc/src/Makefile (revision 2)
@@ -0,0 +1,23 @@
1+TARGET = owata
2+OBJS = cp932.o intraFont.o main.o pg.o psp2ch.o psp2chFavorite.o psp2chSearch.o \
3+psp2chImageView.o psp2chIta.o psp2chRes.o psp2chThread.o psp2chForm.o pspdialogs.o \
4+libCat/Cat_Network.o libCat/Cat_Resolver.o
5+
6+INCDIR =
7+CFLAGS = -G0 -Wall -O2
8+CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
9+ASFLAGS = $(CFLAGS)
10+
11+LIBDIR =
12+LDFLAGS =
13+BUILD_PRX = 1
14+PSP_FW_VERSION=352
15+LIBS= -lpsppower -lpspgu -lpspwlan -ljpeg -lpng -lz -lm
16+
17+EXTRA_TARGETS = EBOOT.PBP
18+PSP_EBOOT_TITLE = 人生オワタ\(^o^)/
19+PSP_EBOOT_ICON = icon.png
20+
21+PSPSDK=$(shell psp-config --pspsdk-path)
22+include $(PSPSDK)/lib/build.mak
23+
Added: svn:executable
--- trunc/src/psp2chImageView.c (nonexistent)
+++ trunc/src/psp2chImageView.c (revision 2)
@@ -0,0 +1,358 @@
1+
2+#include "pspdialogs.h"
3+#include <stdio.h>
4+#include <malloc.h>
5+#include <jpeglib.h>
6+#include <png.h>
7+#include <pspctrl.h>
8+#include <pspdebug.h>
9+#include <pspgu.h>
10+#include "psp2ch.h"
11+#include "pg.h"
12+#include "psp2chImageView.h"
13+
14+extern int running; //main.c
15+extern void* framebuffer; // pg.c
16+extern unsigned int list[BUF_WIDTH*BUF_HEIGHT]; // pg.c
17+extern unsigned int pixels[BUF_WIDTH*BUF_HEIGHT]; // pg.c
18+extern int preLine;
19+
20+void psp2chImageViewJpeg(char* fname)
21+{
22+ FILE* infile;
23+ JSAMPARRAY img;
24+ JSAMPROW buf, imgbuf, tmp;
25+ int width;
26+ int height;
27+ int i;
28+ struct jpeg_decompress_struct cinfo;
29+ struct jpeg_error_mgr jerr;
30+ unsigned char header[4];
31+
32+ infile = fopen(fname, "rb" );
33+ if (!infile)
34+ {
35+ return;
36+ }
37+ // 一応ヘッダのチェック
38+ fread(header, 1, 2, infile);
39+ fseek(infile, 0, SEEK_SET);
40+ if (header[0] != 0xFF || header[1] != 0xD8)
41+ {
42+ fclose(infile);
43+ return;
44+ }
45+ cinfo.err = jpeg_std_error(&jerr);
46+ jpeg_create_decompress(&cinfo);
47+ jpeg_stdio_src(&cinfo, infile);
48+ jpeg_read_header(&cinfo, TRUE);
49+ jpeg_start_decompress(&cinfo);
50+ if (cinfo.out_color_components != 3)
51+ {
52+ jpeg_finish_decompress(&cinfo);
53+ jpeg_destroy_decompress(&cinfo);
54+ fclose(infile);
55+ return;
56+ }
57+ width = cinfo.output_width;
58+ height = cinfo.output_height;
59+ img = (JSAMPARRAY)malloc(sizeof(JSAMPROW) * height);
60+ if (!img)
61+ {
62+ fclose(infile);
63+ return;
64+ }
65+ imgbuf = (JSAMPROW)calloc(sizeof(JSAMPLE), 4 * width * height + 16);
66+ if (!imgbuf)
67+ {
68+ free(img);
69+ fclose(infile);
70+ return;
71+ }
72+ buf = (JSAMPROW)calloc(sizeof(JSAMPLE), 3 * width);
73+ if (!buf)
74+ {
75+ free(imgbuf);
76+ free(img);
77+ fclose(infile);
78+ return;
79+ }
80+ tmp = imgbuf;
81+ while (((int)tmp & 0xF) != 0)
82+ {
83+ tmp++;
84+ }
85+ for (i = 0; i < height; i++ )
86+ {
87+ img[i] = &tmp[i * width * 4];
88+ }
89+ while(cinfo.output_scanline < cinfo.output_height)
90+ {
91+ jpeg_read_scanlines(&cinfo, &buf, 1);
92+ for (i = 0; i < width; i++)
93+ {
94+ img[cinfo.output_scanline-1][i * 4 + 0] = buf[i * 3 + 0];
95+ img[cinfo.output_scanline-1][i * 4 + 1] = buf[i * 3 + 1];
96+ img[cinfo.output_scanline-1][i * 4 + 2] = buf[i * 3 + 2];
97+ img[cinfo.output_scanline-1][i * 4 + 3] = 0xFF;
98+ }
99+ }
100+ free(buf);
101+ jpeg_finish_decompress(&cinfo);
102+ jpeg_destroy_decompress(&cinfo);
103+ fclose(infile);
104+ psp2chImageViewer((int**)img, width, height);
105+ free(imgbuf);
106+ free(img);
107+ preLine = -2;
108+}
109+
110+void psp2chImageViewPng(char* fname)
111+{
112+ FILE* infile;
113+ png_structp png_ptr;
114+ png_infop info_ptr;
115+ unsigned long width, height;
116+ int bit_depth, color_type, interlace_type;
117+ png_bytepp img;
118+ png_bytep imgbuf;
119+ int i;
120+ unsigned char header[8];
121+
122+ infile = fopen(fname, "rb");
123+ if (!infile)
124+ {
125+ return;
126+ }
127+ fread(header, 1, 8, infile);
128+ fseek(infile, 0, SEEK_SET);
129+ if (png_sig_cmp(header, 0, 8))
130+ {
131+ fclose(infile);
132+ return;
133+ }
134+ png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
135+ info_ptr = png_create_info_struct(png_ptr);
136+ png_init_io(png_ptr, infile);
137+ png_read_info(png_ptr, info_ptr);
138+ png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, NULL, NULL);
139+ //パレット系->RGB系に拡張
140+ if (color_type == PNG_COLOR_TYPE_PALETTE ||
141+ (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) ||
142+ png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
143+ {
144+ png_set_expand(png_ptr);
145+ }
146+ //16ビット->8ビットに落とす
147+ if (bit_depth == 16)
148+ {
149+ png_set_strip_16(png_ptr);
150+ }
151+ //グレースケール->RGBに拡張
152+ if (color_type==PNG_COLOR_TYPE_GRAY ||
153+ color_type==PNG_COLOR_TYPE_GRAY_ALPHA)
154+ {
155+ png_set_gray_to_rgb(png_ptr);
156+ }
157+ if (color_type != PNG_COLOR_TYPE_RGB_ALPHA)
158+ {
159+ png_set_add_alpha(png_ptr, 0xFFFF, PNG_FILLER_AFTER);
160+ }
161+ png_read_update_info(png_ptr, info_ptr);
162+ img = (png_bytepp)malloc(height * sizeof(png_bytep));
163+ imgbuf = (png_bytep)malloc(png_get_rowbytes(png_ptr, info_ptr) * width);
164+ for (i = 0; i < height; i++)
165+ {
166+ img[i] = &imgbuf[i * width * 4];
167+ }
168+ png_read_image(png_ptr, img);
169+ png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
170+ fclose(infile);
171+ psp2chImageViewer((int**)img, (int)width, (int)height);
172+ free(imgbuf);
173+ free(img);
174+ preLine = -2;
175+}
176+
177+struct Vertex
178+{
179+ unsigned short u, v;
180+ unsigned short color;
181+ short x, y, z;
182+};
183+void psp2chBitBlt(int sx, int sy, int sw, int sh, int dx, int dy)
184+{
185+ struct Vertex* vertices = (struct Vertex*)sceGuGetMemory(2 * sizeof(struct Vertex));
186+
187+ vertices[0].u = sx; vertices[0].v = sy;
188+ vertices[0].color = 0;
189+ vertices[0].x = dx; vertices[0].y = dy; vertices[0].z = 0;
190+
191+ vertices[1].u = sx+sw; vertices[1].v = sy+sh;
192+ vertices[1].color = 0;
193+ vertices[1].x = dx+sw; vertices[1].y = dy+sh; vertices[1].z = 0;
194+
195+ sceGuDrawArray(GU_SPRITES,GU_TEXTURE_16BIT|GU_COLOR_4444|GU_VERTEX_16BIT|GU_TRANSFORM_2D,2,0,vertices);
196+}
197+
198+void psp2chImageViewer(int* img[], int width, int height)
199+{
200+ int i, j, w, h, startX, startY;
201+ SceCtrlData pad;
202+ SceCtrlData oldPad;
203+ unsigned int* vptr0;
204+ unsigned int* vptr;
205+ int thumb;
206+ int thumbFlag = 0;
207+ int menu = 1;
208+ int padX, padY;
209+
210+ thumb = (width/SCR_WIDTH > height/SCR_HEIGHT) ? width/SCR_WIDTH : height/SCR_HEIGHT;
211+ thumb++;
212+ startX = 0;
213+ startY = 0;
214+ sceCtrlPeekBufferPositive(&oldPad, 1);
215+ while (running)
216+ {
217+ if(sceCtrlPeekBufferPositive(&pad, 1))
218+ {
219+ if (pad.Buttons != oldPad.Buttons)
220+ {
221+ oldPad = pad;
222+ if(pad.Buttons & PSP_CTRL_CIRCLE && thumb > 1)
223+ {
224+ thumbFlag = thumbFlag ? 0 : 1;
225+ startX = 0;
226+ startY = 0;
227+ }
228+ else if(pad.Buttons & PSP_CTRL_CROSS)
229+ {
230+ break;
231+ }
232+ else if(pad.Buttons & PSP_CTRL_TRIANGLE)
233+ {
234+ menu = menu ? 0 : 1;
235+ }
236+ }
237+ if(pad.Buttons & PSP_CTRL_UP)
238+ {
239+ startY--;
240+ }
241+ if(pad.Buttons & PSP_CTRL_DOWN)
242+ {
243+ startY++;
244+ }
245+ if(pad.Buttons & PSP_CTRL_LEFT)
246+ {
247+ startX--;
248+ }
249+ if(pad.Buttons & PSP_CTRL_RIGHT)
250+ {
251+ startX++;
252+ }
253+ padX = pad.Lx - 127;
254+ padY = pad.Ly - 127;
255+ if ((padX < -PAD_CUTOFF) || (padX > PAD_CUTOFF))
256+ {
257+ startX += (padX)/4;
258+ }
259+ if ((padY < -PAD_CUTOFF) || (padY > PAD_CUTOFF))
260+ {
261+ startY += (padY)/4;
262+ }
263+ if (startX >= width - SCR_WIDTH)
264+ {
265+ startX = width - SCR_WIDTH;
266+ }
267+ if (startY >= height - SCR_HEIGHT)
268+ {
269+ startY = height - SCR_HEIGHT;
270+ }
271+ if (startX < 0)
272+ {
273+ startX = 0;
274+ }
275+ if (startY < 0)
276+ {
277+ startY = 0;
278+ }
279+ }
280+ if (thumbFlag)
281+ {
282+ vptr0 = framebuffer + 0x04000000;
283+ for (i = 0, h = 0;i < height && h < height && h < SCR_HEIGHT; i += thumb)
284+ {
285+ vptr = vptr0;
286+ for (j = 0, w = 0;j < width && w < width && w < SCR_WIDTH; j += thumb)
287+ {
288+ *vptr++ = img[i][j];
289+ w++;
290+ }
291+ for (; w < SCR_WIDTH; w++)
292+ {
293+ *vptr++ = GRAY;
294+ }
295+ vptr0 += BUF_WIDTH;
296+ h++;
297+ }
298+ for (; h < SCR_HEIGHT; h++)
299+ {
300+ vptr = vptr0;
301+ for (i = 0; i < SCR_WIDTH; i++)
302+ {
303+ *vptr++ = GRAY;
304+ }
305+ vptr0 += BUF_WIDTH;
306+ }
307+ }
308+ else
309+ {
310+ /*
311+ sceGuStart(GU_DIRECT,list);
312+ sceGuCopyImage(GU_PSM_8888,startX,startY,width,height,width,img[0],0,0,width,(void*)(0x04000000+(u32)framebuffer));
313+ sceGuTexSync();
314+ sceGuFinish();
315+ sceGuSync(0,0);
316+ */
317+ vptr0 = framebuffer + 0x04000000;
318+ for (i = 0, h = 0; h < height && h < SCR_HEIGHT; i++)
319+ {
320+ if (i < startY)
321+ {
322+ continue;
323+ }
324+ vptr = vptr0;
325+ for (j = 0, w = 0; w < width && w < SCR_WIDTH; j++)
326+ {
327+ if (j < startX)
328+ {
329+ continue;
330+ }
331+ *vptr++ = img[i][j];
332+ w++;
333+ }
334+ for (; w < SCR_WIDTH; w++)
335+ {
336+ *vptr++ = GRAY;
337+ }
338+ vptr0 += BUF_WIDTH;
339+ h++;
340+ }
341+ for (; h < SCR_HEIGHT; h++)
342+ {
343+ vptr = vptr0;
344+ for (i = 0; i < SCR_WIDTH; i++)
345+ {
346+ *vptr++ = GRAY;
347+ }
348+ vptr0 += BUF_WIDTH;
349+ }
350+ }
351+ if (menu)
352+ {
353+ pgMenuBar(" ○ : 拡大縮小   × : 戻る   △ : メニューオン・オフ   ");
354+ }
355+ sceDisplayWaitVblankStart();
356+ framebuffer = sceGuSwapBuffers();
357+ }
358+}
Added: svn:executable
--- trunc/src/psp2chIta.c (nonexistent)
+++ trunc/src/psp2chIta.c (revision 2)
@@ -0,0 +1,572 @@
1+
2+#include "pspdialogs.h"
3+#include <stdio.h>
4+#include <malloc.h>
5+#include <time.h>
6+#include <pspdebug.h>
7+#include <pspctrl.h>
8+#include "psp2chIta.h"
9+#include "psp2chThread.h"
10+#include "psp2chFavorite.h"
11+#include "utf8.h"
12+#include "pg.h"
13+
14+extern int running; //main.c
15+extern char cwDir[256]; //main.c
16+extern char* logDir; // psp2ch.c
17+extern int sel; // psp2ch.c
18+extern int tateFlag; // psp2ch.c
19+extern SceCtrlData pad; // psp2ch.c
20+extern SceCtrlData oldPad; // psp2ch.c
21+extern MESSAGE_HELPER mh; // psp2ch.c
22+extern S_2CH_THREAD* threadList; // psp2chThread.c
23+extern S_2CH_SCREEN thread; // psp2chThread.c
24+extern unsigned long pgCursorX, pgCursorY; // pg.c
25+extern void* framebuffer; // pg.c
26+extern S_2CH_ITA_COLOR cateOnColor; // psp2ch.c
27+extern S_2CH_ITA_COLOR cateOffColor; // psp2ch.c
28+extern S_2CH_FAVORITE* findList; // psp2chSearch.c
29+extern char keyWords[128]; // psp2chThread.c
30+
31+static const char* boardFile = "2channel.brd";
32+S_2CH_ITA* itaList = NULL;
33+S_2CH_CATEGORY* categoryList = NULL;
34+S_2CH_SCREEN ita;
35+S_2CH_SCREEN category;
36+
37+/**********************
38+ カテゴリーと板一覧表示
39+**********************/
40+int psp2chIta(void)
41+{
42+ int ret;
43+ static int focus = 0, end = 0;
44+ static char* menuStr = "";
45+ int rMenu;
46+
47+ if (itaList == NULL)
48+ {
49+ ret = psp2chItaList();
50+ if (ret < 0)
51+ {
52+ sel = 0;
53+ return ret;
54+ }
55+ end = ita.count;
56+ }
57+ if(sceCtrlPeekBufferPositive(&pad, 1))
58+ {
59+
60+ if (focus)
61+ {
62+ if (category.select < (category.count - 1))
63+ {
64+ ita.count = categoryList[category.select + 1].itaId;
65+ }
66+ else
67+ {
68+ ita.count = end;
69+ }
70+ rMenu = psp2chCursorSet(&ita);
71+ if (ita.start < categoryList[category.select].itaId)
72+ {
73+ ita.start = categoryList[category.select].itaId;
74+ ita.select = categoryList[category.select].itaId;
75+ }
76+ psp2chDrawCategory(category.start, category.select, cateOffColor);
77+ psp2chDrawIta(ita.start, ita.select, cateOffColor);
78+ if (rMenu)
79+ {
80+ menuStr = " ↑ : 先頭   ↓ : 最後   □ : 全板検索";
81+ }
82+ else
83+ {
84+ menuStr = " ○ : 決定    × : 戻る    □ : お気に入り   △ : 更新     R : メニュー切替";
85+ }
86+ }
87+ else
88+ {
89+ rMenu = psp2chCursorSet(&category);
90+ ita.start = categoryList[category.select].itaId;
91+ ita.select = categoryList[category.select].itaId;
92+ psp2chDrawCategory(category.start, category.select, cateOnColor);
93+ psp2chDrawIta(ita.start, ita.select, cateOnColor);
94+ if (rMenu)
95+ {
96+ menuStr = " ↑ : 先頭   ↓ : 最後   □ : 全板検索";
97+ }
98+ else
99+ {
100+ menuStr = " ○ : 決定    × : 終了    □ : お気に入り   △ : 更新     R : メニュー切替";
101+ }
102+ }
103+ if (pad.Buttons != oldPad.Buttons)
104+ {
105+ oldPad = pad;
106+ if (pad.Buttons & PSP_CTRL_SELECT)
107+ {
108+ tateFlag = (tateFlag) ? 0 : 1;
109+ }
110+ else if(pad.Buttons & PSP_CTRL_CIRCLE)
111+ {
112+ if (rMenu)
113+ {
114+ }
115+ else
116+ {
117+ if (focus)
118+ {
119+ if (threadList)
120+ {
121+ free(threadList);
122+ threadList = NULL;
123+ }
124+ thread.start = 0;
125+ thread.select = 0;
126+ pgFillvram(WHITE, 0, 0, SCR_WIDTH, BUF_HEIGHT);
127+ sel = 3;
128+ return 0;
129+ }
130+ else
131+ {
132+ focus = 1;
133+ }
134+ }
135+ }
136+ else if(pad.Buttons & PSP_CTRL_CROSS)
137+ {
138+ if (rMenu)
139+ {
140+ }
141+ else
142+ {
143+ if (focus)
144+ {
145+ focus = 0;
146+ }
147+ else
148+ {
149+ if (psp2chOwata())
150+ {
151+ return 0;
152+ }
153+ }
154+ }
155+ }
156+ else if(pad.Buttons & PSP_CTRL_TRIANGLE)
157+ {
158+ if (rMenu)
159+ {
160+ }
161+ else
162+ {
163+ psp2chGetMenu();
164+ psp2chItaList();
165+ category.start = 0;
166+ category.select = 0;
167+ ita.start = 0;
168+ ita.select = 0;
169+ focus = 0;
170+ }
171+ }
172+ else if(pad.Buttons & PSP_CTRL_SQUARE)
173+ {
174+ if (rMenu)
175+ {
176+ if (psp2chThreadSearch() == 0 && keyWords[0])
177+ {
178+ if (findList)
179+ {
180+ free(findList);
181+ findList = NULL;
182+ }
183+ sel = 7;
184+ }
185+ }
186+ else
187+ {
188+ sel = 1;
189+ }
190+ }
191+ }
192+ pgCopy(0, 0);
193+ pgMenuBar(menuStr);
194+ sceDisplayWaitVblankStart();
195+ framebuffer = sceGuSwapBuffers();
196+ }
197+ return 0;
198+}
199+
200+/**********************
201+初回アクセス時等で2channel.brdがない場合psp2chGetMenu()で2channel.brdを作成
202+2channel.brdを読み込んで categoryListとitaList構造体のメモリ確保とデータ作成を行う
203+category.countとita.countに総数
204+**********************/
205+int psp2chItaList(void)
206+{
207+ SceUID fd;
208+ SceIoStat st;
209+ char file[256];
210+ char *buf, *p, *q;
211+ int i, cateOn;
212+
213+ sprintf(file, "%s/%s/%s", cwDir, logDir, boardFile);
214+ i = sceIoGetstat(file, &st);
215+ if (i < 0)
216+ {
217+ psp2chGetMenu();
218+ i = sceIoGetstat(file, &st);
219+ if (i< 0)
220+ {
221+ memset(&mh,0,sizeof(MESSAGE_HELPER));
222+ sprintf(mh.message, "File stat error\n%s", file);
223+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
224+ sceCtrlPeekBufferPositive(&oldPad, 1);
225+ return -1;
226+ }
227+ }
228+ buf = (char*)malloc(st.st_size + 1);
229+ if (buf == NULL)
230+ {
231+ memset(&mh,0,sizeof(MESSAGE_HELPER));
232+ strcpy(mh.message, "memorry error\npsp2chItaList() buf");
233+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
234+ sceCtrlPeekBufferPositive(&oldPad, 1);
235+ return -1;
236+ }
237+ fd = sceIoOpen(file, PSP_O_RDONLY, 0777);
238+ if (fd < 0)
239+ {
240+ free(buf);
241+ memset(&mh,0,sizeof(MESSAGE_HELPER));
242+ sprintf(mh.message, "File open error\n%s", file);
243+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
244+ sceCtrlPeekBufferPositive(&oldPad, 1);
245+ return -1;
246+ }
247+ sceIoRead(fd, buf, st.st_size);
248+ sceIoClose(fd);
249+ buf[st.st_size] = '\0';
250+ category.count = 0;
251+ ita.count = 0;
252+ p = buf;
253+ while (*p)
254+ {
255+ if (*p == '\t')
256+ {
257+ ita.count++;
258+ }
259+ else
260+ {
261+ category.count++;
262+ }
263+ while (*p++ != '\n')
264+ {
265+ ;
266+ }
267+ }
268+ categoryList = (S_2CH_CATEGORY*)realloc(categoryList, sizeof(S_2CH_CATEGORY) * category.count);
269+ if (categoryList == NULL)
270+ {
271+ free(buf);
272+ memset(&mh,0,sizeof(MESSAGE_HELPER));
273+ strcpy(mh.message, "memorry error\ncategoryList");
274+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
275+ sceCtrlPeekBufferPositive(&oldPad, 1);
276+ return -1;
277+ }
278+ itaList = (S_2CH_ITA*)realloc(itaList, sizeof(S_2CH_ITA) * ita.count);
279+ if (itaList == NULL)
280+ {
281+ free(buf);
282+ memset(&mh,0,sizeof(MESSAGE_HELPER));
283+ strcpy(mh.message, "memorry error\nitaList");
284+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
285+ sceCtrlPeekBufferPositive(&oldPad, 1);
286+ return -1;
287+ }
288+ category.count = 0;
289+ ita.count = 0;
290+ cateOn = 0;
291+ p = buf;
292+ q = buf;
293+ while(*q)
294+ {
295+ if (*q == '\t')
296+ {
297+ q++;
298+ p = q;
299+ q = strchr(p, '\t');
300+ *q = '\0';
301+ strcpy(itaList[ita.count].host, p);
302+ q++;
303+ p = q;
304+ q = strchr(p, '\t');
305+ *q = '\0';
306+ strcpy(itaList[ita.count].dir, p);
307+ q++;
308+ p = q;
309+ q = strchr(p, '\n');
310+ *q = '\0';
311+ strcpy(itaList[ita.count].title, p);
312+ if (cateOn)
313+ {
314+ categoryList[category.count - 1].itaId = ita.count;
315+ cateOn = 0;
316+ }
317+ ita.count++;
318+ q++;
319+ }
320+ else
321+ {
322+ p = q;
323+ q = strchr(p, '\t');
324+ *q = '\0';
325+ strcpy(categoryList[category.count].name, p);
326+ category.count++;
327+ cateOn = 1;
328+ q++;
329+ p = q;
330+ q = strchr(p, '\n');
331+ q++;
332+ }
333+ }
334+ free(buf);
335+ return 0;
336+}
337+
338+/**********************
339+2channel.brdを作成
340+**********************/
341+int psp2chGetMenu(void)
342+{
343+ const char* menuHost = "menu.2ch.net";
344+ const char* path = "bbsmenu.html";
345+ const char* menustart = "<BR><BR><B>";
346+ const char* menuend = "</B>";
347+ const char* itastart = "<A HREF=";
348+ const char* hostend = "/";
349+ const char* dirend = "/>";
350+ const char* titleend = "</A>";
351+ const char* ita2chnet = "2ch.net";
352+ const char* itabbspink = "bbspink.com";
353+ HTTP_HEADERS resHeader;
354+ SceUID fd;
355+ int contentLength, ret, mySocket, len, menuOn;
356+ char buf[256];
357+ char menu[32];
358+ char itahost[32];
359+ char itadir[32];
360+ char *p, *line;
361+
362+ mySocket = psp2chRequest(menuHost, path, "");
363+ if (mySocket < 0)
364+ {
365+ return mySocket;
366+ }
367+ ret = psp2chGetStatusLine(mySocket);
368+ switch(ret)
369+ {
370+ case 200:
371+ break;
372+ default:
373+ memset(&mh,0,sizeof(MESSAGE_HELPER));
374+ sprintf(mh.message, "HTTP error\nStatus code %d", ret);
375+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
376+ sceCtrlPeekBufferPositive(&oldPad, 1);
377+ psp2chCloseSocket(mySocket);
378+ return -1;
379+ }
380+ contentLength = psp2chGetHttpHeaders(mySocket, &resHeader);
381+ if (contentLength <= 0)
382+ {
383+ psp2chCloseSocket(mySocket);
384+ return -1;
385+ }
386+ sprintf(buf, "%s/%s", cwDir, logDir);
387+ if ((fd = sceIoDopen(buf)) < 0)
388+ {
389+ if (sceIoMkdir(buf, 0777) < 0)
390+ {
391+ memset(&mh,0,sizeof(MESSAGE_HELPER));
392+ sprintf(mh.message, "Make dir error\n%s", buf);
393+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
394+ sceCtrlPeekBufferPositive(&oldPad, 1);
395+ }
396+ }
397+ else
398+ {
399+ sceIoDclose(fd);
400+ }
401+ strcat(buf, "/");
402+ strcat(buf, boardFile);
403+ fd = sceIoOpen(buf, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
404+ if (fd < 0)
405+ {
406+ psp2chCloseSocket(mySocket);
407+ memset(&mh,0,sizeof(MESSAGE_HELPER));
408+ sprintf(mh.message, "File open error\n%s", buf);
409+ pspShowMessageDialog(&mh, DIALOG_LANGUAGE_AUTO);
410+ sceCtrlPeekBufferPositive(&oldPad, 1);
411+ return fd;
412+ }
413+ menuOn = 0;
414+ sprintf(buf, "http://%s/%s からデータを転送しています...", menuHost, path);
415+ pgMenuBar(buf);
416+ sceDisplayWaitVblankStart();
417+ framebuffer = sceGuSwapBuffers();
418+ while((recv(mySocket, buf, 1, 0)) > 0)
419+ {
420+ len = 0;
421+ while (buf[len] != '\n')
422+ {
423+ len++;
424+ if (recv(mySocket, &buf[len], 1, 0) == 0)
425+ {
426+ break;
427+ }
428+ }
429+ buf[len] = '\0';
430+ if (strstr(buf, menustart) == buf && (p = strstr(buf, menuend)) != NULL)
431+ {
432+ *p = '\0';
433+ sprintf(menu, "%s\t0\n", &buf[11]);
434+ menuOn = 1;
435+ }
436+ else if (menuOn)
437+ {
438+ if (strstr(buf, itastart) != buf)
439+ {
440+ menuOn = 0;
441+ continue;
442+ }
443+ if (strstr(buf, ita2chnet) == NULL && strstr(buf, itabbspink) == NULL)
444+ {
445+ continue;
446+ }
447+ line = buf + 15;
448+ if ((p = strstr(line, hostend)) == NULL)
449+ {
450+ continue;
451+ }
452+ *p = '\0';
453+ strcpy(itahost, line);
454+ line = p + 1;
455+ if ((p = strstr(line, dirend)) == NULL)
456+ {
457+ continue;
458+ }
459+ *p = '\0';
460+ strcpy(itadir, line);
461+ line = p + 2;
462+ if ((p = strstr(line, titleend)) == NULL)
463+ {
464+ continue;
465+ }
466+ *p = '\0';
467+ if (menuOn == 1)
468+ {
469+ sceIoWrite(fd, menu, strlen(menu));
470+ menuOn = 2;
471+ }
472+ sprintf(buf, "\t%s\t%s\t%s\n", itahost, itadir, line);
473+ sceIoWrite(fd, buf, strlen(buf));
474+ }
475+ }
476+ sceIoClose(fd);
477+ psp2chCloseSocket(mySocket);
478+ return 0;
479+}
480+
481+/**********************
482+カテゴリー一覧を表示
483+start: 表示開始位置
484+select: 選択位置
485+**********************/
486+void psp2chDrawCategory(int start, int select, S_2CH_ITA_COLOR c)
487+{
488+ int i;
489+ int lineEnd, scrW, scrH;
490+
491+ if (tateFlag)
492+ {
493+ lineEnd = 35;
494+ scrW = SCR_HEIGHT;
495+ scrH = SCR_WIDTH;
496+ }
497+ else
498+ {
499+ lineEnd = 20;
500+ scrW = SCR_WIDTH;
501+ scrH = SCR_HEIGHT;
502+ }
503+ if (start + lineEnd > category.count)
504+ {
505+ start = category.count - lineEnd;
506+ }
507+ pgFillvram(c.cate.bg, 0, 0, 90, scrH);
508+ pgCursorY = 0;
509+ for (i = start; i < start + lineEnd; i++)
510+ {
511+ pgCursorX = 10;
512+ if (i == select)
513+ {
514+ pgPrint(categoryList[i].name, c.cate.s_text, c.cate.s_bg, scrW);
515+ }
516+ else
517+ {
518+ pgPrint(categoryList[i].name, c.cate.text, c.cate.bg, scrW);
519+ }
520+ pgCursorY += LINE_PITCH;
521+ }
522+}
523+
524+/**********************
525+板一覧を表示
526+**********************/
527+void psp2chDrawIta(int start, int select, S_2CH_ITA_COLOR c)
528+{
529+ int i, end;
530+ int lineEnd, scrW, scrH;
531+
532+ if (tateFlag)
533+ {
534+ lineEnd = 35;
535+ scrW = SCR_HEIGHT;
536+ scrH = SCR_WIDTH;
537+ }
538+ else
539+ {
540+ lineEnd = 20;
541+ scrW = SCR_WIDTH;
542+ scrH = SCR_HEIGHT;
543+ }
544+ if (category.select < (category.count - 1))
545+ {
546+ end = categoryList[category.select + 1].itaId;
547+ }
548+ else
549+ {
550+ end = ita.count;
551+ }
552+ if (start + lineEnd < end)
553+ {
554+ end = start + lineEnd;
555+ }
556+ pgFillvram(c.ita.bg, 90, 0, 100, scrH);
557+ pgFillvram(c.base, 190, 0, scrW-190, scrH);
558+ pgCursorY = 0;
559+ for (i = start; i < end; i++)
560+ {
561+ pgCursorX = 100;
562+ if (i == select)
563+ {
564+ pgPrint(itaList[i].title, c.ita.s_text, c.ita.s_bg, scrW);
565+ }
566+ else
567+ {
568+ pgPrint(itaList[i].title, c.ita.text, c.ita.bg, scrW);
569+ }
570+ pgCursorY += LINE_PITCH;
571+ }
572+}
Added: svn:executable
--- trunc/src/cp932.c (nonexistent)
+++ trunc/src/cp932.c (revision 2)
@@ -0,0 +1,261 @@
1+/*
2+ * "streamable kanji code filter and converter"
3+ * Copyright (c) 1998-2002 HappySize, Inc. All rights reserved.
4+ *
5+ * LICENSE NOTICES
6+ *
7+ * This file is part of "streamable kanji code filter and converter",
8+ * which is distributed under the terms of GNU Lesser General Public
9+ * License (version 2) as published by the Free Software Foundation.
10+ *
11+ * This software is distributed in the hope that it will be useful,
12+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+ * GNU Lesser General Public License for more details.
15+ *
16+ * You should have received a copy of the GNU Lesser General Public
17+ * License along with "streamable kanji code filter and converter";
18+ * if not, write to the Free Software Foundation, Inc., 59 Temple Place,
19+ * Suite 330, Boston, MA 02111-1307 USA
20+ *
21+ * The author of this file:
22+ *
23+ */
24+/*
25+ * the source code included in this files was separated from mbfilter_ja.c
26+ * by moriyoshi koizumi <moriyoshi@php.net> on 4 dec 2002.
27+ *
28+ */
29+
30+#include "unicode_table_cp932_ext.h"
31+#include "unicode_table_jis.h"
32+
33+#define MBFL_WCSPLANE_MASK 0xffff
34+#define MBFL_WCSPLANE_JIS0208 0x70e10000 /* JIS HEX : 2121h - 7E7Eh */
35+#define MBFL_WCSPLANE_JIS0212 0x70e20000 /* JIS HEX : 2121h - 7E7Eh */
36+#define MBFL_WCSPLANE_WINCP932 0x70e30000 /* JIS HEX : 2121h - 9898h */
37+#define MBFL_WCSGROUP_MASK 0xffffff
38+#define MBFL_WCSGROUP_THROUGH 0x78000000 /* 000000h - FFFFFFh */
39+
40+#define SJIS_ENCODE(c1,c2,s1,s2) \
41+ do { \
42+ s1 = c1; \
43+ s1--; \
44+ s1 >>= 1; \
45+ if ((c1) < 0x5f) { \
46+ s1 += 0x71; \
47+ } else { \
48+ s1 += 0xb1; \
49+ } \
50+ s2 = c2; \
51+ if ((c1) & 1) { \
52+ if ((c2) < 0x60) { \
53+ s2--; \
54+ } \
55+ s2 += 0x20; \
56+ } else { \
57+ s2 += 0x7e; \
58+ } \
59+ } while (0)
60+
61+#define SJIS_DECODE(c1,c2,s1,s2) \
62+ do { \
63+ s1 = c1; \
64+ if (s1 < 0xa0) { \
65+ s1 -= 0x81; \
66+ } else { \
67+ s1 -= 0xc1; \
68+ } \
69+ s1 <<= 1; \
70+ s1 += 0x21; \
71+ s2 = c2; \
72+ if (s2 < 0x9f) { \
73+ if (s2 < 0x7f) { \
74+ s2++; \
75+ } \
76+ s2 -= 0x20; \
77+ } else { \
78+ s1++; \
79+ s2 -= 0x7e; \
80+ } \
81+ } while (0)
82+
83+/*
84+ * SJIS-win => wchar
85+ */
86+int conv_sjiswin_wchar(int c)
87+{
88+ int c1, s, s1, s2, w = 0;
89+ static int status = 0;
90+ static int cache = 0;
91+
92+ switch (status) {
93+ case 0:
94+ if (c >= 0 && c < 0x80) { /* latin */
95+ w = c;
96+ } else if (c > 0xa0 && c < 0xe0) { /* kana */
97+ w = 0xfec0 + c;
98+ } else if (c > 0x80 && c < 0xfd && c != 0xa0) { /* kanji first char */
99+ status = 1;
100+ cache = c;
101+ w = -1;
102+ } else {
103+ w = c & MBFL_WCSGROUP_MASK;
104+ w |= MBFL_WCSGROUP_THROUGH;
105+ }
106+ break;
107+
108+ case 1: /* kanji second char */
109+ status = 0;
110+ c1 = cache;
111+ if (c > 0x39 && c < 0xfd && c != 0x7f) {
112+ w = 0;
113+ SJIS_DECODE(c1, c, s1, s2);
114+ s = (s1 - 0x21)*94 + s2 - 0x21;
115+ if (s <= 137) {
116+ if (s == 31) {
117+ w = 0xff3c; /* FULLWIDTH REVERSE SOLIDUS */
118+ } else if (s == 32) {
119+ w = 0xff5e; /* FULLWIDTH TILDE */
120+ } else if (s == 33) {
121+ w = 0x2225; /* PARALLEL TO */
122+ } else if (s == 60) {
123+ w = 0xff0d; /* FULLWIDTH HYPHEN-MINUS */
124+ } else if (s == 80) {
125+ w = 0xffe0; /* FULLWIDTH CENT SIGN */
126+ } else if (s == 81) {
127+ w = 0xffe1; /* FULLWIDTH POUND SIGN */
128+ } else if (s == 137) {
129+ w = 0xffe2; /* FULLWIDTH NOT SIGN */
130+ }
131+ }
132+ if (w == 0) {
133+ if (s >= cp932ext1_ucs_table_min && s < cp932ext1_ucs_table_max) { /* vendor ext1 (13ku) */
134+ w = cp932ext1_ucs_table[s - cp932ext1_ucs_table_min];
135+ } else if (s >= 0 && s < jisx0208_ucs_table_size) { /* X 0208 */
136+ w = jisx0208_ucs_table[s];
137+ } else if (s >= cp932ext2_ucs_table_min && s < cp932ext2_ucs_table_max) { /* vendor ext2 (89ku - 92ku) */
138+ w = cp932ext2_ucs_table[s - cp932ext2_ucs_table_min];
139+ } else if (s >= cp932ext3_ucs_table_min && s < cp932ext3_ucs_table_max) { /* vendor ext3 (115ku - 119ku) */
140+ w = cp932ext3_ucs_table[s - cp932ext3_ucs_table_min];
141+ } else if (s >= (94*94) && s < (114*94)) { /* user (95ku - 114ku) */
142+ w = s - (94*94) + 0xe000;
143+ }
144+ }
145+ if (w <= 0) {
146+ w = (s1 << 8) | s2;
147+ w &= MBFL_WCSPLANE_MASK;
148+ w |= MBFL_WCSPLANE_WINCP932;
149+ }
150+ } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
151+ w = c;
152+ } else {
153+ w = (c1 << 8) | c;
154+ w &= MBFL_WCSGROUP_MASK;
155+ w |= MBFL_WCSGROUP_THROUGH;
156+ }
157+ break;
158+
159+ default:
160+ status = 0;
161+ break;
162+ }
163+
164+ return w;
165+}
166+
167+/*
168+ * wchar => SJIS-win
169+ */
170+int conv_wchar_sjiswin(int c)
171+{
172+ int c1, c2, s1, s2;
173+
174+ s1 = 0;
175+ s2 = 0;
176+ if (c >= ucs_a1_jis_table_min && c < ucs_a1_jis_table_max) {
177+ s1 = ucs_a1_jis_table[c - ucs_a1_jis_table_min];
178+ } else if (c >= ucs_a2_jis_table_min && c < ucs_a2_jis_table_max) {
179+ s1 = ucs_a2_jis_table[c - ucs_a2_jis_table_min];
180+ } else if (c >= ucs_i_jis_table_min && c < ucs_i_jis_table_max) {
181+ s1 = ucs_i_jis_table[c - ucs_i_jis_table_min];
182+ } else if (c >= ucs_r_jis_table_min && c < ucs_r_jis_table_max) {
183+ s1 = ucs_r_jis_table[c - ucs_r_jis_table_min];
184+ } else if (c >= 0xe000 && c < (0xe000 + 20*94)) { /* user (95ku - 114ku) */
185+ s1 = c - 0xe000;
186+ c1 = s1/94 + 0x7f;
187+ c2 = s1%94 + 0x21;
188+ s1 = (c1 << 8) | c2;
189+ s2 = 1;
190+ }
191+ if (s1 <= 0) {
192+ c1 = c & ~MBFL_WCSPLANE_MASK;
193+ if (c1 == MBFL_WCSPLANE_WINCP932) {
194+ s1 = c & MBFL_WCSPLANE_MASK;
195+ s2 = 1;
196+ } else if (c1 == MBFL_WCSPLANE_JIS0208) {
197+ s1 = c & MBFL_WCSPLANE_MASK;
198+ } else if (c1 == MBFL_WCSPLANE_JIS0212) {
199+ s1 = c & MBFL_WCSPLANE_MASK;
200+ s1 |= 0x8080;
201+ } else if (c == 0xa5) { /* YEN SIGN */
202+ s1 = 0x216f; /* FULLWIDTH YEN SIGN */
203+ } else if (c == 0x203e) { /* OVER LINE */
204+ s1 = 0x2131; /* FULLWIDTH MACRON */
205+ } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
206+ s1 = 0x2140;
207+ } else if (c == 0xff5e) { /* FULLWIDTH TILDE */
208+ s1 = 0x2141;
209+ } else if (c == 0x2225) { /* PARALLEL TO */
210+ s1 = 0x2142;
211+ } else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */
212+ s1 = 0x215d;
213+ } else if (c == 0xffe0) { /* FULLWIDTH CENT SIGN */
214+ s1 = 0x2171;
215+ } else if (c == 0xffe1) { /* FULLWIDTH POUND SIGN */
216+ s1 = 0x2172;
217+ } else if (c == 0xffe2) { /* FULLWIDTH NOT SIGN */
218+ s1 = 0x224c;
219+ }
220+ }
221+ if ((s1 <= 0) || (s1 >= 0x8080 && s2 == 0)) { /* not found or X 0212 */
222+ s1 = -1;
223+ c1 = 0;
224+ c2 = cp932ext1_ucs_table_max - cp932ext1_ucs_table_min;
225+ while (c1 < c2) { /* CP932 vendor ext1 (13ku) */
226+ if (c == cp932ext1_ucs_table[c1]) {
227+ s1 = ((c1/94 + 0x2d) << 8) + (c1%94 + 0x21);
228+ break;
229+ }
230+ c1++;
231+ }
232+ if (s1 <= 0) {
233+ c1 = 0;
234+ c2 = cp932ext3_ucs_table_max - cp932ext3_ucs_table_min;
235+ while (c1 < c2) { /* CP932 vendor ext3 (115ku - 119ku) */
236+ if (c == cp932ext3_ucs_table[c1]) {
237+ s1 = ((c1/94 + 0x93) << 8) + (c1%94 + 0x21);
238+ break;
239+ }
240+ c1++;
241+ }
242+ }
243+ if (c == 0) {
244+ s1 = 0;
245+ } else if (s1 <= 0) {
246+ s1 = -1;
247+ }
248+ }
249+ if (s1 >= 0) {
250+ if (s1 < 0x100) { /* latin or kana */
251+ return s1;
252+ } else { /* kanji */
253+ c1 = (s1 >> 8) & 0xff;
254+ c2 = s1 & 0xff;
255+ SJIS_ENCODE(c1, c2, s1, s2);
256+ s1 |= (s2 << 8);
257+ return s1;
258+ }
259+ }
260+ return 0;
261+}
Added: svn:executable
--- trunc/src/psp2chImageView.h (nonexistent)
+++ trunc/src/psp2chImageView.h (revision 2)
@@ -0,0 +1,8 @@
1+#ifndef __PSP2CH_IMAGE_VIEW__
2+#define __PSP2CH_IMAGE_VIEW__
3+
4+void psp2chImageViewJpeg(char* fname);
5+void psp2chImageViewPng(char* fname);
6+void psp2chImageViewer(int* img[], int width, int height);
7+
8+#endif
Added: svn:executable
--- trunc/src/psp2chIta.h (nonexistent)
+++ trunc/src/psp2chIta.h (revision 2)
@@ -0,0 +1,23 @@
1+#ifndef __PSP2CH_ITA_H__
2+#define __PSP2CH_ITA_H__
3+
4+#include "psp2ch.h"
5+
6+typedef struct {
7+ char name[32];
8+ int itaId;
9+} S_2CH_CATEGORY;
10+
11+typedef struct {
12+ char host[32];
13+ char dir[32];
14+ char title[32];
15+} S_2CH_ITA;
16+
17+int psp2chIta(void);
18+int psp2chItaList(void);
19+int psp2chGetMenu(void);
20+void psp2chDrawCategory(int start, int select, S_2CH_ITA_COLOR color);
21+void psp2chDrawIta(int start, int select, S_2CH_ITA_COLOR color);
22+
23+#endif
Added: svn:executable
--- trunc/src/unicode_table_cp932_ext.h (nonexistent)
+++ trunc/src/unicode_table_cp932_ext.h (revision 2)
@@ -0,0 +1,170 @@
1+/*
2+ * "streamable kanji code filter and converter"
3+ * Copyright (c) 1998-2002 HappySize, Inc. All rights reserved.
4+ *
5+ * LICENSE NOTICES
6+ *
7+ * This file is part of "streamable kanji code filter and converter",
8+ * which is distributed under the terms of GNU Lesser General Public
9+ * License (version 2) as published by the Free Software Foundation.
10+ *
11+ * This software is distributed in the hope that it will be useful,
12+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+ * GNU Lesser General Public License for more details.
15+ *
16+ * You should have received a copy of the GNU Lesser General Public
17+ * License along with "streamable kanji code filter and converter";
18+ * if not, write to the Free Software Foundation, Inc., 59 Temple Place,
19+ * Suite 330, Boston, MA 02111-1307 USA
20+ *
21+ * The author of this file: Rui Hirokawa <hirokawa@php.net>
22+ *
23+ */
24+
25+#ifndef UNICODE_TABLE_CP932_EXT_H
26+#define UNICODE_TABLE_CP932_EXT_H
27+
28+static const unsigned short cp932ext1_ucs_table[] = {
29+ /* ku 13 */
30+ 0x2460,0x2461,0x2462,0x2463,0x2464,0x2465,0x2466,0x2467,
31+ 0x2468,0x2469,0x246A,0x246B,0x246C,0x246D,0x246E,0x246F,
32+ 0x2470,0x2471,0x2472,0x2473,0x2160,0x2161,0x2162,0x2163,
33+ 0x2164,0x2165,0x2166,0x2167,0x2168,0x2169,0x0000,0x3349,
34+ 0x3314,0x3322,0x334D,0x3318,0x3327,0x3303,0x3336,0x3351,
35+ 0x3357,0x330D,0x3326,0x3323,0x332B,0x334A,0x333B,0x339C,
36+ 0x339D,0x339E,0x338E,0x338F,0x33C4,0x33A1,0x0000,0x0000,
37+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x337B,0x301D,
38+ 0x301F,0x2116,0x33CD,0x2121,0x32A4,0x32A5,0x32A6,0x32A7,
39+ 0x32A8,0x3231,0x3232,0x3239,0x337E,0x337D,0x337C,0x2252,
40+ 0x2261,0x222B,0x222E,0x2211,0x221A,0x22A5,0x2220,0x221F,
41+ 0x22BF,0x2235,0x2229,0x222A,0x0000,0x0000
42+};
43+static const int cp932ext1_ucs_table_min = (13 - 1)*94;
44+static const int cp932ext1_ucs_table_max = (13 - 1)*94 + (sizeof (cp932ext1_ucs_table) / sizeof (unsigned short));
45+
46+static const unsigned short cp932ext2_ucs_table[] = {
47+ /* ku 89 */
48+ 0x7E8A,0x891C,0x9348,0x9288,0x84DC,0x4FC9,0x70BB,0x6631,
49+ 0x68C8,0x92F9,0x66FB,0x5F45,0x4E28,0x4EE1,0x4EFC,0x4F00,
50+ 0x4F03,0x4F39,0x4F56,0x4F92,0x4F8A,0x4F9A,0x4F94,0x4FCD,
51+ 0x5040,0x5022,0x4FFF,0x501E,0x5046,0x5070,0x5042,0x5094,
52+ 0x50F4,0x50D8,0x514A,0x5164,0x519D,0x51BE,0x51EC,0x5215,
53+ 0x529C,0x52A6,0x52C0,0x52DB,0x5300,0x5307,0x5324,0x5372,
54+ 0x5393,0x53B2,0x53DD,0xFA0E,0x549C,0x548A,0x54A9,0x54FF,
55+ 0x5586,0x5759,0x5765,0x57AC,0x57C8,0x57C7,0xFA0F,0xFA10,
56+ 0x589E,0x58B2,0x590B,0x5953,0x595B,0x595D,0x5963,0x59A4,
57+ 0x59BA,0x5B56,0x5BC0,0x752F,0x5BD8,0x5BEC,0x5C1E,0x5CA6,
58+ 0x5CBA,0x5CF5,0x5D27,0x5D53,0xFA11,0x5D42,0x5D6D,0x5DB8,
59+ 0x5DB9,0x5DD0,0x5F21,0x5F34,0x5F67,0x5FB7,
60+
61+ /* ku 90 */
62+ 0x5FDE,0x605D,0x6085,0x608A,0x60DE,0x60D5,0x6120,0x60F2,
63+ 0x6111,0x6137,0x6130,0x6198,0x6213,0x62A6,0x63F5,0x6460,
64+ 0x649D,0x64CE,0x654E,0x6600,0x6615,0x663B,0x6609,0x662E,
65+ 0x661E,0x6624,0x6665,0x6657,0x6659,0xFA12,0x6673,0x6699,
66+ 0x66A0,0x66B2,0x66BF,0x66FA,0x670E,0xF929,0x6766,0x67BB,
67+ 0x6852,0x67C0,0x6801,0x6844,0x68CF,0xFA13,0x6968,0xFA14,
68+ 0x6998,0x69E2,0x6A30,0x6A6B,0x6A46,0x6A73,0x6A7E,0x6AE2,
69+