• R/O
  • SSH
  • HTTPS

owata: Commit


Commit MetaInfo

Revision157 (tree)
Time2008-09-17 08:13:56
Authorbird_may_nike

Log Message

(empty log message)

Change Summary

Incremental Difference

--- trunc/src/psp2ch.c (revision 156)
+++ trunc/src/psp2ch.c (revision 157)
@@ -31,7 +31,7 @@
3131 extern RECT titleDstRectH; // pg.c
3232 extern RECT titleDstRectV; // pg.c
3333
34-char* ver = "0.8.4";
34+char* ver = "0.8.5";
3535 S_2CH s2ch;
3636 char keyWords[128];
3737
--- trunc/src/psp2chNet.c (revision 156)
+++ trunc/src/psp2chNet.c (revision 157)
@@ -364,7 +364,6 @@
364364 int psp2chRequest(const char* host, const char* path, const char* requestText, S_NET* net)
365365 {
366366 int ret;
367- char buf[512];
368367 struct in_addr addr;
369368
370369 ret = psp2chResolve(host, &addr);
@@ -371,21 +370,18 @@
371370 if (ret < 0) {
372371 return ret;
373372 }
373+ /*
374+ char buf[512];
374375 sprintf(buf, " %s (%s)", host, inet_ntoa(addr));
375376 pgPrintMenuBar(buf);
376377 pgCopyMenuBar();
377378 sceDisplayWaitVblankStart();
378379 framebuffer = sceGuSwapBuffers();
380+ */
379381 // Tell the socket to connect to the IP address we found, on port 80 (HTTP)
380382 sain.sin_family = AF_INET;
381383 sain.sin_port = htons(80);
382384 sain.sin_addr.s_addr = addr.s_addr;
383- sprintf(buf, " http://%s/%s に接続しています", host, path);
384- pgPrintMenuBar(buf);
385- pgWaitVn(5);
386- pgCopyMenuBar();
387- sceDisplayWaitVblankStart();
388- framebuffer = sceGuSwapBuffers();
389385 connectSleep = 0;
390386 sceKernelWakeupThread(connectThread);
391387 while (1)
@@ -405,11 +401,6 @@
405401 }
406402 sceKernelDelayThread(1000);
407403 }
408- pgPrintMenuBar("接続しました");
409- pgWaitVn(5);
410- pgCopyMenuBar();
411- sceDisplayWaitVblankStart();
412- framebuffer = sceGuSwapBuffers();
413404 // send our request
414405 send(mySocket, requestText, strlen(requestText), 0 );
415406 return 0;
@@ -424,7 +415,6 @@
424415
425416 sprintf(buf, "http://%s/%s からデータを転送しています...", host, path);
426417 pgPrintMenuBar(buf);
427- pgWaitVn(5);
428418 pgCopyMenuBar();
429419 sceDisplayWaitVblankStart();
430420 framebuffer = sceGuSwapBuffers();
@@ -455,9 +445,6 @@
455445 {
456446 return -1;
457447 }
458- sprintf(buf, "完了(%dBytes)", recvSize);
459- pgPrintMenuBar(buf);
460- pgWaitVn(5);
461448 // 1行目のステータスラインで区切る
462449 recvHeader = strstr(recvBuf, "\r\n");
463450 if (recvHeader == NULL)
@@ -480,9 +467,6 @@
480467 recvSize -= 2;
481468 net->length = recvSize;
482469 recvBody += 2;
483- pgCopyMenuBar();
484- sceDisplayWaitVblankStart();
485- framebuffer = sceGuSwapBuffers();
486470 return 0;
487471 }
488472
@@ -557,6 +541,7 @@
557541 }
558542 else if (cookie && strstr(line, "Set-Cookie:"))
559543 {
544+ // cookie[ ] のサイズチェックが必要だけど手抜き
560545 p = strchr(line, ';');
561546 *p = '\0';
562547 if (cookie[0])
--- trunc/src/psp2chForm.c (revision 156)
+++ trunc/src/psp2chForm.c (revision 157)
@@ -52,6 +52,23 @@
5252 }
5353
5454 /*********************
55+画面再描画
56+tmp メイン画面の縦横フラグ
57+*********************/
58+void psp2chRedraw(int tmp)
59+{
60+ printBuf = pixels;
61+ s2ch.tateFlag = tmp;
62+ pgCopy(s2ch.viewX, s2ch.viewY);
63+ printBuf = winPixels;
64+ s2ch.tateFlag = 0;
65+ pgCopy(0, 0);
66+ pgCopyMenuBar();
67+ sceDisplayWaitVblankStart();
68+ framebuffer = sceGuSwapBuffers();
69+}
70+
71+/*********************
5572 レス書き込み
5673 *********************/
5774 int psp2chFormResPost(char* host, char* dir, int dat, char* name, char* mail, char* message, int tmp)
@@ -81,24 +98,8 @@
8198 return -1;
8299 }
83100 // 送信しますかダイアログで画面消えてるので再描画
84- printBuf = pixels;
85- s2ch.tateFlag = tmp;
86- pgCopy(s2ch.viewX, s2ch.viewY);
87- printBuf = winPixels;
88- s2ch.tateFlag = 0;
89- pgCopy(0, 0);
90- pgCopyMenuBar();
91- sceDisplayWaitVblankStart();
92- framebuffer = sceGuSwapBuffers();
93- printBuf = pixels;
94- s2ch.tateFlag = tmp;
95- pgCopy(s2ch.viewX, s2ch.viewY);
96- printBuf = winPixels;
97- s2ch.tateFlag = 0;
98- pgCopy(0, 0);
99- pgCopyMenuBar();
100- sceDisplayWaitVblankStart();
101- framebuffer = sceGuSwapBuffers();
101+ psp2chRedraw(tmp);
102+ psp2chRedraw(tmp);
102103 // URLエンコードしてformデータ作成
103104 strcpy(encode, "submit=%8F%91%82%AB%8D%9E%82%DE&FROM=");
104105 psp2chUrlEncode(buffer, name);
@@ -133,12 +134,11 @@
133134 psp2chErrorDialog("Status code %d", ret);
134135 return -1;
135136 }
136- // Cookieにhana=mogeraも追加(encodeに&hana=mogera追加でもいいけど)
137- // 2008/9/16 suka=pontanに変更
137+ // Cookieにsuka=pontan追加(encodeに&suka=pontan追加でもいいけど)
138138 strcat(cookie, "; NAME=\"\"; MAIL=\"\"; suka=pontan");
139139 }
140140 net.body = encode;
141- // Cookieをセットして本送信
141+ // Cookieをセットして送信
142142 ret = psp2chPost(host, dir, dat, cookie, &net);
143143 free(encode);
144144 if (ret < 0)
@@ -185,15 +185,7 @@
185185 pgPrintMenuBar("画面は切り替わりません ○で入力画面に ×でレス表\示に戻ります");
186186 while (s2ch.running)
187187 {
188- printBuf = pixels;
189- s2ch.tateFlag = tmp;
190- pgCopy(s2ch.viewX, s2ch.viewY);
191- printBuf = winPixels;
192- s2ch.tateFlag = 0;
193- pgCopy(0,0);
194- pgCopyMenuBar();
195- sceDisplayWaitVblankStart();
196- framebuffer = sceGuSwapBuffers();
188+ psp2chRedraw(tmp);
197189 sceCtrlPeekBufferPositive(&s2ch.pad, 1);
198190 if (s2ch.pad.Buttons != s2ch.oldPad.Buttons)
199191 {
@@ -222,7 +214,8 @@
222214 SceUID fd;
223215 int focus, prefocus, sage, ret = 0;
224216 char buf[256];
225- char *str, *p, *menuStr = " ○ : 入力   × : 戻る   △ : 送信";
217+ char *str, *p;
218+ char *sagestr = "sage", *menuStr = " ○ : 入力   × : 戻る   △ : 送信";
226219 int changeFlag = 0;
227220 int tmp;
228221
@@ -230,6 +223,7 @@
230223 s2ch.tateFlag = 0;
231224 printBuf = winPixels;
232225 focus = 0;
226+ // focusが移動したときだけ描画するための変数
233227 prefocus = -1;
234228 if (mail[0] == '\0' && name[0] == '\0')
235229 {
@@ -352,8 +346,19 @@
352346 }
353347 if (sage)
354348 {
355- strcpy(mail, "sage");
349+ if (strlen(mail) < 60)
350+ {
351+ strcat(mail, sagestr);
352+ }
356353 }
354+ else
355+ {
356+ p = strstr(mail, sagestr);
357+ if (p)
358+ {
359+ *p = '\0';
360+ }
361+ }
357362 if (focus != prefocus)
358363 {
359364 prefocus = focus;
@@ -438,19 +443,10 @@
438443 }
439444 break;
440445 }
441- pgWaitVn(10);
442446 }
443447 }
444448 }
445- printBuf = pixels;
446- s2ch.tateFlag = tmp;
447- pgCopy(s2ch.viewX, s2ch.viewY);
448- printBuf = winPixels;
449- s2ch.tateFlag = 0;
450- pgCopy(0, 0);
451- pgCopyMenuBar();
452- sceDisplayWaitVblankStart();
453- framebuffer = sceGuSwapBuffers();
449+ psp2chRedraw(tmp);
454450 }
455451 if (changeFlag)
456452 {
Show on old repository browser