forked from KolibriOS/kolibrios
Rusty Earth - support of PCM_RING sound
git-svn-id: svn://kolibrios.org@5274 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
3c66f47b1e
commit
aec9ac073f
@ -15,4 +15,5 @@ if not exist bin mkdir rstearth_eng_bin
|
|||||||
@copy resources\barret_8bpp.png rstearth_eng_bin\barret_8bpp.png
|
@copy resources\barret_8bpp.png rstearth_eng_bin\barret_8bpp.png
|
||||||
@copy resources\walking_with_poseidon.wav rstearth_eng_bin\walking_with_poseidon.wav
|
@copy resources\walking_with_poseidon.wav rstearth_eng_bin\walking_with_poseidon.wav
|
||||||
@copy resources\flaunch.wav rstearth_eng_bin\flaunch.wav
|
@copy resources\flaunch.wav rstearth_eng_bin\flaunch.wav
|
||||||
|
@copy resources\misc_menu.wav rstearth_eng_bin\misc_menu.wav
|
||||||
@pause
|
@pause
|
@ -15,4 +15,5 @@ if not exist bin mkdir rstearth_rus_bin
|
|||||||
@copy resources\barret_8bpp.png rstearth_rus_bin\barret_8bpp.png
|
@copy resources\barret_8bpp.png rstearth_rus_bin\barret_8bpp.png
|
||||||
@copy resources\walking_with_poseidon.wav rstearth_rus_bin\walking_with_poseidon.wav
|
@copy resources\walking_with_poseidon.wav rstearth_rus_bin\walking_with_poseidon.wav
|
||||||
@copy resources\flaunch.wav rstearth_rus_bin\flaunch.wav
|
@copy resources\flaunch.wav rstearth_rus_bin\flaunch.wav
|
||||||
|
@copy resources\misc_menu.wav rstearth_rus_bin\misc_menu.wav
|
||||||
@pause
|
@pause
|
@ -254,6 +254,7 @@ npc_ifrit_icons_file_name db 'ifrit_8bpp.png',0
|
|||||||
npc_barret_icons_file_name db 'barret_8bpp.png',0
|
npc_barret_icons_file_name db 'barret_8bpp.png',0
|
||||||
background_music_file_name db 'walking_with_poseidon.wav',0
|
background_music_file_name db 'walking_with_poseidon.wav',0
|
||||||
stone_kick_sound_file_name db 'flaunch.wav',0
|
stone_kick_sound_file_name db 'flaunch.wav',0
|
||||||
|
menu_sound_file_name db 'misc_menu.wav',0
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
protagonist_route dd 2
|
protagonist_route dd 2
|
||||||
protagonist_position:
|
protagonist_position:
|
||||||
|
@ -155,5 +155,10 @@ load_all_sound_files:
|
|||||||
call load_sound
|
call load_sound
|
||||||
mov [stone_kick_sound],eax
|
mov [stone_kick_sound],eax
|
||||||
|
|
||||||
|
; load menu sound
|
||||||
|
mov ebx,menu_sound_file_name
|
||||||
|
call load_sound
|
||||||
|
mov [menu_sound],eax
|
||||||
|
|
||||||
ret
|
ret
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
@ -1,6 +1,6 @@
|
|||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
title:
|
title:
|
||||||
db 'Rusty Earth (Prototype 1.7) 26.12.2014',0
|
db 'Rusty Earth (Prototype 1.8) 28.12.2014',0
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
menu_game_label:
|
menu_game_label:
|
||||||
db 'GAME',0
|
db 'GAME',0
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
; Code page - Cyrillic OEM866
|
; Code page - Cyrillic OEM866
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
title:
|
title:
|
||||||
db '<27>¦ Ά ο ‡¥¬«ο (<28>ΰ®β®β¨― 1.7) 26.12.2014',0
|
db '<27>¦ Ά ο ‡¥¬«ο (<28>ΰ®β®β¨― 1.8) 28.12.2014',0
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
menu_game_label:
|
menu_game_label:
|
||||||
db 'ˆƒ<CB86>€',0
|
db 'ˆƒ<CB86>€',0
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
main_menu_start:
|
main_menu_start:
|
||||||
mov [main_menu_pointer],0
|
mov [main_menu_pointer],0
|
||||||
|
mov eax,[menu_sound]
|
||||||
|
mov [sounds_sample],eax
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
.red:
|
.red:
|
||||||
mov [menu_text_pointers],main_menu_text_pointers
|
mov [menu_text_pointers],main_menu_text_pointers
|
||||||
|
BIN
programs/games/rstearth/resources/misc_menu.wav
Normal file
BIN
programs/games/rstearth/resources/misc_menu.wav
Normal file
Binary file not shown.
@ -100,16 +100,20 @@ load_libraries l_libs_start,end_l_libs
|
|||||||
mov ebx,eax
|
mov ebx,eax
|
||||||
add ebx,1024
|
add ebx,1024
|
||||||
mov [wav_for_test_end],ebx
|
mov [wav_for_test_end],ebx
|
||||||
call initialize_sound_system
|
call test_wav_file
|
||||||
|
|
||||||
mov [sounds_flag],1
|
|
||||||
mov [music_flag],1
|
mov [music_flag],1
|
||||||
mcall 51,1,snd_background_music_thread_start,snd_background_music_thread_stack
|
mcall 51,1,snd_background_music_thread_start,snd_background_music_thread_stack
|
||||||
|
|
||||||
|
mov [sounds_flag],1
|
||||||
|
mcall 51,1,snd_kick_action_thread_start,snd_kick_action_thread_stack
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
menu_still:
|
menu_still:
|
||||||
jmp main_menu_start
|
jmp main_menu_start
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
start_level_0:
|
start_level_0:
|
||||||
|
mov eax,[stone_kick_sound]
|
||||||
|
mov [sounds_sample],eax
|
||||||
mov [death_of_protagonist],0
|
mov [death_of_protagonist],0
|
||||||
mov [protagonist_route],2
|
mov [protagonist_route],2
|
||||||
mov [protagonist_position.x],4
|
mov [protagonist_position.x],4
|
||||||
@ -170,6 +174,8 @@ button:
|
|||||||
mcall 51,1,thread_start,thread_stack
|
mcall 51,1,thread_start,thread_stack
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
@@:
|
@@:
|
||||||
|
mov [music_flag],2
|
||||||
|
mov [sounds_flag],2
|
||||||
mcall -1
|
mcall -1
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
draw_window:
|
draw_window:
|
||||||
|
@ -148,8 +148,125 @@ _CreateBuffer@12: ;format:dword,size:dword,p_str:dword
|
|||||||
pop ecx ebx
|
pop ecx ebx
|
||||||
ret 12
|
ret 12
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
|
;align 4
|
||||||
|
;_DestroyBuffer@4: ;str:dword
|
||||||
|
; push ebx ecx
|
||||||
|
; xor eax,eax
|
||||||
|
; lea ebx,[esp+12] ;[stream]
|
||||||
|
;
|
||||||
|
; push eax ;.out_size
|
||||||
|
; push eax ;.output
|
||||||
|
; push 4 ;.inp_size
|
||||||
|
; push ebx ;.input
|
||||||
|
; push SND_DESTROY_BUFF;.code
|
||||||
|
; push [hSound] ;.handle
|
||||||
|
;
|
||||||
|
; mov ecx, esp ;[handle]
|
||||||
|
; mcall 68,17
|
||||||
|
; add esp,24
|
||||||
|
; pop ecx ebx
|
||||||
|
; ret 4
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
;align 4
|
||||||
|
;_WaveOut@12: ;str:dword, src:dword, size:dword
|
||||||
|
; push ebx ecx
|
||||||
|
; xor eax,eax
|
||||||
|
; lea ebx,[esp+12] ;[stream]
|
||||||
|
;
|
||||||
|
; push eax ;.out_size
|
||||||
|
; push eax ;.output
|
||||||
|
; push 12 ;.inp_size
|
||||||
|
; push ebx ;.input
|
||||||
|
; push SND_OUT ;.code
|
||||||
|
; push dword [hSound] ;.handle
|
||||||
|
;
|
||||||
|
; mov ecx,esp
|
||||||
|
; mcall 68,17
|
||||||
|
; add esp,24
|
||||||
|
; pop ecx ebx
|
||||||
|
; ret 12
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
align 4
|
align 4
|
||||||
_DestroyBuffer@4: ;str:dword
|
_GetBufferSize@8: ;str:dword, p_size:dword
|
||||||
|
push ebx ecx
|
||||||
|
lea eax,[esp+16]
|
||||||
|
lea ebx,[esp+12] ;[stream]
|
||||||
|
|
||||||
|
push 4 ;.out_size
|
||||||
|
push eax ;.output
|
||||||
|
push 4 ;.inp_size
|
||||||
|
push ebx ;.input
|
||||||
|
push SND_GETBUFFSIZE;.code
|
||||||
|
push dword [hSound] ;.handle
|
||||||
|
|
||||||
|
mov ecx,esp
|
||||||
|
mcall 68,17
|
||||||
|
add esp,24
|
||||||
|
pop ecx ebx
|
||||||
|
ret 8
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
;align 4
|
||||||
|
;_GetBufferFree@8: ;str:dword, p_free:dword
|
||||||
|
; push ebx ecx
|
||||||
|
; lea ebx,[esp+12] ;[stream]
|
||||||
|
; push 0 ;storage for free_space
|
||||||
|
; mov eax,esp
|
||||||
|
;
|
||||||
|
; push 4 ;.out_size
|
||||||
|
; push eax ;.output
|
||||||
|
; push 4 ;.inp_size
|
||||||
|
; push ebx ;.input
|
||||||
|
; push SND_GETFREESPACE ;.code
|
||||||
|
; push dword [hSound] ;.handle
|
||||||
|
;
|
||||||
|
; mov ecx,esp
|
||||||
|
; mcall 68,17
|
||||||
|
; add esp, 24
|
||||||
|
; mov ecx,[esp+20] ; p_free
|
||||||
|
; pop dword [ecx]
|
||||||
|
; pop ecx ebx
|
||||||
|
; ret 8
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
align 4
|
||||||
|
_SetBuffer@16: ;str:dword, src:dword, offs:dword, size:dword
|
||||||
|
push ebx ecx
|
||||||
|
xor eax,eax
|
||||||
|
lea ebx,[esp+12] ;[stream]
|
||||||
|
|
||||||
|
push eax ;.out_size
|
||||||
|
push eax ;.output
|
||||||
|
push 16 ;.inp_size
|
||||||
|
push ebx ;.input
|
||||||
|
push SND_SETBUFF ;.code
|
||||||
|
push dword [hSound] ;.handle
|
||||||
|
|
||||||
|
mov ecx,esp
|
||||||
|
mcall 68,17
|
||||||
|
add esp,24
|
||||||
|
pop ecx ebx
|
||||||
|
ret 16
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
align 4
|
||||||
|
_PlayBuffer@8: ;str:dword,flags:dword
|
||||||
|
push ebx ecx
|
||||||
|
xor eax,eax
|
||||||
|
lea ebx,[esp+12] ;[stream]
|
||||||
|
|
||||||
|
push eax ;.out_size
|
||||||
|
push eax ;.output
|
||||||
|
push 8 ;.inp_size
|
||||||
|
push ebx ;.input
|
||||||
|
push SND_PLAY ;.code
|
||||||
|
push dword [hSound] ;.handle
|
||||||
|
|
||||||
|
mov ecx, esp
|
||||||
|
mcall 68,17
|
||||||
|
add esp, 24
|
||||||
|
pop ecx ebx
|
||||||
|
ret 8
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
align 4
|
||||||
|
_StopBuffer@4: ;str:dword
|
||||||
push ebx ecx
|
push ebx ecx
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
lea ebx,[esp+12] ;[stream]
|
lea ebx,[esp+12] ;[stream]
|
||||||
@ -158,33 +275,52 @@ _DestroyBuffer@4: ;str:dword
|
|||||||
push eax ;.output
|
push eax ;.output
|
||||||
push 4 ;.inp_size
|
push 4 ;.inp_size
|
||||||
push ebx ;.input
|
push ebx ;.input
|
||||||
push SND_DESTROY_BUFF;.code
|
push SND_STOP ;.code
|
||||||
push [hSound] ;.handle
|
|
||||||
|
|
||||||
mov ecx, esp ;[handle]
|
|
||||||
mcall 68,17
|
|
||||||
add esp,24
|
|
||||||
pop ecx ebx
|
|
||||||
ret 4
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
align 4
|
|
||||||
_WaveOut@12: ;str:dword, src:dword, size:dword
|
|
||||||
push ebx ecx
|
|
||||||
xor eax,eax
|
|
||||||
lea ebx,[esp+12] ;[stream]
|
|
||||||
|
|
||||||
push eax ;.out_size
|
|
||||||
push eax ;.output
|
|
||||||
push 12 ;.inp_size
|
|
||||||
push ebx ;.input
|
|
||||||
push SND_OUT ;.code
|
|
||||||
push dword [hSound] ;.handle
|
push dword [hSound] ;.handle
|
||||||
|
|
||||||
mov ecx,esp
|
mov ecx,esp
|
||||||
mcall 68,17
|
mcall 68,17
|
||||||
add esp,24
|
add esp,24
|
||||||
pop ecx ebx
|
pop ecx ebx
|
||||||
ret 12
|
ret 4
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
;align 4
|
||||||
|
;_GetBufferPos@8: ;str:dword, p_pos:dword
|
||||||
|
; push ebx ecx
|
||||||
|
; lea eax,[esp+16]
|
||||||
|
; lea ebx,[esp+12] ;[stream]
|
||||||
|
;
|
||||||
|
; push 4 ;.out_size
|
||||||
|
; push eax ;.output
|
||||||
|
; push 4 ;.inp_size
|
||||||
|
; push ebx ;.input
|
||||||
|
; push SND_GETPOS ;.code
|
||||||
|
; push dword [hSound] ;.handle
|
||||||
|
;
|
||||||
|
; mov ecx,esp
|
||||||
|
; mcall 68,17
|
||||||
|
; add esp,24
|
||||||
|
; pop ecx ebx
|
||||||
|
; ret 8
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
;align 4
|
||||||
|
;_SetBufferPos@8: ;str:dword, offs:dword
|
||||||
|
; push ebx ecx
|
||||||
|
; xor eax,eax
|
||||||
|
; lea ebx,[esp+12] ;[stream]
|
||||||
|
;
|
||||||
|
; push eax ;.out_size
|
||||||
|
; push eax ;.output
|
||||||
|
; push 8 ;.inp_size
|
||||||
|
; push ebx ;.input
|
||||||
|
; push SND_SETPOS ;.code
|
||||||
|
; push dword [hSound] ;.handle
|
||||||
|
;
|
||||||
|
; mov ecx,esp
|
||||||
|
; mcall 68,17
|
||||||
|
; add esp,24
|
||||||
|
; pop ecx ebx
|
||||||
|
; ret 8
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
align 4
|
align 4
|
||||||
proc _test_wav@4 stdcall, hdr:dword
|
proc _test_wav@4 stdcall, hdr:dword
|
||||||
|
@ -1,40 +1,12 @@
|
|||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
; init.obj
|
test_wav_file:
|
||||||
; _InitSound@4 Èíèò,
|
|
||||||
; _CreateBuffer@12 ñîçäàòü áóôåð,
|
|
||||||
; _DestroyBuffer@4 óäàëèòü áóôåð
|
|
||||||
;
|
|
||||||
; sndgetsize.obj
|
|
||||||
; _GetBufferSize@8 âçÿòü ðàçìåð áóôåðà,
|
|
||||||
; _GetBufferFree@8 WTF???
|
|
||||||
;
|
|
||||||
; setbuf.obj
|
|
||||||
; _SetBuffer@16 óñòàíîâèòü áóôåð,
|
|
||||||
; _PlayBuffer@8 èãðàòü áóôåð,
|
|
||||||
;
|
|
||||||
; stopbuf.obj
|
|
||||||
; _StopBuffer@4 îñòàíîâèòü áóôåð,
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
initialize_sound_system:
|
|
||||||
mov [sound_flag],1
|
mov [sound_flag],1
|
||||||
|
|
||||||
stdcall _InitSound@4,version
|
|
||||||
cmp eax,-1
|
|
||||||
je snd_init_fail
|
|
||||||
|
|
||||||
; DEBUGF 1, "Sound init successful %x\n",eax
|
|
||||||
mov eax,[version]
|
|
||||||
and eax,0xffff
|
|
||||||
cmp eax,SOUND_VERSION
|
|
||||||
jne snd_version_fail
|
|
||||||
|
|
||||||
; DEBUGF 1, "Sound version successful %x\n",eax
|
|
||||||
|
|
||||||
stdcall _test_wav@4,dword [wav_for_test] ;letter_1a
|
stdcall _test_wav@4,dword [wav_for_test] ;letter_1a
|
||||||
test eax,eax
|
test eax,eax
|
||||||
jz snd_test_wav_fail
|
jz snd_test_wav_fail
|
||||||
|
|
||||||
or eax,PCM_OUT
|
; or eax,PCM_OUT
|
||||||
|
or eax,PCM_RING
|
||||||
mov [snd_format],eax
|
mov [snd_format],eax
|
||||||
|
|
||||||
; DEBUGF 1, "Test wav successful %x\n",eax
|
; DEBUGF 1, "Test wav successful %x\n",eax
|
||||||
@ -43,32 +15,75 @@ initialize_sound_system:
|
|||||||
|
|
||||||
mov al,[sound_flag]
|
mov al,[sound_flag]
|
||||||
test al,al
|
test al,al
|
||||||
jz .exit
|
jnz .exit
|
||||||
|
|
||||||
stdcall _CreateBuffer@12,[snd_format],0,hBuff1
|
mov [sound_flag],2 ; close thread
|
||||||
cmp eax,-1
|
|
||||||
je snd_create_buffer_fail
|
|
||||||
|
|
||||||
; DEBUGF 1, "Create Buffer 1 successful %x\n",eax
|
|
||||||
|
|
||||||
stdcall _CreateBuffer@12,[snd_format],0,hBuff2
|
|
||||||
cmp eax,-1
|
|
||||||
je snd_create_buffer_fail
|
|
||||||
|
|
||||||
; DEBUGF 1, "Create Buffer 1 successful %x\n",eax
|
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
.exit:
|
.exit:
|
||||||
ret
|
ret
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
|
check_init_sound_busy:
|
||||||
|
cmp [init_sound_busy_flag],1
|
||||||
|
jne @f
|
||||||
|
|
||||||
|
mcall 5,1
|
||||||
|
mcall 68,1
|
||||||
|
jmp check_init_sound_busy
|
||||||
|
;--------------------------------------
|
||||||
|
@@:
|
||||||
|
mov [init_sound_busy_flag],1
|
||||||
|
ret
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
initialize_sound_system:
|
||||||
|
cmp [sound_flag],1
|
||||||
|
jne sound_exit
|
||||||
|
|
||||||
|
stdcall _InitSound@4,version
|
||||||
|
test eax,eax
|
||||||
|
jnz snd_init_fail
|
||||||
|
|
||||||
|
; DEBUGF 1, "Sound init successful %x\n",eax
|
||||||
|
|
||||||
|
mov eax,[version]
|
||||||
|
and eax,0xffff
|
||||||
|
cmp eax,SOUND_VERSION
|
||||||
|
jne snd_version_fail
|
||||||
|
|
||||||
|
; DEBUGF 1, "Sound version successful %x\n",eax
|
||||||
|
;--------------------------------------
|
||||||
|
stdcall _CreateBuffer@12,[snd_format],0,[hBuff_pointer]
|
||||||
|
test eax,eax
|
||||||
|
jnz snd_create_buffer_fail
|
||||||
|
|
||||||
|
; DEBUGF 1, "Create Buffer successful %x\n",eax
|
||||||
|
mov eax,[hBuff_pointer]
|
||||||
|
mov ebx,[hBuff_buffer_size_pointer]
|
||||||
|
stdcall _GetBufferSize@8,[eax],ebx ;hBuff1_buffer_size
|
||||||
|
|
||||||
|
test eax,eax
|
||||||
|
jnz snd_get_buffer_size_fail
|
||||||
|
|
||||||
|
mov ebx,[hBuff_buffer_size_pointer]
|
||||||
|
mov eax,[ebx]
|
||||||
|
; DEBUGF 1, "Get Buffer size successful size: %x\n",eax
|
||||||
|
shr eax,1
|
||||||
|
mov [ebx],eax
|
||||||
|
|
||||||
|
mov [init_sound_busy_flag],0
|
||||||
|
ret
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
sound_exit:
|
||||||
|
mcall -1
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
find_data_offset:
|
find_data_offset:
|
||||||
mov esi,[wav_for_test] ;letter_1a
|
mov esi,[wav_for_test]
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
@@:
|
@@:
|
||||||
cmp [esi],dword 'data'
|
cmp [esi],dword 'data'
|
||||||
je @f
|
je @f
|
||||||
|
|
||||||
inc esi
|
inc esi
|
||||||
cmp esi,[wav_for_test_end] ;letter_1a + letter_2b
|
cmp esi,[wav_for_test_end]
|
||||||
jne @b
|
jne @b
|
||||||
|
|
||||||
; DEBUGF 1, "find data offset fail\n"
|
; DEBUGF 1, "find data offset fail\n"
|
||||||
@ -76,89 +91,75 @@ find_data_offset:
|
|||||||
ret
|
ret
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
@@:
|
@@:
|
||||||
sub esi,[wav_for_test] ;letter_1a
|
sub esi,[wav_for_test]
|
||||||
add esi,4
|
add esi,4
|
||||||
mov [data_offset],esi
|
mov [data_offset],esi
|
||||||
ret
|
ret
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
wave_out:
|
|
||||||
; in:
|
|
||||||
; eax - adress of wav sample
|
|
||||||
; ebp - hBuff ; hardware buffer
|
|
||||||
pusha
|
|
||||||
; DEBUGF 1, "Wave out\n"
|
|
||||||
; check for correct data_offset
|
|
||||||
push eax
|
|
||||||
add eax,[data_offset]
|
|
||||||
sub eax,4
|
|
||||||
cmp [eax],dword 'data'
|
|
||||||
pop eax
|
|
||||||
je @f
|
|
||||||
|
|
||||||
mov [wav_for_test],eax
|
|
||||||
mov ebx,eax
|
|
||||||
add ebx,1024
|
|
||||||
mov [wav_for_test_end],ebx
|
|
||||||
call find_data_offset
|
|
||||||
cmp [sound_flag],0
|
|
||||||
jz .exit
|
|
||||||
;--------------------------------------
|
|
||||||
@@:
|
|
||||||
add eax,[data_offset]
|
|
||||||
mov ebx,[eax]
|
|
||||||
add eax,4
|
|
||||||
; DEBUGF 1, "src EAX: %x size EBX: %x\n",eax,ebx
|
|
||||||
; stdcall _WaveOut@12,[hBuff],eax,ebx
|
|
||||||
stdcall _WaveOut@12,ebp,eax,ebx
|
|
||||||
; DEBUGF 1, "return EAX: %x\n",eax
|
|
||||||
cmp eax,-1
|
|
||||||
popa
|
|
||||||
je snd_wave_out_fail
|
|
||||||
|
|
||||||
ret
|
|
||||||
;--------------------------------------
|
|
||||||
.exit:
|
|
||||||
popa
|
|
||||||
ret
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
snd_init_fail:
|
|
||||||
; DEBUGF 1, "Sound init fail %x\n",eax
|
|
||||||
mov [sound_flag],0
|
|
||||||
ret
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
snd_version_fail:
|
|
||||||
; DEBUGF 1, "Sound version fail %x\n",eax
|
|
||||||
mov [sound_flag],0
|
|
||||||
ret
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
snd_test_wav_fail:
|
snd_test_wav_fail:
|
||||||
; DEBUGF 1, "Test wav fail %x\n",eax
|
; DEBUGF 1, "Test wav fail %x\n",eax
|
||||||
mov [sound_flag],0
|
mov [sound_flag],0
|
||||||
ret
|
ret
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
|
snd_init_fail:
|
||||||
|
; DEBUGF 1, "Sound init fail %x\n",eax
|
||||||
|
jmp disable_sound
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
snd_version_fail:
|
||||||
|
; DEBUGF 1, "Sound version fail %x\n",eax
|
||||||
|
jmp disable_sound
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
snd_create_buffer_fail:
|
snd_create_buffer_fail:
|
||||||
; DEBUGF 1, "Create Buffer fail %x\n",eax
|
; DEBUGF 1, "Create Buffer fail %x\n",eax
|
||||||
mov [sound_flag],0
|
jmp disable_sound
|
||||||
ret
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
snd_wave_out_fail:
|
snd_get_buffer_size_fail:
|
||||||
; DEBUGF 1, "Wave Out fail\n"
|
; DEBUGF 1, "Get Buffer size fail %x\n",eax
|
||||||
|
jmp disable_sound
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
snd_play_buffer_fail:
|
||||||
|
; DEBUGF 1, "Play Buffer fail\n"
|
||||||
|
jmp disable_sound
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
snd_set_buffer_fail:
|
||||||
|
; DEBUGF 1, "Set Buffer fail\n"
|
||||||
|
jmp disable_sound
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
disable_sound:
|
||||||
mov [sound_flag],0
|
mov [sound_flag],0
|
||||||
ret
|
jmp sound_exit
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
snd_background_music_thread_start:
|
snd_background_music_thread_start:
|
||||||
|
call check_init_sound_busy
|
||||||
|
; DEBUGF 1, "snd_background_music_thread_start\n"
|
||||||
|
mov [hBuff_pointer], dword hBuff1
|
||||||
|
mov [hBuff_buffer_size_pointer], dword hBuff1_buffer_size
|
||||||
|
call initialize_sound_system
|
||||||
|
;--------------------------------------
|
||||||
|
.1:
|
||||||
|
cmp [music_flag],2
|
||||||
|
je sound_exit
|
||||||
|
|
||||||
cmp [music_flag],1
|
cmp [music_flag],1
|
||||||
je .start
|
je .start
|
||||||
|
.2:
|
||||||
mcall 5,50
|
mcall 5,1
|
||||||
mcall 68,1
|
mcall 68,1
|
||||||
jmp snd_background_music_thread_start
|
jmp .1
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
.start:
|
.start:
|
||||||
|
cmp [init_sound_busy_flag],1
|
||||||
|
je .2
|
||||||
|
|
||||||
|
; DEBUGF 1, "background_music Play Buffer start\n",eax
|
||||||
|
stdcall _PlayBuffer@8, [hBuff1], 0
|
||||||
|
test eax,eax
|
||||||
|
jnz snd_play_buffer_fail
|
||||||
|
|
||||||
|
; DEBUGF 1, "background_music Play Buffer successful EAX: %x\n",eax
|
||||||
|
;--------------------------------------
|
||||||
|
.start_1:
|
||||||
mov eax,[background_music]
|
mov eax,[background_music]
|
||||||
; call wave_out
|
|
||||||
; pusha
|
|
||||||
; DEBUGF 1, "Wave out\n"
|
|
||||||
; check for correct data_offset
|
; check for correct data_offset
|
||||||
push eax
|
push eax
|
||||||
add eax,[data_offset]
|
add eax,[data_offset]
|
||||||
@ -173,7 +174,7 @@ snd_background_music_thread_start:
|
|||||||
mov [wav_for_test_end],ebx
|
mov [wav_for_test_end],ebx
|
||||||
call find_data_offset
|
call find_data_offset
|
||||||
cmp [sound_flag],0
|
cmp [sound_flag],0
|
||||||
jz snd_background_music_thread_start ;.exit
|
jz .1
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
@@:
|
@@:
|
||||||
add eax,[data_offset]
|
add eax,[data_offset]
|
||||||
@ -184,27 +185,45 @@ snd_background_music_thread_start:
|
|||||||
; DEBUGF 1, "start EAX: %x\n",eax
|
; DEBUGF 1, "start EAX: %x\n",eax
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
.loop:
|
.loop:
|
||||||
cmp [music_flag],0
|
cmp [music_flag],1
|
||||||
je snd_background_music_thread_start
|
je @f
|
||||||
; DEBUGF 1, "src EBP: %x size EBX: %x\n",ebp,ebx
|
|
||||||
; stdcall _WaveOut@12,[hBuff],eax,ebx
|
|
||||||
stdcall _WaveOut@12,[hBuff1],ebp,8192
|
|
||||||
; DEBUGF 1, "return EAX: %x\n",eax
|
|
||||||
cmp eax,-1
|
|
||||||
; popa
|
|
||||||
je snd_wave_out_fail
|
|
||||||
|
|
||||||
add ebp,8192*2
|
stdcall _StopBuffer@4, [hBuff1]
|
||||||
cmp ebx,ebp
|
; DEBUGF 1, "Stop Buffer EAX: %x\n",eax
|
||||||
jbe .start
|
jmp .1
|
||||||
|
|
||||||
sub ebp,8192
|
|
||||||
jmp .loop
|
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
;.exit:
|
@@:
|
||||||
; popa
|
; get event data from the driver
|
||||||
; jmp snd_background_music_thread_start
|
; DEBUGF 1, "Get driver_notify_struct \n"
|
||||||
; mcall -1
|
push ebx
|
||||||
|
mcall 68,14,hBuff1_driver_notify_struct
|
||||||
|
pop ebx
|
||||||
|
; DEBUGF 1, "Check to code \n"
|
||||||
|
; check to code
|
||||||
|
cmp [hBuff1_driver_notify_struct], dword 0xFF000001
|
||||||
|
jne @b
|
||||||
|
; DEBUGF 1, "Check to stream \n"
|
||||||
|
; check to stream
|
||||||
|
mov eax,[hBuff1_driver_notify_struct+8]
|
||||||
|
cmp eax,[hBuff1]
|
||||||
|
jne @b
|
||||||
|
; DEBUGF 1, "Get buffer_offset \n"
|
||||||
|
; get buffer_offset
|
||||||
|
mov eax,[hBuff1_driver_notify_struct+12]
|
||||||
|
mov [hBuff1_buffer_offset],eax
|
||||||
|
; DEBUGF 1, "src EBP: %x size EBX: %x\n",ebp,ebx
|
||||||
|
stdcall _SetBuffer@16, [hBuff1], ebp, [hBuff1_buffer_offset], [hBuff1_buffer_size]
|
||||||
|
test eax,eax
|
||||||
|
jnz snd_set_buffer_fail
|
||||||
|
|
||||||
|
; DEBUGF 1, "Set Buffer successful EAX: %x\n",eax
|
||||||
|
add ebp,[hBuff1_buffer_size]
|
||||||
|
add ebp,[hBuff1_buffer_size]
|
||||||
|
cmp ebx,ebp
|
||||||
|
jbe .start_1
|
||||||
|
|
||||||
|
sub ebp,[hBuff1_buffer_size]
|
||||||
|
jmp .loop
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
snd_kick_action:
|
snd_kick_action:
|
||||||
cmp [sounds_flag],1
|
cmp [sounds_flag],1
|
||||||
@ -213,16 +232,109 @@ snd_kick_action:
|
|||||||
cmp [snd_kick_flag],1
|
cmp [snd_kick_flag],1
|
||||||
je @f
|
je @f
|
||||||
|
|
||||||
mcall 51,1,snd_kick_action_thread_start,snd_kick_action_thread_stack
|
mov [snd_kick_flag],1
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
@@:
|
@@:
|
||||||
ret
|
ret
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
snd_kick_action_thread_start:
|
snd_kick_action_thread_start:
|
||||||
mov [snd_kick_flag],1
|
call check_init_sound_busy
|
||||||
mov eax,[stone_kick_sound]
|
; DEBUGF 1, "snd_kick_action_thread_start\n"
|
||||||
mov ebp,[hBuff2]
|
mov [hBuff_pointer], dword hBuff2
|
||||||
call wave_out
|
mov [hBuff_buffer_size_pointer], dword hBuff2_buffer_size
|
||||||
|
call initialize_sound_system
|
||||||
|
;--------------------------------------
|
||||||
|
.1:
|
||||||
|
cmp [sounds_flag],2
|
||||||
|
je sound_exit
|
||||||
|
|
||||||
|
cmp [sounds_flag],0
|
||||||
|
je @f
|
||||||
|
|
||||||
|
cmp [snd_kick_flag],1
|
||||||
|
je .start
|
||||||
|
;--------------------------------------
|
||||||
|
@@:
|
||||||
|
mcall 5,1
|
||||||
|
mcall 68,1
|
||||||
|
jmp .1
|
||||||
|
;--------------------------------------
|
||||||
|
.start:
|
||||||
|
; DEBUGF 1, "kick_action Play Buffer start\n"
|
||||||
|
stdcall _PlayBuffer@8, [hBuff2], 0
|
||||||
|
test eax,eax
|
||||||
|
jnz snd_play_buffer_fail
|
||||||
|
|
||||||
|
; DEBUGF 1, "kick_action Play Buffer successful EAX: %x\n",eax
|
||||||
|
|
||||||
|
mov eax,[sounds_sample] ;[stone_kick_sound]
|
||||||
|
; check for correct data_offset
|
||||||
|
push eax
|
||||||
|
add eax,[data_offset]
|
||||||
|
sub eax,4
|
||||||
|
cmp [eax],dword 'data'
|
||||||
|
pop eax
|
||||||
|
je @f
|
||||||
|
|
||||||
|
mov [wav_for_test],eax
|
||||||
|
mov ebx,eax
|
||||||
|
add ebx,1024
|
||||||
|
mov [wav_for_test_end],ebx
|
||||||
|
call find_data_offset
|
||||||
|
cmp [sound_flag],0
|
||||||
|
jz .1
|
||||||
|
;--------------------------------------
|
||||||
|
@@:
|
||||||
|
add eax,[data_offset]
|
||||||
|
mov ebx,[eax]
|
||||||
|
add eax,4
|
||||||
|
mov ebp,eax
|
||||||
|
add ebx,eax
|
||||||
|
; DEBUGF 1, "start EAX: %x\n",eax
|
||||||
|
;--------------------------------------
|
||||||
|
.loop:
|
||||||
|
cmp [sounds_flag],1
|
||||||
|
je @f
|
||||||
|
|
||||||
|
stdcall _StopBuffer@4, [hBuff2]
|
||||||
|
; DEBUGF 1, "Stop Buffer EAX: %x\n",eax
|
||||||
|
jmp .1
|
||||||
|
;--------------------------------------
|
||||||
|
@@:
|
||||||
|
; get event data from the driver
|
||||||
|
; DEBUGF 1, "Get driver_notify_struct \n"
|
||||||
|
push ebx
|
||||||
|
mcall 68,14,hBuff2_driver_notify_struct
|
||||||
|
pop ebx
|
||||||
|
; DEBUGF 1, "Check to code \n"
|
||||||
|
; check to code
|
||||||
|
cmp [hBuff2_driver_notify_struct], dword 0xFF000001
|
||||||
|
jne @b
|
||||||
|
; DEBUGF 1, "Check to stream \n"
|
||||||
|
; check to stream
|
||||||
|
mov eax,[hBuff2_driver_notify_struct+8]
|
||||||
|
cmp eax,[hBuff2]
|
||||||
|
jne @b
|
||||||
|
; DEBUGF 1, "Get buffer_offset \n"
|
||||||
|
; get buffer_offset
|
||||||
|
mov eax,[hBuff2_driver_notify_struct+12]
|
||||||
|
mov [hBuff2_buffer_offset],eax
|
||||||
|
; DEBUGF 1, "src EBP: %x size EBX: %x\n",ebp,ebx
|
||||||
|
stdcall _SetBuffer@16, [hBuff2], ebp, [hBuff2_buffer_offset], [hBuff2_buffer_size]
|
||||||
|
test eax,eax
|
||||||
|
jnz snd_set_buffer_fail
|
||||||
|
|
||||||
|
; DEBUGF 1, "Set Buffer successful EAX: %x\n",eax
|
||||||
|
add ebp,[hBuff2_buffer_size]
|
||||||
|
add ebp,[hBuff2_buffer_size]
|
||||||
|
cmp ebx,ebp
|
||||||
|
jbe .exit
|
||||||
|
|
||||||
|
sub ebp,[hBuff2_buffer_size]
|
||||||
|
jmp .loop
|
||||||
|
;--------------------------------------
|
||||||
|
.exit:
|
||||||
|
stdcall _StopBuffer@4, [hBuff2]
|
||||||
mov [snd_kick_flag],0
|
mov [snd_kick_flag],0
|
||||||
mcall -1
|
jmp .1
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
@ -13,6 +13,7 @@ snd_kick_flag rb 1
|
|||||||
main_menu_pointer rb 1
|
main_menu_pointer rb 1
|
||||||
settings_menu_pointer rb 1
|
settings_menu_pointer rb 1
|
||||||
use_separate_draw_text rb 1
|
use_separate_draw_text rb 1
|
||||||
|
init_sound_busy_flag rb 1
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
align 4
|
align 4
|
||||||
N_error rd 1
|
N_error rd 1
|
||||||
@ -30,7 +31,10 @@ npc_ifrit_icons rd 1
|
|||||||
npc_barret_icons rd 1
|
npc_barret_icons rd 1
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
background_music rd 1
|
background_music rd 1
|
||||||
|
sounds_sample rd 1
|
||||||
|
|
||||||
stone_kick_sound rd 1
|
stone_kick_sound rd 1
|
||||||
|
menu_sound rd 1
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
show_tiles_iterations rd 1
|
show_tiles_iterations rd 1
|
||||||
characters_offset_x rd 1
|
characters_offset_x rd 1
|
||||||
@ -58,10 +62,21 @@ version rd 1 ; версия интерфейса, текущая 0x0101
|
|||||||
; Окончательно формат устанавливается вызовом SetFormat.
|
; Окончательно формат устанавливается вызовом SetFormat.
|
||||||
snd_format rd 1 ; формат данных
|
snd_format rd 1 ; формат данных
|
||||||
; хэндл буфера
|
; хэндл буфера
|
||||||
;hBuff rd 1
|
hBuff_pointer rd 1
|
||||||
|
hBuff_buffer_size_pointer rd 1
|
||||||
|
|
||||||
hBuff1 rd 1
|
hBuff1 rd 1
|
||||||
hBuff2 rd 1
|
hBuff2 rd 1
|
||||||
|
|
||||||
|
hBuff1_buffer_size rd 1
|
||||||
|
hBuff2_buffer_size rd 1
|
||||||
|
|
||||||
|
hBuff1_buffer_offset rd 1
|
||||||
|
hBuff2_buffer_offset rd 1
|
||||||
|
|
||||||
|
hBuff1_driver_notify_struct rd 6 ; структура события от драйвера
|
||||||
|
hBuff2_driver_notify_struct rd 6 ; структура события от драйвера
|
||||||
|
|
||||||
data_offset rd 1
|
data_offset rd 1
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
voice_samples_start rd 1 ; start of *.SMP
|
voice_samples_start rd 1 ; start of *.SMP
|
||||||
|
Loading…
Reference in New Issue
Block a user