• R/O
  • SSH
  • HTTPS

gpsp-kai: Commit


Commit MetaInfo

Revision582 (tree)
Zeit2010-04-04 10:20:09
Autortakka

Log Message

(empty log message)

Ändern Zusammenfassung

Diff

--- trunk/iso_tool/menu.c (revision 581)
+++ trunk/iso_tool/menu.c (revision 582)
@@ -488,7 +488,8 @@
488488 int in_sec_num = 0; // 総セクタ数
489489 int read_size[3]; // 読込んだサイズ
490490 int write_size = 0; // 一回の書込サイズ
491- int now_sector = 0; // 処理したセクタ数
491+ int write_sector = 0; // 処理したセクタ数
492+ int read_sector = 0; // 処理したセクタ数
492493
493494 int num; // 汎用
494495
@@ -578,7 +579,7 @@
578579
579580 // msg
580581 msg_win("", 0, MSG_WAIT, 0);
581- sprintf(msg, "%d / %d セクタ完了", now_sector, in_sec_num);
582+ sprintf(msg, "%d / %d セクタ完了", write_sector, in_sec_num);
582583 msg_win(msg, 0, MSG_LINE, 1);
583584
584585 sceRtcGetCurrentTick(&start_tick);
@@ -588,20 +589,21 @@
588589 // 2ブロック分先行読込
589590 read_size[0] = sceIoRead(fp_in, read_buf[0], MAX_READ_SIZE);
590591 ERR_RET_2(read_size[0], ERR_READ);
592+ read_sector += read_size[0];
591593 read_size[1] = sceIoReadAsync(fp_in, read_buf[1], MAX_READ_SIZE);
592594 ERR_RET_2(read_size[1], ERR_READ);
593595
594596 // loop前
595- now_sector = 0;
597+ write_sector = 0;
596598 num = 0;
597599
598600 // loop
599- while(in_sec_num > now_sector)
601+ while(in_sec_num > write_sector)
600602 {
601603 // 遅延書込み終了
602604 msg_win("Wait WRITE", 0, MSG_LINE, 4);
603605 ret = sceIoWaitAsync(fp_out, &res);
604- if(ret < 0)
606+ if(res < 0)
605607 {
606608 if(first_wait == 1)
607609 {
@@ -610,7 +612,7 @@
610612 }
611613 first_wait = 1;
612614 }
613- now_sector += read_size[num];
615+ write_sector += read_size[num];
614616
615617 // 遅延書込み開始
616618 write_size = read_size[num] << 11;
@@ -619,22 +621,28 @@
619621 ERR_RET_2(ret, ERR_WRITE);
620622
621623 // 遅延読込み終了
622- msg_win("Wait READ", 0, MSG_LINE, 4);
623- ret = sceIoWaitAsync(fp_in, &res);
624- ERR_RET_2(ret, ERR_READ);
625- msg_win("READ", 0, MSG_LINE, 4);
626- read_size[(num + 1) % 3] = res;
627-
624+ if(read_sector < in_sec_num)
625+ {
626+ msg_win("Wait READ", 0, MSG_LINE, 4);
627+ ret = sceIoWaitAsync(fp_in, &res);
628+ ERR_RET_2(res, ERR_READ);
629+ msg_win("READ", 0, MSG_LINE, 4);
630+ read_size[(num + 1) % 3] = res;
631+ read_sector += res;
632+ }
628633 // 遅延読込み開始
629- msg_win("READ", 0, MSG_LINE, 4);
630- ret = sceIoReadAsync(fp_in, read_buf[(num + 2) % 3], MAX_READ_SIZE);
631- if(ret < 0)
634+ if(read_sector < in_sec_num)
632635 {
633- err_msg(ERR_READ);
634- return CANCEL;
636+ msg_win("READ", 0, MSG_LINE, 4);
637+ ret = sceIoReadAsync(fp_in, read_buf[(num + 2) % 3], MAX_READ_SIZE);
638+ if(ret < 0)
639+ {
640+ err_msg(ERR_READ);
641+ return CANCEL;
642+ }
635643 }
636644
637- sprintf(msg, "%d / %d セクタ完了", now_sector, in_sec_num);
645+ sprintf(msg, "%d / %d セクタ完了", write_sector, in_sec_num);
638646 msg_win(msg, 0, MSG_LINE, 1);
639647 sceRtcGetCurrentTick(&now_tick);
640648 now_tick -= start_tick;
@@ -641,7 +649,7 @@
641649 ret = (MAX_READ_SIZE << 11) / 1024 * 1000 / ((now_tick - old_tick) / 1000);
642650 old_tick = now_tick;
643651 sceRtcSetTick(&date1, &now_tick);
644- now_tick = now_tick * in_sec_num / now_sector;
652+ now_tick = now_tick * in_sec_num / write_sector;
645653 sceRtcSetTick(&date2, &now_tick);
646654 now_tick -= old_tick;
647655 sceRtcSetTick(&date3, &now_tick);
@@ -670,7 +678,7 @@
670678 dir_menu(NULL, YES);
671679 msg_win("", 0, MSG_REDROW, 0);
672680 }
673- num = (num + 1) % 2;
681+ num = (num + 1) % 3;
674682 }
675683
676684 // msg
Show on old repository browser