• R/O
  • SSH
  • HTTPS

gpsp-kai: コミット


コミットメタ情報

リビジョン581 (tree)
日時2010-03-28 22:46:30
作者takka

ログメッセージ

(メッセージはありません)

変更サマリ

差分

--- trunk/iso_tool/menu.c (revision 580)
+++ trunk/iso_tool/menu.c (revision 581)
@@ -468,73 +468,84 @@
468468 return CANCEL;
469469 }
470470
471+// TODO
471472 int umd2iso(char *dir, char *file, file_type type, int opt_1, int opt_2)
472473 {
473- char in_path[MAX_PATH];
474- char out_path[MAX_PATH];
475- char ren_path[MAX_PATH];
476- char work[MAX_PATH];
477- int ret;
478- char *read_buf[3]; // 読込バッファ ポインタ
479- char *write_buf[3]; // 書込バッファ ポインタ
474+ char in_path[MAX_PATH];
475+ char out_path[MAX_PATH];
476+ char ren_path[MAX_PATH];
477+ char work[MAX_PATH];
478+ int ret;
479+ char *read_buf[3]; // 読込バッファ ポインタ
480+ char *write_buf[3]; // 書込バッファ ポインタ
480481
481- SceUID fp_in = 0; // 読込ファイル ポインタ
482- SceUID fp_out = 0; // 書込ファイル ポインタ
483- SceInt64 res = -1; // 非同期ファイルIO用
482+ SceUID fp_in = 0; // 読込ファイル ポインタ
483+ SceUID fp_out = 0; // 書込ファイル ポインタ
484+ SceInt64 res = -1; // 非同期ファイルIO用
484485
485- const int MAX_READ_SIZE = 512; // 一回の読込サイズ
486+ const int MAX_READ_SIZE = 512; // 一回の読込サイズ
486487
487- int in_sec_num = 0; // 読込セクタ数
488- int read_size[3]; // 読込んだサイズ
489- int write_size = 0; // 一回の書込サイズ
490- int now_sector = 0; // 処理したセクタ数
488+ int in_sec_num = 0; // 総セクタ数
489+ int read_size[3]; // 読込んだサイズ
490+ int write_size = 0; // 一回の書込サイズ
491+ int now_sector = 0; // 処理したセクタ数
491492
492- int num; // 汎用
493+ int num; // 汎用
493494
494- char *text[15]; // テキスト表示用
495- char msg[256]; // テキスト表示用
495+ char *text[15]; // テキスト表示用
496+ char msg[256]; // テキスト表示用
496497
497- SceCtrlData data;
498- u64 start_tick;
499- u64 now_tick;
500- u64 old_tick = 0;
501- pspTime date1;
502- pspTime date2;
503- pspTime date3;
504- int first_wait = 0;
498+ SceCtrlData data;
499+ u64 start_tick;
500+ u64 now_tick;
501+ u64 old_tick = 0;
502+ pspTime date1;
503+ pspTime date2;
504+ pspTime date3;
505+ int first_wait = 0;
505506
506- // MSチェック
507- ret = check_ms();
508- if(ret < 0)
509- return CANCEL;
507+ // buff 設定
508+ read_buf[0] = &WORK[O_BUFFER][0];
509+ read_buf[1] = &WORK[O_BUFFER + MAX_READ_SIZE][0];
510+ read_buf[2] = &WORK[O_BUFFER + MAX_READ_SIZE * 2][0];
511+ write_buf[0] = &WORK[O_BUFFER][0];
512+ write_buf[1] = &WORK[O_BUFFER + MAX_READ_SIZE][0];
513+ write_buf[2] = &WORK[O_BUFFER + MAX_READ_SIZE * 2][0];
510514
511- // UMDチェック
512- ret = check_umd();
513- if(ret < 0)
514- return CANCEL;
515+ in_sec_num = get_umd_sector("umd:", TYPE_UMD);
515516
516- if((global.umd_size / 1024) > global.ms_free_size)
517- {
518- err_msg(ERR_SIZE_OVER);
519- return CANCEL;
520- }
517+ // MSチェック
518+ ret = check_ms();
519+ if(ret < 0)
520+ return CANCEL;
521521
522- strcpy(in_path, dir);
523- strcat(in_path, file);
524- strcpy(out_path, dir);
525- ret = osk(work, global.umd_id, "ファイル名指定", 0);
526- if(ret == PSP_UTILITY_OSK_RESULT_CHANGED)
527- strcat(out_path, work);
528- else
529- strcat(out_path, global.umd_id);
530- strcat(out_path, ".ISO");
522+ // UMDチェック
523+ ret = check_umd();
524+ if(ret < 0)
525+ return CANCEL;
531526
532- set_clock(333, 166);
533-// file_trans(iso_path, umd_path, TRANS_UMD_ISO, 0, 0, opt_1, opt_2);
527+ // 空き容量チェック
528+ if((global.umd_size / 1024) > global.ms_free_size)
529+ {
530+ err_msg(ERR_SIZE_OVER);
531+ return CANCEL;
532+ }
534533
534+ strcpy(in_path, dir);
535+ strcat(in_path, file);
536+
537+ strcpy(out_path, dir);
538+ ret = osk(work, global.umd_id, "ファイル名指定", 0);
539+ if(ret == PSP_UTILITY_OSK_RESULT_CHANGED)
540+ strcat(out_path, work);
541+ else
542+ strcat(out_path, global.umd_id);
543+ strcat(out_path, ".ISO");
544+
535545 strcpy(ren_path, out_path);
536546 strcpy(&ren_path[strlen(out_path) - 3], "TMP");
537547
548+
538549 msg_win("", 0, MSG_CLEAR, 0);
539550 sjis_to_utf8(work, strrchr(out_path, '/') + 1);
540551 sprintf(msg, "出力名:%s", work);
@@ -555,15 +566,6 @@
555566 if(ret != YES)
556567 return CANCEL;
557568
558-
559- // buff 設定
560- read_buf[0] = &WORK[O_BUFFER][0];
561- read_buf[1] = &WORK[I_BUFFER][0];
562- write_buf[0] = &WORK[O_BUFFER][0];
563- write_buf[1] = &WORK[I_BUFFER][0];
564-
565- in_sec_num = get_umd_sector("umd:", TYPE_UMD);
566-
567569 // open設定
568570 fp_in = sceIoOpen("umd:", PSP_O_RDONLY, 0777);
569571 ERR_RET_2(fp_in, ERR_OPEN);
@@ -574,34 +576,29 @@
574576 msg_win("", 0, MSG_CLEAR, 0);
575577 msg_win("UMD -> ISO 変換", 1, MSG_WAIT, 0);
576578
577-
578- // loop前
579- now_sector = 0;
580- num = 0;
581-
582- sceRtcGetCurrentTick(&start_tick);
583-
584579 // msg
585580 msg_win("", 0, MSG_WAIT, 0);
586581 sprintf(msg, "%d / %d セクタ完了", now_sector, in_sec_num);
587582 msg_win(msg, 0, MSG_LINE, 1);
588583
589- {
590- read_size[0] = sceIoRead(fp_in, read_buf[0], MAX_READ_SIZE);
591- ERR_RET_2(read_size[0], ERR_READ);
592- read_size[1] = sceIoRead(fp_in, read_buf[1], MAX_READ_SIZE);
593- ERR_RET_2(read_size[1], ERR_READ);
594- }
584+ sceRtcGetCurrentTick(&start_tick);
595585
586+ set_clock(333, 166);
587+
588+ // 2ブロック分先行読込
589+ read_size[0] = sceIoRead(fp_in, read_buf[0], MAX_READ_SIZE);
590+ ERR_RET_2(read_size[0], ERR_READ);
591+ read_size[1] = sceIoReadAsync(fp_in, read_buf[1], MAX_READ_SIZE);
592+ ERR_RET_2(read_size[1], ERR_READ);
593+
594+ // loop前
595+ now_sector = 0;
596+ num = 0;
597+
596598 // loop
597- while(read_size[num] > 0)
599+ while(in_sec_num > now_sector)
598600 {
599- {
600- now_sector += 512;
601- write_size = read_size[num] << 11;
602- }
603-
604- // BUF_1 遅延書込み終了
601+ // 遅延書込み終了
605602 msg_win("Wait WRITE", 0, MSG_LINE, 4);
606603 ret = sceIoWaitAsync(fp_out, &res);
607604 if(ret < 0)
@@ -613,24 +610,30 @@
613610 }
614611 first_wait = 1;
615612 }
613+ now_sector += read_size[num];
616614
617- // BUF_1 遅延読込み開始
618- if(type != TRANS_CSO_ISO)
619- {
620- msg_win("READ", 0, MSG_LINE, 4);
621- ret = sceIoReadAsync(fp_in, read_buf[num], MAX_READ_SIZE);
622- if(ret < 0)
623- {
624- err_msg(ERR_READ);
625- return CANCEL;
626- }
627- }
628-
629- // BUF_0 遅延書込み開始
615+ // 遅延書込み開始
616+ write_size = read_size[num] << 11;
630617 msg_win("WRITE", 0, MSG_LINE, 4);
631618 ret = sceIoWriteAsync(fp_out, write_buf[num], write_size);
632619 ERR_RET_2(ret, ERR_WRITE);
633620
621+ // 遅延読込み終了
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+
628+ // 遅延読込み開始
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)
632+ {
633+ err_msg(ERR_READ);
634+ return CANCEL;
635+ }
636+
634637 sprintf(msg, "%d / %d セクタ完了", now_sector, in_sec_num);
635638 msg_win(msg, 0, MSG_LINE, 1);
636639 sceRtcGetCurrentTick(&now_tick);
@@ -667,15 +670,6 @@
667670 dir_menu(NULL, YES);
668671 msg_win("", 0, MSG_REDROW, 0);
669672 }
670-
671- // BUF_1 遅延読込み終了
672- msg_win("Wait READ", 0, MSG_LINE, 4);
673- {
674- ret = sceIoWaitAsync(fp_in, &res);
675- ERR_RET_2(ret, ERR_READ);
676- msg_win("READ", 0, MSG_LINE, 4);
677- }
678- read_size[num] = res;
679673 num = (num + 1) % 2;
680674 }
681675
--- trunk/iso_tool/file.c (revision 580)
+++ trunk/iso_tool/file.c (revision 581)
@@ -247,6 +247,9 @@
247247 int dir_recode_addr;
248248 char *table_buf; // パステーブルバッファ
249249 int befor_dir_num = 0x0001;
250+ int now_dir_num = 1;
251+ char *tbl_ptr;
252+ unsigned char len_di;
250253
251254 // パス名の最初に'/'がある場合は削除
252255 // /PSP_GAME/SYSDIR/EBOOT.BIN
@@ -308,12 +311,30 @@
308311 ptr = strchr(name, '/');
309312 *ptr++ = '\0';
310313
311- tbl_ptr = 0;
312- while(tbl_ptr < path_table_size)
314+ tbl_ptr = (char *)path_table_addr;
315+ path_table_size += path_table_addr;
316+ while((int)tbl_ptr < path_table_size)
313317 {
314- // 親ディレクトリとディレクトリ名が一致するものを検索
315- // befor_dir_numを更新し、上記を繰り返し、最終ディレクトリのレコード位置を取得
318+ len_di = *tbl_ptr;
319+
320+ // 親ディレクトリの番号を比較
321+ tbl_ptr += 6;
322+ if(befor_dir_num == *(short int*)tbl_ptr)
323+ {
324+ tbl_ptr += 2;
325+ // 親ディレクトリとディレクトリ名が一致するものを検索
326+ if(strncmp(tbl_ptr, tbl_ptr, len_di) == 0)
327+ {
328+ // befor_dir_numを更新し、上記を繰り返し、最終ディレクトリのレコード位置を取得
329+ }
330+ }
331+ else
332+ {
333+ tbl_ptr += 2;
334+ }
335+ tbl_ptr += (len_di + 1) & ~1; // padding
316336 }
337+ }
317338
318339 // エクステントの位置等を調べる
319340
旧リポジトリブラウザで表示