XTRN:00000000 # XTRN:00000000 # +-------------------------------------------------------------------------+ XTRN:00000000 # | This file has been generated by The Interactive Disassembler (IDA) | XTRN:00000000 # | Copyright (c) 2009 by Hex-Rays, <support@hex-rays.com> | XTRN:00000000 # | License info: A4-3E6D-9040-45 | XTRN:00000000 # | Licensed User | XTRN:00000000 # +-------------------------------------------------------------------------+ XTRN:00000000 # XTRN:00000000 # Input MD5 : 5CA4BB521D2533AFB9E27B3B6025A938 XTRN:00000000 XTRN:00000000 # File Name : Z:\tmp\lib\LIBPRESS.OBJ XTRN:00000000 # Format : Sony Playstation PSX object file XTRN:00000000 XTRN:00000000 # Processor : r5900l XTRN:00000000 # Target assembler: GNU assembler XTRN:00000000 # Byte sex : Little endian XTRN:00000000 XTRN:00000000 .set noreorder XTRN:00000000 .set noat XTRN:00000000 XTRN:00000000 XTRN:00000000 # =========================================================================== XTRN:00000000 XTRN:00000000 # Segment type: Externs XTRN:00000000 .extern ResetCallback # CODE XREF: DecDCTReset+14p XTRN:00000004 .extern DMACallback # CODE XREF: DecDCTinCallback+Cp XTRN:00000004 # DecDCToutCallback+Cp XTRN:00000008 .extern printf # CODE XREF: sub_4C0+D8p XTRN:00000008 # sub_80C+14p XTRN:00000008 .rdata:00000100 # =========================================================================== .rdata:00000100 .rdata:00000100 # Segment type: Pure data .rdata:00000100 .rdata .rdata:00000100 aMdec_restBadOp:.ascii "MDEC_rest:bad option(%d)\n"<0> .rdata:00000100 # DATA XREF: sub_4C0:loc_594o .rdata:00000100 # sub_4C0+DCo .rdata:0000011A .align 2 .rdata:0000011C aMdec_in_sync: .ascii "MDEC_in_sync"<0> # DATA XREF: sub_6CC+50o .rdata:0000011C # sub_6CC+58o .rdata:00000129 .align 2 .rdata:0000012C aMdec_out_sync: .ascii "MDEC_out_sync"<0> # DATA XREF: sub_760+50o .rdata:0000012C # sub_760+58o .rdata:0000013A .align 2 .rdata:0000013C aSTimeout: .ascii "%s timeout:\n"<0> # DATA XREF: sub_80C+8o .rdata:00000149 .align 4 .rdata:00000149 .text:00000200 # =========================================================================== .text:00000200 .text:00000200 # Segment type: Pure code .text:00000200 .text .text:00000200 .text:00000200 # =============== S U B R O U T I N E ======================================= .text:00000200 .text:00000200 .text:00000200 .globl DecDCTReset .text:00000200 DecDCTReset: .text:00000200 .text:00000200 var_8 = -8 .text:00000200 var_4 = -4 .text:00000200 .text:00000200 addiu $sp, -0x18 .text:00000204 sw $s0, 0x18+var_8($sp) .text:00000208 move $s0, $a0 .text:0000020C bnez $s0, loc_21C .text:00000210 sw $ra, 0x18+var_4($sp) .text:00000214 jal ResetCallback .text:00000218 nop .text:0000021C .text:0000021C loc_21C: # CODE XREF: DecDCTReset+Cj .text:0000021C jal sub_4C0 .text:00000220 move $a0, $s0 .text:00000224 lw $ra, 0x18+var_4($sp) .text:00000228 lw $s0, 0x18+var_8($sp) .text:0000022C jr $ra .text:00000230 addiu $sp, 0x18 .text:00000230 # End of function DecDCTReset .text:00000230 .text:00000234 .text:00000234 # =============== S U B R O U T I N E ======================================= .text:00000234 .text:00000234 .text:00000234 .globl DecDCTGetEnv .text:00000234 DecDCTGetEnv: .text:00000234 move $a2, $a0 .text:00000238 la $a1, unk_904 .text:00000240 li $v1, 0xF .text:00000244 li $a3, 0xFFFFFFFF .text:00000248 .text:00000248 loc_248: # CODE XREF: DecDCTGetEnv+24j .text:00000248 lw $v0, 0($a1) .text:0000024C addiu $a1, 4 .text:00000250 addiu $v1, -1 .text:00000254 sw $v0, 0($a2) .text:00000258 bne $v1, $a3, loc_248 .text:0000025C addiu $a2, 4 .text:00000260 addiu $a2, $a0, 0x40 .text:00000264 la $a1, unk_944 .text:0000026C li $v1, 0xF .text:00000270 li $a3, 0xFFFFFFFF .text:00000274 .text:00000274 loc_274: # CODE XREF: DecDCTGetEnv+50j .text:00000274 lw $v0, 0($a1) .text:00000278 addiu $a1, 4 .text:0000027C addiu $v1, -1 .text:00000280 sw $v0, 0($a2) .text:00000284 bne $v1, $a3, loc_274 .text:00000288 addiu $a2, 4 .text:0000028C addiu $a2, $a0, 0x80 .text:00000290 la $a1, unk_988 .text:00000298 li $v1, 0x1F .text:0000029C li $a3, 0xFFFFFFFF .text:000002A0 .text:000002A0 loc_2A0: # CODE XREF: DecDCTGetEnv+7Cj .text:000002A0 lw $v0, 0($a1) .text:000002A4 addiu $a1, 4 .text:000002A8 addiu $v1, -1 .text:000002AC sw $v0, 0($a2) .text:000002B0 bne $v1, $a3, loc_2A0 .text:000002B4 addiu $a2, 4 .text:000002B8 jr $ra .text:000002BC move $v0, $a0 .text:000002BC # End of function DecDCTGetEnv .text:000002BC .text:000002C0 .text:000002C0 # =============== S U B R O U T I N E ======================================= .text:000002C0 .text:000002C0 .text:000002C0 .globl DecDCTPutEnv .text:000002C0 DecDCTPutEnv: .text:000002C0 .text:000002C0 var_8 = -8 .text:000002C0 var_4 = -4 .text:000002C0 .text:000002C0 addiu $sp, -0x18 .text:000002C4 sw $s0, 0x18+var_8($sp) .text:000002C8 move $s0, $a0 .text:000002CC la $a1, unk_904 .text:000002D4 li $v1, 0xF .text:000002D8 li $a2, 0xFFFFFFFF .text:000002DC sw $ra, 0x18+var_4($sp) .text:000002E0 .text:000002E0 loc_2E0: # CODE XREF: DecDCTPutEnv+30j .text:000002E0 lw $v0, 0($a0) .text:000002E4 addiu $a0, 4 .text:000002E8 addiu $v1, -1 .text:000002EC sw $v0, 0($a1) .text:000002F0 bne $v1, $a2, loc_2E0 .text:000002F4 addiu $a1, 4 .text:000002F8 la $a1, unk_944 .text:00000300 addiu $a0, $s0, 0x40 .text:00000304 li $v1, 0xF .text:00000308 li $a2, 0xFFFFFFFF .text:0000030C .text:0000030C loc_30C: # CODE XREF: DecDCTPutEnv+5Cj .text:0000030C lw $v0, 0($a0) .text:00000310 addiu $a0, 4 .text:00000314 addiu $v1, -1 .text:00000318 sw $v0, 0($a1) .text:0000031C bne $v1, $a2, loc_30C .text:00000320 addiu $a1, 4 .text:00000324 la $a0, unk_900 .text:0000032C jal sub_5B0 .text:00000330 li $a1, 0x20 # ' ' .text:00000334 la $a0, unk_984 .text:0000033C jal sub_5B0 .text:00000340 li $a1, 0x20 # ' ' .text:00000344 move $v0, $s0 .text:00000348 lw $ra, 0x18+var_4($sp) .text:0000034C lw $s0, 0x18+var_8($sp) .text:00000350 jr $ra .text:00000354 addiu $sp, 0x18 .text:00000354 # End of function DecDCTPutEnv .text:00000354 .text:00000358 .text:00000358 # =============== S U B R O U T I N E ======================================= .text:00000358 .text:00000358 .text:00000358 .globl DecDCTin .text:00000358 DecDCTin: .text:00000358 .text:00000358 var_8 = -8 .text:00000358 .text:00000358 addiu $sp, -0x18 .text:0000035C andi $v0, $a1, 1 .text:00000360 beqz $v0, loc_37C .text:00000364 sw $ra, 0x18+var_8($sp) .text:00000368 lui $v1, 0xF7FF .text:0000036C lw $v0, 0($a0) .text:00000370 li $v1, 0xF7FFFFFF .text:00000374 j loc_388 .text:00000378 and $v0, $v1 .text:0000037C # --------------------------------------------------------------------------- .text:0000037C .text:0000037C loc_37C: # CODE XREF: DecDCTin+8j .text:0000037C lw $v0, 0($a0) .text:00000380 lui $v1, 0x800 .text:00000384 or $v0, $v1 .text:00000388 .text:00000388 loc_388: # CODE XREF: DecDCTin+1Cj .text:00000388 sw $v0, 0($a0) .text:0000038C andi $v0, $a1, 2 .text:00000390 beqz $v0, loc_3A4 .text:00000394 lui $v1, 0x200 .text:00000398 lw $v0, 0($a0) .text:0000039C j loc_3B4 .text:000003A0 or $v0, $v1 .text:000003A4 # --------------------------------------------------------------------------- .text:000003A4 .text:000003A4 loc_3A4: # CODE XREF: DecDCTin+38j .text:000003A4 lui $v1, 0xFDFF .text:000003A8 lw $v0, 0($a0) .text:000003AC li $v1, 0xFDFFFFFF .text:000003B0 and $v0, $v1 .text:000003B4 .text:000003B4 loc_3B4: # CODE XREF: DecDCTin+44j .text:000003B4 sw $v0, 0($a0) .text:000003B8 lhu $a1, 0($a0) .text:000003BC jal sub_5B0 .text:000003C0 nop .text:000003C4 lw $ra, 0x18+var_8($sp) .text:000003C8 addiu $sp, 0x18 .text:000003CC jr $ra .text:000003D0 nop .text:000003D0 # End of function DecDCTin .text:000003D0 .text:000003D4 .text:000003D4 # =============== S U B R O U T I N E ======================================= .text:000003D4 .text:000003D4 .text:000003D4 .globl DecDCTout .text:000003D4 DecDCTout: .text:000003D4 .text:000003D4 var_8 = -8 .text:000003D4 .text:000003D4 addiu $sp, -0x18 .text:000003D8 sw $ra, 0x18+var_8($sp) .text:000003DC jal sub_640 .text:000003E0 nop .text:000003E4 lw $ra, 0x18+var_8($sp) .text:000003E8 addiu $sp, 0x18 .text:000003EC jr $ra .text:000003F0 nop .text:000003F0 # End of function DecDCTout .text:000003F0 .text:000003F4 .text:000003F4 # =============== S U B R O U T I N E ======================================= .text:000003F4 .text:000003F4 .text:000003F4 .globl DecDCTinSync .text:000003F4 DecDCTinSync: .text:000003F4 .text:000003F4 var_8 = -8 .text:000003F4 .text:000003F4 addiu $sp, -0x18 .text:000003F8 bnez $a0, loc_410 .text:000003FC sw $ra, 0x18+var_8($sp) .text:00000400 jal sub_6CC .text:00000404 nop .text:00000408 j loc_420 .text:0000040C nop .text:00000410 # --------------------------------------------------------------------------- .text:00000410 .text:00000410 loc_410: # CODE XREF: DecDCTinSync+4j .text:00000410 jal sub_7F4 .text:00000414 nop .text:00000418 srl $v0, 29 .text:0000041C andi $v0, 1 .text:00000420 .text:00000420 loc_420: # CODE XREF: DecDCTinSync+14j .text:00000420 lw $ra, 0x18+var_8($sp) .text:00000424 addiu $sp, 0x18 .text:00000428 jr $ra .text:0000042C nop .text:0000042C # End of function DecDCTinSync .text:0000042C .text:00000430 .text:00000430 # =============== S U B R O U T I N E ======================================= .text:00000430 .text:00000430 .text:00000430 .globl DecDCToutSync .text:00000430 DecDCToutSync: .text:00000430 .text:00000430 var_8 = -8 .text:00000430 .text:00000430 addiu $sp, -0x18 .text:00000434 bnez $a0, loc_44C .text:00000438 sw $ra, 0x18+var_8($sp) .text:0000043C jal sub_760 .text:00000440 nop .text:00000444 j loc_468 .text:00000448 nop .text:0000044C # --------------------------------------------------------------------------- .text:0000044C .text:0000044C loc_44C: # CODE XREF: DecDCToutSync+4j .text:0000044C lw $v0, dword_A24 .text:00000454 nop .text:00000458 lw $v0, 0($v0) .text:0000045C nop .text:00000460 srl $v0, 24 .text:00000464 andi $v0, 1 .text:00000468 .text:00000468 loc_468: # CODE XREF: DecDCToutSync+14j .text:00000468 lw $ra, 0x18+var_8($sp) .text:0000046C addiu $sp, 0x18 .text:00000470 jr $ra .text:00000474 nop .text:00000474 # End of function DecDCToutSync .text:00000474 .text:00000478 .text:00000478 # =============== S U B R O U T I N E ======================================= .text:00000478 .text:00000478 .text:00000478 .globl DecDCTinCallback .text:00000478 DecDCTinCallback: .text:00000478 .text:00000478 var_8 = -8 .text:00000478 .text:00000478 addiu $sp, -0x18 .text:0000047C sw $ra, 0x18+var_8($sp) .text:00000480 move $a1, $a0 .text:00000484 jal DMACallback .text:00000488 move $a0, $0 .text:0000048C lw $ra, 0x18+var_8($sp) .text:00000490 addiu $sp, 0x18 .text:00000494 jr $ra .text:00000498 nop .text:00000498 # End of function DecDCTinCallback .text:00000498 .text:0000049C .text:0000049C # =============== S U B R O U T I N E ======================================= .text:0000049C .text:0000049C .text:0000049C .globl DecDCToutCallback .text:0000049C DecDCToutCallback: .text:0000049C .text:0000049C var_8 = -8 .text:0000049C .text:0000049C addiu $sp, -0x18 .text:000004A0 sw $ra, 0x18+var_8($sp) .text:000004A4 move $a1, $a0 .text:000004A8 jal DMACallback .text:000004AC li $a0, 1 .text:000004B0 lw $ra, 0x18+var_8($sp) .text:000004B4 addiu $sp, 0x18 .text:000004B8 jr $ra .text:000004BC nop .text:000004BC # End of function DecDCToutCallback .text:000004BC .text:000004C0 .text:000004C0 # =============== S U B R O U T I N E ======================================= .text:000004C0 .text:000004C0 .text:000004C0 sub_4C0: # CODE XREF: DecDCTReset:loc_21Cp .text:000004C0 .text:000004C0 var_8 = -8 .text:000004C0 .text:000004C0 addiu $sp, -0x18 .text:000004C4 move $a1, $a0 .text:000004C8 beqz $a1, loc_4E4 .text:000004CC sw $ra, 0x18+var_8($sp) .text:000004D0 li $v0, 1 .text:000004D4 beq $a1, $v0, loc_544 .text:000004D8 lui $v0, 0x8000 .text:000004DC j loc_594 .text:000004E0 nop .text:000004E4 # --------------------------------------------------------------------------- .text:000004E4 .text:000004E4 loc_4E4: # CODE XREF: sub_4C0+8j .text:000004E4 lw $v1, dword_A44 .text:000004EC lui $v0, 0x8000 .text:000004F0 sw $v0, 0($v1) .text:000004F4 lw $v0, dword_A18 .text:000004FC la $a0, unk_900 .text:00000504 sw $0, 0($v0) .text:00000508 lw $v0, dword_A24 .text:00000510 li $a1, 0x20 # ' ' .text:00000514 sw $0, 0($v0) .text:00000518 lw $v1, dword_A44 .text:00000520 lui $v0, 0x6000 .text:00000524 jal sub_5B0 .text:00000528 sw $v0, 0($v1) .text:0000052C la $a0, unk_984 .text:00000534 jal sub_5B0 .text:00000538 li $a1, 0x20 # ' ' .text:0000053C j loc_5A0 .text:00000540 nop .text:00000544 # --------------------------------------------------------------------------- .text:00000544 .text:00000544 loc_544: # CODE XREF: sub_4C0+14j .text:00000544 lw $v1, dword_A44 .text:0000054C nop .text:00000550 sw $v0, 0($v1) .text:00000554 lw $v0, dword_A18 .text:0000055C nop .text:00000560 sw $0, 0($v0) .text:00000564 lw $v0, dword_A24 .text:0000056C nop .text:00000570 sw $0, 0($v0) .text:00000574 lw $v0, dword_A24 .text:0000057C lw $v1, dword_A44 .text:00000584 lw $v0, 0($v0) .text:00000588 lui $v0, 0x6000 .text:0000058C j loc_5A0 .text:00000590 sw $v0, 0($v1) .text:00000594 # --------------------------------------------------------------------------- .text:00000594 .text:00000594 loc_594: # CODE XREF: sub_4C0+1Cj .text:00000594 lui $a0, (aMdec_restBadOp >> 16) # "MDEC_rest:bad option(%d)\n" .text:00000598 jal printf .text:0000059C la $a0, (aMdec_restBadOp & 0xFFFF) # "MDEC_rest:bad option(%d)\n" .text:000005A0 .text:000005A0 loc_5A0: # CODE XREF: sub_4C0+7Cj .text:000005A0 # sub_4C0+CCj .text:000005A0 lw $ra, 0x18+var_8($sp) .text:000005A4 addiu $sp, 0x18 .text:000005A8 jr $ra .text:000005AC nop .text:000005AC # End of function sub_4C0 .text:000005AC .text:000005B0 .text:000005B0 # =============== S U B R O U T I N E ======================================= .text:000005B0 .text:000005B0 .text:000005B0 sub_5B0: # CODE XREF: DecDCTPutEnv+6Cp .text:000005B0 # DecDCTPutEnv+7Cp ... .text:000005B0 .text:000005B0 var_10 = -0x10 .text:000005B0 var_C = -0xC .text:000005B0 var_8 = -8 .text:000005B0 .text:000005B0 addiu $sp, -0x20 .text:000005B4 sw $s1, 0x20+var_C($sp) .text:000005B8 move $s1, $a0 .text:000005BC sw $s0, 0x20+var_10($sp) .text:000005C0 sw $ra, 0x20+var_8($sp) .text:000005C4 jal sub_6CC .text:000005C8 move $s0, $a1 .text:000005CC lw $v1, dword_A48 .text:000005D4 srl $s0, 5 .text:000005D8 lw $v0, 0($v1) .text:000005DC sll $s0, 16 .text:000005E0 ori $v0, 0x88 # 'È' .text:000005E4 sw $v0, 0($v1) .text:000005E8 lw $v1, dword_A10 .text:000005F0 addiu $v0, $s1, 4 .text:000005F4 sw $v0, 0($v1) .text:000005F8 lw $v0, dword_A14 .text:00000600 ori $s0, 0x20 # ' ' .text:00000604 sw $s0, 0($v0) .text:00000608 lw $v1, dword_A40 .text:00000610 lw $v0, 0($s1) .text:00000614 lui $a0, 0x100 .text:00000618 sw $v0, 0($v1) .text:0000061C lw $v0, dword_A18 .text:00000624 li $a0, 0x1000201 .text:00000628 sw $a0, 0($v0) .text:0000062C lw $ra, 0x20+var_8($sp) .text:00000630 lw $s1, 0x20+var_C($sp) .text:00000634 lw $s0, 0x20+var_10($sp) .text:00000638 jr $ra .text:0000063C addiu $sp, 0x20 .text:0000063C # End of function sub_5B0 .text:0000063C .text:00000640 .text:00000640 # =============== S U B R O U T I N E ======================================= .text:00000640 .text:00000640 .text:00000640 sub_640: # CODE XREF: DecDCTout+8p .text:00000640 .text:00000640 var_10 = -0x10 .text:00000640 var_C = -0xC .text:00000640 var_8 = -8 .text:00000640 .text:00000640 addiu $sp, -0x20 .text:00000644 sw $s1, 0x20+var_C($sp) .text:00000648 move $s1, $a0 .text:0000064C sw $s0, 0x20+var_10($sp) .text:00000650 sw $ra, 0x20+var_8($sp) .text:00000654 jal sub_760 .text:00000658 move $s0, $a1 .text:0000065C lw $v1, dword_A48 .text:00000664 nop .text:00000668 lw $v0, 0($v1) .text:0000066C srl $s0, 5 .text:00000670 ori $v0, 0x88 # 'È' .text:00000674 sw $v0, 0($v1) .text:00000678 lw $v0, dword_A24 .text:00000680 sll $s0, 16 .text:00000684 sw $0, 0($v0) .text:00000688 lw $v0, dword_A1C .text:00000690 ori $s0, 0x20 # ' ' .text:00000694 sw $s1, 0($v0) .text:00000698 lw $v0, dword_A20 .text:000006A0 lui $v1, 0x100 .text:000006A4 sw $s0, 0($v0) .text:000006A8 lw $v0, dword_A24 .text:000006B0 li $v1, 0x1000200 .text:000006B4 sw $v1, 0($v0) .text:000006B8 lw $ra, 0x20+var_8($sp) .text:000006BC lw $s1, 0x20+var_C($sp) .text:000006C0 lw $s0, 0x20+var_10($sp) .text:000006C4 jr $ra .text:000006C8 addiu $sp, 0x20 .text:000006C8 # End of function sub_640 .text:000006C8 .text:000006CC .text:000006CC # =============== S U B R O U T I N E ======================================= .text:000006CC .text:000006CC .text:000006CC sub_6CC: # CODE XREF: DecDCTinSync+Cp .text:000006CC # sub_5B0+14p .text:000006CC .text:000006CC var_10 = -0x10 .text:000006CC var_8 = -8 .text:000006CC .text:000006CC addiu $sp, -0x20 .text:000006D0 lw $v1, dword_A44 .text:000006D8 lui $v0, 0x10 .text:000006DC sw $ra, 0x20+var_8($sp) .text:000006E0 sw $v0, 0x20+var_10($sp) .text:000006E4 lw $v0, 0($v1) .text:000006E8 lui $v1, 0x2000 .text:000006EC and $v0, $v1 .text:000006F0 beqz $v0, loc_750 .text:000006F4 move $v0, $0 .text:000006F8 li $a0, 0xFFFFFFFF .text:000006FC .text:000006FC loc_6FC: # CODE XREF: sub_6CC+7Cj .text:000006FC lw $v0, 0x20+var_10($sp) .text:00000700 nop .text:00000704 addiu $v0, -1 .text:00000708 sw $v0, 0x20+var_10($sp) .text:0000070C lw $v0, 0x20+var_10($sp) .text:00000710 nop .text:00000714 bne $v0, $a0, loc_730 .text:00000718 nop .text:0000071C lui $a0, (aMdec_in_sync >> 16) # "MDEC_in_sync" .text:00000720 jal sub_80C .text:00000724 la $a0, (aMdec_in_sync & 0xFFFF) # "MDEC_in_sync" .text:00000728 j loc_750 .text:0000072C li $v0, 0xFFFFFFFF .text:00000730 # --------------------------------------------------------------------------- .text:00000730 .text:00000730 loc_730: # CODE XREF: sub_6CC+48j .text:00000730 lw $v0, dword_A44 .text:00000738 nop .text:0000073C lw $v0, 0($v0) .text:00000740 nop .text:00000744 and $v0, $v1 .text:00000748 bnez $v0, loc_6FC .text:0000074C move $v0, $0 .text:00000750 .text:00000750 loc_750: # CODE XREF: sub_6CC+24j .text:00000750 # sub_6CC+5Cj .text:00000750 lw $ra, 0x20+var_8($sp) .text:00000754 addiu $sp, 0x20 .text:00000758 jr $ra .text:0000075C nop .text:0000075C # End of function sub_6CC .text:0000075C .text:00000760 .text:00000760 # =============== S U B R O U T I N E ======================================= .text:00000760 .text:00000760 .text:00000760 sub_760: # CODE XREF: DecDCToutSync+Cp .text:00000760 # sub_640+14p .text:00000760 .text:00000760 var_10 = -0x10 .text:00000760 var_8 = -8 .text:00000760 .text:00000760 addiu $sp, -0x20 .text:00000764 lw $v1, dword_A24 .text:0000076C lui $v0, 0x10 .text:00000770 sw $ra, 0x20+var_8($sp) .text:00000774 sw $v0, 0x20+var_10($sp) .text:00000778 lw $v0, 0($v1) .text:0000077C lui $v1, 0x100 .text:00000780 and $v0, $v1 .text:00000784 beqz $v0, loc_7E4 .text:00000788 move $v0, $0 .text:0000078C li $a0, 0xFFFFFFFF .text:00000790 .text:00000790 loc_790: # CODE XREF: sub_760+7Cj .text:00000790 lw $v0, 0x20+var_10($sp) .text:00000794 nop .text:00000798 addiu $v0, -1 .text:0000079C sw $v0, 0x20+var_10($sp) .text:000007A0 lw $v0, 0x20+var_10($sp) .text:000007A4 nop .text:000007A8 bne $v0, $a0, loc_7C4 .text:000007AC nop .text:000007B0 lui $a0, (aMdec_out_sync >> 16) # "MDEC_out_sync" .text:000007B4 jal sub_80C .text:000007B8 la $a0, (aMdec_out_sync & 0xFFFF) # "MDEC_out_sync" .text:000007BC j loc_7E4 .text:000007C0 li $v0, 0xFFFFFFFF .text:000007C4 # --------------------------------------------------------------------------- .text:000007C4 .text:000007C4 loc_7C4: # CODE XREF: sub_760+48j .text:000007C4 lw $v0, dword_A24 .text:000007CC nop .text:000007D0 lw $v0, 0($v0) .text:000007D4 nop .text:000007D8 and $v0, $v1 .text:000007DC bnez $v0, loc_790 .text:000007E0 move $v0, $0 .text:000007E4 .text:000007E4 loc_7E4: # CODE XREF: sub_760+24j .text:000007E4 # sub_760+5Cj .text:000007E4 lw $ra, 0x20+var_8($sp) .text:000007E8 addiu $sp, 0x20 .text:000007EC jr $ra .text:000007F0 nop .text:000007F0 # End of function sub_760 .text:000007F0 .text:000007F4 .text:000007F4 # =============== S U B R O U T I N E ======================================= .text:000007F4 .text:000007F4 .text:000007F4 sub_7F4: # CODE XREF: DecDCTinSync:loc_410p .text:000007F4 lw $v0, dword_A44 .text:000007FC nop .text:00000800 lw $v0, 0($v0) .text:00000804 jr $ra .text:00000808 nop .text:00000808 # End of function sub_7F4 .text:00000808 .text:0000080C .text:0000080C # =============== S U B R O U T I N E ======================================= .text:0000080C .text:0000080C .text:0000080C sub_80C: # CODE XREF: sub_6CC+54p .text:0000080C # sub_760+54p .text:0000080C .text:0000080C var_8 = -8 .text:0000080C .text:0000080C addiu $sp, -0x18 .text:00000810 move $a1, $a0 .text:00000814 la $a0, aSTimeout # "%s timeout:\n" .text:0000081C sw $ra, 0x18+var_8($sp) .text:00000820 jal printf .text:00000824 nop .text:00000828 lw $v1, dword_A44 .text:00000830 lui $v0, 0x8000 .text:00000834 sw $v0, 0($v1) .text:00000838 lw $v0, dword_A18 .text:00000840 nop .text:00000844 sw $0, 0($v0) .text:00000848 lw $v0, dword_A24 .text:00000850 nop .text:00000854 sw $0, 0($v0) .text:00000858 move $v0, $0 .text:0000085C lw $v1, dword_A24 .text:00000864 lw $a0, dword_A44 .text:0000086C lw $v1, 0($v1) .text:00000870 lui $v1, 0x6000 .text:00000874 sw $v1, 0($a0) .text:00000878 lw $ra, 0x18+var_8($sp) .text:0000087C addiu $sp, 0x18 .text:00000880 jr $ra .text:00000884 nop .text:00000884 # End of function sub_80C .text:00000884 .text:00000884 # --------------------------------------------------------------------------- .text:00000888 .align 4 .text:00000888 .data:00000900 # =========================================================================== .data:00000900 .data:00000900 # Segment type: Pure data .data:00000900 .data .data:00000900 unk_900: .byte 1 # DATA XREF: DecDCTPutEnv+64o .data:00000900 # sub_4C0+3Co .data:00000901 .byte 0 .data:00000902 .byte 0 .data:00000903 .byte 0x40 # @ .data:00000904 unk_904: .byte 2 # DATA XREF: DecDCTGetEnv+4o .data:00000904 # DecDCTPutEnv+Co .data:00000905 .byte 0x10 .data:00000906 .byte 0x10 .data:00000907 .byte 0x13 .data:00000908 .byte 0x10 .data:00000909 .byte 0x13 .data:0000090A .byte 0x16 .data:0000090B .byte 0x16 .data:0000090C .byte 0x16 .data:0000090D .byte 0x16 .data:0000090E .byte 0x16 .data:0000090F .byte 0x16 .data:00000910 .byte 0x1A .data:00000911 .byte 0x18 .data:00000912 .byte 0x1A .data:00000913 .byte 0x1B .data:00000914 .byte 0x1B .data:00000915 .byte 0x1B .data:00000916 .byte 0x1A .data:00000917 .byte 0x1A .data:00000918 .byte 0x1A .data:00000919 .byte 0x1A .data:0000091A .byte 0x1B .data:0000091B .byte 0x1B .data:0000091C .byte 0x1B .data:0000091D .byte 0x1D .data:0000091E .byte 0x1D .data:0000091F .byte 0x1D .data:00000920 .byte 0x22 # " .data:00000921 .byte 0x22 # " .data:00000922 .byte 0x22 # " .data:00000923 .byte 0x1D .data:00000924 .byte 0x1D .data:00000925 .byte 0x1D .data:00000926 .byte 0x1B .data:00000927 .byte 0x1B .data:00000928 .byte 0x1D .data:00000929 .byte 0x1D .data:0000092A .byte 0x20 .data:0000092B .byte 0x20 .data:0000092C .byte 0x22 # " .data:0000092D .byte 0x22 # " .data:0000092E .byte 0x25 # % .data:0000092F .byte 0x26 # & .data:00000930 .byte 0x25 # % .data:00000931 .byte 0x23 # # .data:00000932 .byte 0x23 # # .data:00000933 .byte 0x22 # " .data:00000934 .byte 0x23 # # .data:00000935 .byte 0x26 # & .data:00000936 .byte 0x26 # & .data:00000937 .byte 0x28 # ( .data:00000938 .byte 0x28 # ( .data:00000939 .byte 0x28 # ( .data:0000093A .byte 0x30 # 0 .data:0000093B .byte 0x30 # 0 .data:0000093C .byte 0x2E # . .data:0000093D .byte 0x2E # . .data:0000093E .byte 0x38 # 8 .data:0000093F .byte 0x38 # 8 .data:00000940 .byte 0x3A # : .data:00000941 .byte 0x45 # E .data:00000942 .byte 0x45 # E .data:00000943 .byte 0x53 # S .data:00000944 unk_944: .byte 2 # DATA XREF: DecDCTGetEnv+30o .data:00000944 # DecDCTPutEnv+38o .data:00000945 .byte 0x10 .data:00000946 .byte 0x10 .data:00000947 .byte 0x13 .data:00000948 .byte 0x10 .data:00000949 .byte 0x13 .data:0000094A .byte 0x16 .data:0000094B .byte 0x16 .data:0000094C .byte 0x16 .data:0000094D .byte 0x16 .data:0000094E .byte 0x16 .data:0000094F .byte 0x16 .data:00000950 .byte 0x1A .data:00000951 .byte 0x18 .data:00000952 .byte 0x1A .data:00000953 .byte 0x1B .data:00000954 .byte 0x1B .data:00000955 .byte 0x1B .data:00000956 .byte 0x1A .data:00000957 .byte 0x1A .data:00000958 .byte 0x1A .data:00000959 .byte 0x1A .data:0000095A .byte 0x1B .data:0000095B .byte 0x1B .data:0000095C .byte 0x1B .data:0000095D .byte 0x1D .data:0000095E .byte 0x1D .data:0000095F .byte 0x1D .data:00000960 .byte 0x22 # " .data:00000961 .byte 0x22 # " .data:00000962 .byte 0x22 # " .data:00000963 .byte 0x1D .data:00000964 .byte 0x1D .data:00000965 .byte 0x1D .data:00000966 .byte 0x1B .data:00000967 .byte 0x1B .data:00000968 .byte 0x1D .data:00000969 .byte 0x1D .data:0000096A .byte 0x20 .data:0000096B .byte 0x20 .data:0000096C .byte 0x22 # " .data:0000096D .byte 0x22 # " .data:0000096E .byte 0x25 # % .data:0000096F .byte 0x26 # & .data:00000970 .byte 0x25 # % .data:00000971 .byte 0x23 # # .data:00000972 .byte 0x23 # # .data:00000973 .byte 0x22 # " .data:00000974 .byte 0x23 # # .data:00000975 .byte 0x26 # & .data:00000976 .byte 0x26 # & .data:00000977 .byte 0x28 # ( .data:00000978 .byte 0x28 # ( .data:00000979 .byte 0x28 # ( .data:0000097A .byte 0x30 # 0 .data:0000097B .byte 0x30 # 0 .data:0000097C .byte 0x2E # . .data:0000097D .byte 0x2E # . .data:0000097E .byte 0x38 # 8 .data:0000097F .byte 0x38 # 8 .data:00000980 .byte 0x3A # : .data:00000981 .byte 0x45 # E .data:00000982 .byte 0x45 # E .data:00000983 .byte 0x53 # S .data:00000984 unk_984: .byte 0 # DATA XREF: DecDCTPutEnv+74o .data:00000984 # sub_4C0+6Co .data:00000985 .byte 0 .data:00000986 .byte 0 .data:00000987 .byte 0x60 # ` .data:00000988 unk_988: .byte 0x82 # Â # DATA XREF: DecDCTGetEnv+5Co .data:00000989 .byte 0x5A # Z .data:0000098A .byte 0x82 # Â .data:0000098B .byte 0x5A # Z .data:0000098C .byte 0x82 # Â .data:0000098D .byte 0x5A # Z .data:0000098E .byte 0x82 # Â .data:0000098F .byte 0x5A # Z .data:00000990 .byte 0x82 # Â .data:00000991 .byte 0x5A # Z .data:00000992 .byte 0x82 # Â .data:00000993 .byte 0x5A # Z .data:00000994 .byte 0x82 # Â .data:00000995 .byte 0x5A # Z .data:00000996 .byte 0x82 # Â .data:00000997 .byte 0x5A # Z .data:00000998 .byte 0x8A # Ê .data:00000999 .byte 0x7D # } .data:0000099A .byte 0x6D # m .data:0000099B .byte 0x6A # j .data:0000099C .byte 0x1C .data:0000099D .byte 0x47 # G .data:0000099E .byte 0xF8 # ° .data:0000099F .byte 0x18 .data:000009A0 .byte 7 .data:000009A1 .byte 0xE7 # ÷ .data:000009A2 .byte 0xE3 # ó .data:000009A3 .byte 0xB8 # ¬ .data:000009A4 .byte 0x92 # Ò .data:000009A5 .byte 0x95 # Õ .data:000009A6 .byte 0x75 # u .data:000009A7 .byte 0x82 # Â .data:000009A8 .byte 0x41 # A .data:000009A9 .byte 0x76 # v .data:000009AA .byte 0xFB # v .data:000009AB .byte 0x30 # 0 .data:000009AC .byte 4 .data:000009AD .byte 0xCF # ¦ .data:000009AE .byte 0xBE # - .data:000009AF .byte 0x89 # É .data:000009B0 .byte 0xBE # - .data:000009B1 .byte 0x89 # É .data:000009B2 .byte 4 .data:000009B3 .byte 0xCF # ¦ .data:000009B4 .byte 0xFB # v .data:000009B5 .byte 0x30 # 0 .data:000009B6 .byte 0x41 # A .data:000009B7 .byte 0x76 # v .data:000009B8 .byte 0x6D # m .data:000009B9 .byte 0x6A # j .data:000009BA .byte 7 .data:000009BB .byte 0xE7 # ÷ .data:000009BC .byte 0x75 # u .data:000009BD .byte 0x82 # Â .data:000009BE .byte 0xE3 # ó .data:000009BF .byte 0xB8 # ¬ .data:000009C0 .byte 0x1C .data:000009C1 .byte 0x47 # G .data:000009C2 .byte 0x8A # Ê .data:000009C3 .byte 0x7D # } .data:000009C4 .byte 0xF8 # ° .data:000009C5 .byte 0x18 .data:000009C6 .byte 0x92 # Ò .data:000009C7 .byte 0x95 # Õ .data:000009C8 .byte 0x82 # Â .data:000009C9 .byte 0x5A # Z .data:000009CA .byte 0x7D # } .data:000009CB .byte 0xA5 # å .data:000009CC .byte 0x7D # } .data:000009CD .byte 0xA5 # å .data:000009CE .byte 0x82 # Â .data:000009CF .byte 0x5A # Z .data:000009D0 .byte 0x82 # Â .data:000009D1 .byte 0x5A # Z .data:000009D2 .byte 0x7D # } .data:000009D3 .byte 0xA5 # å .data:000009D4 .byte 0x7D # } .data:000009D5 .byte 0xA5 # å .data:000009D6 .byte 0x82 # Â .data:000009D7 .byte 0x5A # Z .data:000009D8 .byte 0x1C .data:000009D9 .byte 0x47 # G .data:000009DA .byte 0x75 # u .data:000009DB .byte 0x82 # Â .data:000009DC .byte 0xF8 # ° .data:000009DD .byte 0x18 .data:000009DE .byte 0x6D # m .data:000009DF .byte 0x6A # j .data:000009E0 .byte 0x92 # Ò .data:000009E1 .byte 0x95 # Õ .data:000009E2 .byte 7 .data:000009E3 .byte 0xE7 # ÷ .data:000009E4 .byte 0x8A # Ê .data:000009E5 .byte 0x7D # } .data:000009E6 .byte 0xE3 # ó .data:000009E7 .byte 0xB8 # ¬ .data:000009E8 .byte 0xFB # v .data:000009E9 .byte 0x30 # 0 .data:000009EA .byte 0xBE # - .data:000009EB .byte 0x89 # É .data:000009EC .byte 0x41 # A .data:000009ED .byte 0x76 # v .data:000009EE .byte 4 .data:000009EF .byte 0xCF # ¦ .data:000009F0 .byte 4 .data:000009F1 .byte 0xCF # ¦ .data:000009F2 .byte 0x41 # A .data:000009F3 .byte 0x76 # v .data:000009F4 .byte 0xBE # - .data:000009F5 .byte 0x89 # É .data:000009F6 .byte 0xFB # v .data:000009F7 .byte 0x30 # 0 .data:000009F8 .byte 0xF8 # ° .data:000009F9 .byte 0x18 .data:000009FA .byte 0xE3 # ó .data:000009FB .byte 0xB8 # ¬ .data:000009FC .byte 0x6D # m .data:000009FD .byte 0x6A # j .data:000009FE .byte 0x75 # u .data:000009FF .byte 0x82 # Â .data:00000A00 .byte 0x8A # Ê .data:00000A01 .byte 0x7D # } .data:00000A02 .byte 0x92 # Ò .data:00000A03 .byte 0x95 # Õ .data:00000A04 .byte 0x1C .data:00000A05 .byte 0x47 # G .data:00000A06 .byte 7 .data:00000A07 .byte 0xE7 # ÷ .data:00000A08 .byte 0x50 # P .data:00000A09 .byte 0x73 # s .data:00000A0A .byte 0xE .data:00000A0B .byte 0 .data:00000A0C .byte 0 .data:00000A0D .byte 0 .data:00000A0E .byte 0x46 # F .data:00000A0F .byte 0 .data:00000A10 dword_A10: .word 0x1F801080 # DATA XREF: sub_5B0+38r .data:00000A14 dword_A14: .word 0x1F801084 # DATA XREF: sub_5B0+48r .data:00000A18 dword_A18: .word 0x1F801088 # DATA XREF: sub_4C0+34r .data:00000A18 # sub_4C0+94r ... .data:00000A1C dword_A1C: .word 0x1F801090 # DATA XREF: sub_640+48r .data:00000A20 dword_A20: .word 0x1F801094 # DATA XREF: sub_640+58r .data:00000A24 dword_A24: .word 0x1F801098 # DATA XREF: DecDCToutSync:loc_44Cr .data:00000A24 # sub_4C0+48r ... .data:00000A28 .byte 0xA0 # à .data:00000A29 .byte 0x10 .data:00000A2A .byte 0x80 # À .data:00000A2B .byte 0x1F .data:00000A2C .byte 0xA4 # ä .data:00000A2D .byte 0x10 .data:00000A2E .byte 0x80 # À .data:00000A2F .byte 0x1F .data:00000A30 .byte 0xA8 # è .data:00000A31 .byte 0x10 .data:00000A32 .byte 0x80 # À .data:00000A33 .byte 0x1F .data:00000A34 .byte 0xB0 # - .data:00000A35 .byte 0x10 .data:00000A36 .byte 0x80 # À .data:00000A37 .byte 0x1F .data:00000A38 .byte 0xB4 # + .data:00000A39 .byte 0x10 .data:00000A3A .byte 0x80 # À .data:00000A3B .byte 0x1F .data:00000A3C .byte 0xB8 # ¬ .data:00000A3D .byte 0x10 .data:00000A3E .byte 0x80 # À .data:00000A3F .byte 0x1F .data:00000A40 dword_A40: .word 0x1F801820 # DATA XREF: sub_5B0+58r .data:00000A44 dword_A44: .word 0x1F801824 # DATA XREF: sub_4C0:loc_4E4r .data:00000A44 # sub_4C0+58r ... .data:00000A48 dword_A48: .word 0x1F8010F0 # DATA XREF: sub_5B0+1Cr .data:00000A48 # sub_640+1Cr .data:00000A4C .align 4 .data:00000A4C .sdata:00000B00 # =========================================================================== .sdata:00000B00 .sdata:00000B00 # Segment type: Zero-length .sdata:00000B00 .sdata .sdata:00000B00 .sbss:00000C00 # =========================================================================== .sbss:00000C00 .sbss:00000C00 # Segment type: Zero-length .sbss:00000C00 .sbss .sbss:00000C00 .bss:00000D00 # =========================================================================== .bss:00000D00 .bss:00000D00 # Segment type: Zero-length .bss:00000D00 .bss .bss:00000D00 .bss:00000D00 # end
And here is example of using
/* * $PSLibId: Runtime Library Release 3.6$ */ /* * Movie Sample Program * * Copyright (C) 1994,5 by Sony Corporation * All rights Reserved * * CD-ROM ©ç[r[ðXg[~O·éTv * * Version Date * ------------------------------------------ * 1.00 Jul,14,1994 yutaka * 1.10 Sep,01,1994 suzu * 1.20 Oct,24,1994 yutaka(anim subroutine») * 1.30 Jun,02,1995 yutaka(ã) * 1.40 Jul,10,1995 masa(imgbuf_uobt@») * 1.50 Jul,20,1995 ume(æÊNAüÇ) */ #include <sys/types.h> #include <libetc.h> #include <libgte.h> #include <libgpu.h> #include <libcd.h> #include <r3000.h> #include <asm.h> #include <kernel.h> #define FILE_NAME "\\DATA\\MOV.STR;1" #define START_FRAME 1 #define END_FRAME 577 #define POS_X 36 #define POS_Y 24 #define SCR_WIDTH 320 #define SCR_HEIGHT 240 /* * 16bit/pixel mode or 24 bit/pixel mode : * fR[h·éFÌwè(16bit/24bit) */ #define IS_RGB24 1 /* 0:RGB16, 1:RGB24 */ #if IS_RGB24==1 #define PPW 3/2 /* pixel/short word : PV[g[hɽsNZ é© */ #define DCT_MODE 3 /* 24bit decode : 24bit [hÅfR[h */ #else #define PPW 1 /* pixel/short word : PV[g[hɽsNZ é© */ #define DCT_MODE 2 /* 16 bit decode : 16bit [hÅfR[h */ #endif /* * decode environment : fR[hÂ«Ï */ typedef struct { u_long *vlcbuf[2]; /* VLC buffer idoublej */ int vlcid; /* current decode buffer id : »Ý VLC fR[hobt@Ì ID */ u_short *imgbuf[2]; /* decode image buffer idoublej*/ int imgid; /* corrently use buffer id : »ÝgpÌæobt@ÌID */ RECT rect[2]; /* double buffer orign(upper left point) address on the VRAM (double buffer) : VRAMãÀWli_uobt@j */ int rectid; /* currently translating buffer id : »Ý]Ìobt@ ID */ RECT slice; /* the region decoded by once DecDCTout() : PñÌ DecDCTout Åæèo·Ìæ */ int isdone; /* the flag of decoding whole frame : Pt[ªÌf[^ªÅ«½© */ } DECENV; static DECENV dec; /* instance of DECENV : fR[h«ÌÀÌ */ /* * Ring buffer for STREAMING * minmum size is two frame : * Xg[~OpOobt@ * CD-ROM©çÌf[^ðXgbN * ÅáQt[ªÌeÊðmÛ·éB */ #define RING_SIZE 32 /* 32 sectors : PÊÍZN^ */ static u_long Ring_Buff[RING_SIZE*SECTOR_SIZE]; /* * VLC buffer(double buffer) * stock the result of VLC decode : * VLCobt@i_uobt@j * VLCfR[hãÌÔf[^ðXgbN */ #define VLC_BUFF_SIZE 320/2*256 /* not correct value : Æè ¦¸[ªÈ嫳 */ static u_long vlcbuf0[VLC_BUFF_SIZE]; static u_long vlcbuf1[VLC_BUFF_SIZE]; /* * image buffer(double buffer) * stock the result of MDEC * rectangle of 16(width) by XX(height) : * C[Wobt@i_uobt@j * DCTfR[hãÌC[Wf[^ðXgbN * ¡16sNZÌé`ÉfR[h] */ #define SLICE_IMG_SIZE 16*PPW*SCR_HEIGHT static u_short imgbuf0[SLICE_IMG_SIZE]; static u_short imgbuf1[SLICE_IMG_SIZE]; /* * »Ì¼ÌÏ */ static int StrWidth = 0; /* resolution of movie : [r[æÌ嫳i¡Æcj */ static int StrHeight = 0; static int Rewind_Switch; /* the end flag set after last frame : I¹tO èÌt[ÜÅĶ·éÆPÉÈé */ /* * prototypes : * ÖÌvg^Cvé¾ */ static int anim(); static void strSetDefDecEnv(DECENV *dec, int x0, int y0, int x1, int y1); static void strInit(CdlLOC *loc, void (*callback)()); static void strCallback(); static void strNextVlc(DECENV *dec); static void strSync(DECENV *dec, int mode); static u_long *strNext(DECENV *dec); static void strKickCD(CdlLOC *loc); main() { ResetCallback(); CdInit(); PadInit(0); ResetGraph(0); SetGraphDebug(0); while(1) { if(anim()==0) return 0; /* animation subroutine : Aj[VTu[` */ } } /* * animation subroutine forground process : * Aj[VTu[` tHAOEhvZX */ static int anim() { DISPENV disp; /* display buffer : \¦obt@ */ DRAWENV draw; /* drawing buffer : `æobt@ */ int id; /* display buffer id : \¦obt@Ì ID */ CdlFILE file; /* search file : t@CðT[` */ if (CdSearchFile(&file, FILE_NAME) == 0) { printf("file not found\n"); PadStop(); ResetGraph(3); StopCallback(); return 0; } /* set the position of vram : VRAMãÌÀWlðÝè */ strSetDefDecEnv(&dec, POS_X, POS_Y, POS_X, POS_Y+SCR_HEIGHT); /* init streaming system & kick cd : Xg[~Oú»Jn */ strInit(&file.pos, strCallback); /* VLC decode the first frame : ÅÌt[Ì VLCfR[hðsȤ */ strNextVlc(&dec); Rewind_Switch = 0; while (1) { /* start DCT decoding the result of VLC decoded data : VLCÌ®¹µ½f[^ðDCTfR[hJniMDECÖMj */ DecDCTin(dec.vlcbuf[dec.vlcid], DCT_MODE); /* prepare for recieving the result of DCT decode : DCTfR[hÊÌóMÌõð·é */ /* next DecDCTout is called in DecDCToutCallback : ±ÌãÌÍR[obN[`ÅsȤ */ DecDCTout(dec.imgbuf[dec.imgid], dec.slice.w*dec.slice.h/2); /* decode the next frame's VLC data : Ìt[Ìf[^Ì VLC fR[h */ strNextVlc(&dec); /* wait for whole decode process per 1 frame : Pt[ÌfR[hªI¹·éÌðÒ */ strSync(&dec, 0); /* wait for V-Vlank : V-BLNK ðÒ */ VSync(0); /* swap the display buffer : \¦obt@ðXbv */ /* notice that the display buffer is the opossite side of decoding buffer : \¦obt@ÍfR[hobt@ÌtÅ é±ÆÉÓ */ id = dec.rectid? 0: 1; SetDefDispEnv(&disp, 0, (id)*240, SCR_WIDTH*PPW, SCR_HEIGHT); /* SetDefDrawEnv(&draw, 0, (id)*240, SCR_WIDTH*PPW, SCR_HEIGHT);*/ #if IS_RGB24==1 disp.isrgb24 = IS_RGB24; disp.disp.w = disp.disp.w*2/3; #endif PutDispEnv(&disp); /* PutDrawEnv(&draw);*/ SetDispMask(1); /* display enable : \¦Â */ if(Rewind_Switch == 1) break; if(PadRead(1) & PADk) /* stop button pressed exit animation routine : Xgbv{^ª³ê½çAj[V ð²¯é */ break; } /* post processing of animation routine : Aj[Vã */ DecDCToutCallback(0); StUnSetRing(); CdControlB(CdlPause,0,0); if(Rewind_Switch==0) { PadStop(); ResetGraph(3); StopCallback(); return 0; } else return 1; } /* * init DECENV buffer0(x0,y0),buffer1(x1,y1) : * fR[h«ðú» * x0,y0 fR[hµ½æÌ]æÀWiobt@Oj * x1,y1 fR[hµ½æÌ]æÀWiobt@Pj * */ static void strSetDefDecEnv(DECENV *dec, int x0, int y0, int x1, int y1) { dec->vlcbuf[0] = vlcbuf0; dec->vlcbuf[1] = vlcbuf1; dec->vlcid = 0; dec->imgbuf[0] = imgbuf0; dec->imgbuf[1] = imgbuf1; dec->imgid = 0; /* width and height of rect[] are set dynamicaly according to STR data : rect[]Ì^³ÍSTRf[^ÌlÉæÁÄZbg³êé */ dec->rect[0].x = x0; dec->rect[0].y = y0; dec->rect[1].x = x1; dec->rect[1].y = y1; dec->rectid = 0; dec->slice.x = x0; dec->slice.y = y0; dec->slice.w = 16*PPW; dec->isdone = 0; } /* * init the streaming environment and start the cdrom : * Xg[~O«ðú»µÄJn */ static void strInit(CdlLOC *loc, void (*callback)()) { /* cold reset mdec : MDEC ðZbg */ DecDCTReset(0); /* set the callback after 1 block MDEC decoding : MDECªPfR[hubNðµ½ÌR[obNðè`·é */ DecDCToutCallback(callback); /* set the ring buffer : Oobt@ÌÝè */ StSetRing(Ring_Buff, RING_SIZE); /* init the streaming library : Xg[~OðZbgAbv */ /* end frame is set endless : I¹t[=ÉÝè */ StSetStream(IS_RGB24, START_FRAME, 0xffffffff, 0, 0); /* start the cdrom : Xg[~O[hJn */ strKickCD(loc); } /* * back ground process * callback of DecDCTout() : * obNOEhvZX * (DecDCTout() ªIÁ½ÉÄÎêéR[obNÖ) */ static void strCallback() { RECT snap_rect; int id; #if IS_RGB24==1 extern StCdIntrFlag; if(StCdIntrFlag) { StCdInterrupt(); /* on the RGB24 bit mode , call StCdInterrupt manually at this timing : RGB24Ìͱ±ÅN®·é */ StCdIntrFlag = 0; } #endif id = dec.imgid; snap_rect = dec.slice; /* switch the id of decoding buffer : æfR[hÌæÌØÖ¦ */ dec.imgid = dec.imgid? 0:1; /* update slice(rectangle) position : XCXiZòé`jÌæðÐÆÂEÉXV */ dec.slice.x += dec.slice.w; /* remaining slice ? : cèÌXCXª é©H */ if (dec.slice.x < dec.rect[dec.rectid].x + dec.rect[dec.rectid].w) { /* prepare for next slice : ÌXCXðfR[hJn */ DecDCTout(dec.imgbuf[dec.imgid], dec.slice.w*dec.slice.h/2); } /* last slice ; end of 1 frame : ÅIXCXPt[I¹ */ else { /* set the decoding done flag : IÁ½±ÆðÊm */ dec.isdone = 1; /* update the position on VRAM : ]æÀWlðXV */ dec.rectid = dec.rectid? 0: 1; dec.slice.x = dec.rect[dec.rectid].x; dec.slice.y = dec.rect[dec.rectid].y; } /* transfer the decoded data to VRAM : fR[hÊðt[obt@É] */ LoadImage(&snap_rect, (u_long *)dec.imgbuf[id]); } /* * execute VLC decoding * the decoding data is the next frame's : * VLCfR[hÌÀs * Ì1t[Ìf[^ÌVLCfR[hðsȤ */ static void strNextVlc(DECENV *dec) { int cnt = WAIT_TIME; u_long *next; static u_long *strNext(); /* get the 1 frame streaming data : f[^ðPt[ªæèo· */ while ((next = strNext(dec)) == 0) { if (--cnt == 0) return; } /* switch the decoding area : VLCfR[hÌæÌØÖ¦ */ dec->vlcid = dec->vlcid? 0: 1; /* VLC decode */ DecDCTvlc(next, dec->vlcbuf[dec->vlcid]); /* free the ring buffer : Oobt@Ìt[ÌÌæððú·é */ StFreeRing(next); return; } /* * get the 1 frame streaming data * return vale normal end -> top address of 1 frame streaming data * error -> NULL : * Oobt@©çÌf[^Ìæèoµ * iÔèlj ³íI¹Oobt@ÌæªAhX * G[¶NULL */ static u_long *strNext(DECENV *dec) { u_long *addr; StHEADER *sector; int cnt = WAIT_TIME; /* get the 1 frame streaming data withe TIME-OUT : f[^ðæèo·i^CAEgt«j */ while(StGetNext((u_long **)&addr,(u_long **)§or)) { if (--cnt == 0) return(0); } /* if the frame number greater than the end frame, set the end switch : »ÝÌt[ÔªwèlÈçI¹ */ if(sector->frameCount >= END_FRAME) { Rewind_Switch = 1; } /* if the resolution is differ to previous frame, clear frame buffer : æÊÌðxª OÌt[Æá¤ÈçÎ ClearImage ðÀs */ if(StrWidth != sector->width || StrHeight != sector->height) { RECT rect; setRECT(&rect, 0, 0, SCR_WIDTH * PPW, SCR_HEIGHT*2); ClearImage(&rect, 0, 0, 0); StrWidth = sector->width; StrHeight = sector->height; } /* set DECENV according to the data on the STR format : STRtH[}bgÌwb_Éí¹ÄfR[h«ðÏX·é */ dec->rect[0].w = dec->rect[1].w = StrWidth*PPW; dec->rect[0].h = dec->rect[1].h = StrHeight; dec->slice.h = StrHeight; return(addr); } /* * wait for finish decodeing 1 frame with TIME-OUT : * Pt[ÌfR[hI¹ðÒ * ÔðĵÄ^CAEgð`FbN */ static void strSync(DECENV *dec, int mode /* VOID */) { volatile u_long cnt = WAIT_TIME; /* wait for the decod is done flag set by background process : obNOEhvZXªisdoneð§ÄéÜÅÒ */ while (dec->isdone == 0) { if (--cnt == 0) { /* if timeout force to switch buffer : §IÉØÖ¦é */ printf("time out in decoding !\n"); dec->isdone = 1; dec->rectid = dec->rectid? 0: 1; dec->slice.x = dec->rect[dec->rectid].x; dec->slice.y = dec->rect[dec->rectid].y; } } dec->isdone = 0; } /* * start streaming : * CDROMðwèÊu©çXg[~OJn·é */ static void strKickCD(CdlLOC *loc) { u_char param; param = CdlModeSpeed; loop: /* seek to the destination : ÚInÜÅ Seek ·é */ while (CdControl(CdlSetloc, (u_char *)loc, 0) == 0); while (CdControl(CdlSetmode, ¶m, 0) == 0); VSync(3); /* wait for 3 VSync when changing the speed : {¬ÉØè֦ĩç RVÒÂKvª é */ /* out the read command with streaming mode : Xg[~O[hðÇÁµÄR}hs */ if(CdRead2(CdlModeStream|CdlModeSpeed|CdlModeRT) == 0) goto loop; }