KAZIK/tools/tests/cinematic_master_probe.inc

133 lines
3.7 KiB
PHP

; Verify the production native stream reader, bad assets and fallback lifecycle.
.data
cinemaProbeMissing db 'build\cinematic-v3\fixtures\missing.cfm',0
cinemaProbeValid db 'build\cinematic-v3\fixtures\valid.cfm',0
cinemaProbeShort db 'build\cinematic-v3\fixtures\short.cfm',0
cinemaProbeChunk db 'build\cinematic-v3\fixtures\bad-chunk.cfm',0
cinemaProbeBank dd 0
cinemaProbeRng dd 0
cinemaProbeSumsPath db 'build\cinematic-v3\fixtures\expected-sums.bin',0
cinemaProbeSums dd 600 dup(0)
.code
RunCinematicMasterProbe PROC uses ebx esi edi
local count:DWORD
call InitPaths3D
call InitHall3D
call LoadTextures3D
mov bankroll,13579
mov rngSeed3D,2468
mov cinemaProbeBank,13579
mov cinemaProbeRng,2468
mov cinemaPathPtr,OFFSET cinemaProbeValid
call LoadCinematicMaster3D
test eax,eax
jz cinema_probe_fail
invoke RenderCinematicMaster3D,3250
test eax,eax
jz cinema_probe_fail
cmp cinemaCachedFrame,97
jne cinema_probe_fail
cmp DWORD PTR screenBuffer,00FF0000h
jne cinema_probe_fail
cmp DWORD PTR screenBuffer[4],0000FF00h
jne cinema_probe_fail
cmp DWORD PTR screenBuffer[8],000000FFh
jne cinema_probe_fail
; Cached image is copied again, so HUD/fade never accumulates into the source.
mov DWORD PTR screenBuffer,123456h
invoke RenderCinematicMaster3D,3250
test eax,eax
jz cinema_probe_fail
cmp DWORD PTR screenBuffer,123456h
je cinema_probe_fail
invoke RenderCinematicMaster3D,9999999
cmp cinemaCachedFrame,599
jne cinema_probe_fail
call FreeCinematicMaster3D
cmp cinemaPixels,0
jne cinema_probe_fail
cmp cinemaCompressed,0
jne cinema_probe_fail
cmp cinemaPacked,0
jne cinema_probe_fail
mov cinemaPathPtr,OFFSET cinemaProbeMissing
call LoadCinematicMaster3D
test eax,eax
jnz cinema_probe_fail
cmp cinemaFile,-1
jne cinema_probe_fail
mov cinemaPathPtr,OFFSET cinemaProbeShort
call LoadCinematicMaster3D
test eax,eax
jnz cinema_probe_fail
mov cinemaPathPtr,OFFSET cinemaProbeChunk
call LoadCinematicMaster3D
test eax,eax
jz cinema_probe_fail
invoke RenderCinematicMaster3D,0
test eax,eax
jnz cinema_probe_fail
cmp cinemaFile,-1
jne cinema_probe_fail
cmp filmWheel.pixels,0
je cinema_probe_fail
cmp filmStudio.pixels,0
je cinema_probe_fail
cmp bankroll,13579
jne cinema_probe_fail
cmp rngSeed3D,2468
jne cinema_probe_fail
mov cinemaPathPtr,OFFSET cinemaProbeValid
call LoadCinematicMaster3D
test eax,eax
jz cinema_probe_fail
call FreeStartupFilm3D
mov cinemaPathPtr,OFFSET cinemaMasterPath
call LoadCinematicMaster3D
test eax,eax
jz cinema_probe_fail
invoke CreateFileA,OFFSET cinemaProbeSumsPath,80000000h,1,0,3,80h,0
cmp eax,-1
je cinema_probe_fail
mov ebx,eax
invoke ReadFile,ebx,OFFSET cinemaProbeSums,600*4,ADDR count,0
push eax
invoke CloseHandle,ebx
pop eax
test eax,eax
jz cinema_probe_fail
cmp count,600*4
jne cinema_probe_fail
xor edi,edi
cinema_probe_actual_frame:
mov eax,edi
imul eax,1000
add eax,29
xor edx,edx
mov ecx,30
div ecx
invoke RenderCinematicMaster3D,eax
test eax,eax
jz cinema_probe_fail
cmp edi,cinemaCachedFrame
jne cinema_probe_fail
lea esi,screenBuffer
mov ecx,SCREEN_SIZE
xor ebx,ebx
cinema_probe_sum:
lodsd
add ebx,eax
dec ecx
jnz cinema_probe_sum
cmp ebx,cinemaProbeSums[edi*4]
jne cinema_probe_fail
inc edi
cmp edi,600
jb cinema_probe_actual_frame
call FreeCinematicMaster3D
xor eax,eax
ret
cinema_probe_fail:
mov eax,93
ret
RunCinematicMasterProbe ENDP