(empty log message)
@@ -488,7 +488,8 @@ | ||
488 | 488 | int in_sec_num = 0; // 総セクタ数 |
489 | 489 | int read_size[3]; // 読込んだサイズ |
490 | 490 | int write_size = 0; // 一回の書込サイズ |
491 | - int now_sector = 0; // 処理したセクタ数 | |
491 | + int write_sector = 0; // 処理したセクタ数 | |
492 | + int read_sector = 0; // 処理したセクタ数 | |
492 | 493 | |
493 | 494 | int num; // 汎用 |
494 | 495 |
@@ -578,7 +579,7 @@ | ||
578 | 579 | |
579 | 580 | // msg |
580 | 581 | 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); | |
582 | 583 | msg_win(msg, 0, MSG_LINE, 1); |
583 | 584 | |
584 | 585 | sceRtcGetCurrentTick(&start_tick); |
@@ -588,20 +589,21 @@ | ||
588 | 589 | // 2ブロック分先行読込 |
589 | 590 | read_size[0] = sceIoRead(fp_in, read_buf[0], MAX_READ_SIZE); |
590 | 591 | ERR_RET_2(read_size[0], ERR_READ); |
592 | + read_sector += read_size[0]; | |
591 | 593 | read_size[1] = sceIoReadAsync(fp_in, read_buf[1], MAX_READ_SIZE); |
592 | 594 | ERR_RET_2(read_size[1], ERR_READ); |
593 | 595 | |
594 | 596 | // loop前 |
595 | - now_sector = 0; | |
597 | + write_sector = 0; | |
596 | 598 | num = 0; |
597 | 599 | |
598 | 600 | // loop |
599 | - while(in_sec_num > now_sector) | |
601 | + while(in_sec_num > write_sector) | |
600 | 602 | { |
601 | 603 | // 遅延書込み終了 |
602 | 604 | msg_win("Wait WRITE", 0, MSG_LINE, 4); |
603 | 605 | ret = sceIoWaitAsync(fp_out, &res); |
604 | - if(ret < 0) | |
606 | + if(res < 0) | |
605 | 607 | { |
606 | 608 | if(first_wait == 1) |
607 | 609 | { |
@@ -610,7 +612,7 @@ | ||
610 | 612 | } |
611 | 613 | first_wait = 1; |
612 | 614 | } |
613 | - now_sector += read_size[num]; | |
615 | + write_sector += read_size[num]; | |
614 | 616 | |
615 | 617 | // 遅延書込み開始 |
616 | 618 | write_size = read_size[num] << 11; |
@@ -619,22 +621,28 @@ | ||
619 | 621 | ERR_RET_2(ret, ERR_WRITE); |
620 | 622 | |
621 | 623 | // 遅延読込み終了 |
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 | + } | |
628 | 633 | // 遅延読込み開始 |
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) | |
632 | 635 | { |
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 | + } | |
635 | 643 | } |
636 | 644 | |
637 | - sprintf(msg, "%d / %d セクタ完了", now_sector, in_sec_num); | |
645 | + sprintf(msg, "%d / %d セクタ完了", write_sector, in_sec_num); | |
638 | 646 | msg_win(msg, 0, MSG_LINE, 1); |
639 | 647 | sceRtcGetCurrentTick(&now_tick); |
640 | 648 | now_tick -= start_tick; |
@@ -641,7 +649,7 @@ | ||
641 | 649 | ret = (MAX_READ_SIZE << 11) / 1024 * 1000 / ((now_tick - old_tick) / 1000); |
642 | 650 | old_tick = now_tick; |
643 | 651 | sceRtcSetTick(&date1, &now_tick); |
644 | - now_tick = now_tick * in_sec_num / now_sector; | |
652 | + now_tick = now_tick * in_sec_num / write_sector; | |
645 | 653 | sceRtcSetTick(&date2, &now_tick); |
646 | 654 | now_tick -= old_tick; |
647 | 655 | sceRtcSetTick(&date3, &now_tick); |
@@ -670,7 +678,7 @@ | ||
670 | 678 | dir_menu(NULL, YES); |
671 | 679 | msg_win("", 0, MSG_REDROW, 0); |
672 | 680 | } |
673 | - num = (num + 1) % 2; | |
681 | + num = (num + 1) % 3; | |
674 | 682 | } |
675 | 683 | |
676 | 684 | // msg |