Rev 6763 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
205 | heavyiron | 1 | save_file: |
2 | pusha |
||
1098 | Lrz | 3 | bt dword [flags],0 |
4 | jnc .not_shooted |
||
205 | heavyiron | 5 | |
1608 | mario79 | 6 | cmp byte [fname_buf],0 |
1098 | Lrz | 7 | je .no_file_name |
205 | heavyiron | 8 | |
7832 | leency | 9 | mov [sign_n],4 |
205 | heavyiron | 10 | |
1098 | Lrz | 11 | ; генерируем имя файла |
12 | xor eax,eax |
||
13 | mov ecx,1056 |
||
14 | mov edi,file_name |
||
15 | rep stosb ; заполняем нулями |
||
205 | heavyiron | 16 | |
1608 | mario79 | 17 | mov esi,fname_buf |
1098 | Lrz | 18 | mov edi,file_name |
205 | heavyiron | 19 | .next: |
1098 | Lrz | 20 | mov ah,[esi] |
21 | test ah,ah |
||
22 | jz .str_end |
||
23 | cmp ah,'*' |
||
24 | jne .no_insert_number |
||
25 | jmp .insert_number |
||
205 | heavyiron | 26 | .no_insert_number: |
1098 | Lrz | 27 | mov [edi],ah |
28 | inc edi |
||
29 | inc esi |
||
30 | jmp .next |
||
205 | heavyiron | 31 | .insert_number: |
1098 | Lrz | 32 | bt word [ch6.flags],1 |
33 | jnc @f |
||
34 | mov eax,[cur_number] |
||
35 | movsx ebx,byte [sign_n] |
||
36 | push ebx |
||
37 | call int_to_str |
||
38 | pop ebx |
||
39 | add edi,ebx |
||
205 | heavyiron | 40 | @@: |
1098 | Lrz | 41 | inc esi |
42 | jmp .next |
||
205 | heavyiron | 43 | .str_end: |
44 | |||
6763 | IgorA | 45 | mcall SF_SYS_MISC, SSF_MEM_FREE, [sf_buf.bmp_header] |
1098 | Lrz | 46 | |
6763 | IgorA | 47 | ;create image struct |
48 | movsx ebx,word[scr_buf.width] |
||
49 | movsx edx,word[scr_buf.height] |
||
50 | stdcall [img_create], ebx, edx, Image.bpp24 |
||
51 | mov [sf_buf.bmp_area],eax |
||
52 | test eax,eax |
||
53 | jz @f |
||
54 | ;copy foto to image buffer |
||
55 | mov edi,[eax+Image.Data] |
||
56 | mov esi,[scr_buf.ptr] |
||
57 | movsx ecx,word[scr_buf.width] |
||
58 | movsx edx,word[scr_buf.height] |
||
59 | imul ecx,edx |
||
60 | imul ecx,3 |
||
61 | rep movsb |
||
1098 | Lrz | 62 | |
6763 | IgorA | 63 | ;encode image |
64 | stdcall [img_encode], eax, LIBIMG_FORMAT_PNG, 0 |
||
65 | test eax,eax |
||
66 | jz @f |
||
1098 | Lrz | 67 | |
6763 | IgorA | 68 | mov [sf_buf.bmp_header],eax |
69 | mov [sf_buf.end],ecx |
||
70 | @@: |
||
71 | stdcall [img_destroy], [sf_buf.bmp_area] |
||
307 | Lrz | 72 | |
1098 | Lrz | 73 | ; заполняем структуру для сохранения файла |
74 | mov ebp,fs_struc |
||
6763 | IgorA | 75 | mov [ebp],dword SSF_CREATE_FILE |
1098 | Lrz | 76 | |
77 | mov eax,[sf_buf.bmp_header] |
||
6763 | IgorA | 78 | mov ecx,[sf_buf.end] |
79 | mov [ebp+12],ecx ;file size |
||
1098 | Lrz | 80 | mov [ebp+16],eax |
81 | mov [ebp+21],dword file_name |
||
82 | |||
6763 | IgorA | 83 | draw_status saving |
84 | mcall SF_FILE, fs_struc |
||
1098 | Lrz | 85 | |
86 | test eax,eax |
||
87 | jne save_error |
||
205 | heavyiron | 88 | |
1098 | Lrz | 89 | inc dword [cur_number] |
90 | call draw_number |
||
205 | heavyiron | 91 | |
1098 | Lrz | 92 | draw_status saved_ok |
205 | heavyiron | 93 | |
94 | popa |
||
95 | ret |
||
96 | |||
97 | .no_file_name: |
||
1098 | Lrz | 98 | draw_status no_file_name |
205 | heavyiron | 99 | popa |
100 | ret |
||
101 | |||
102 | .not_shooted: |
||
1098 | Lrz | 103 | draw_status not_shooted |
205 | heavyiron | 104 | popa |
105 | ret |
||
106 | |||
107 | save_error: |
||
1098 | Lrz | 108 | cmp al,5 |
109 | jne @f |
||
110 | mov [status.text],dword bad_file_name |
||
205 | heavyiron | 111 | @@: |
1098 | Lrz | 112 | cmp al,8 |
113 | jne @f |
||
114 | mov [status.text],dword disk_filled |
||
205 | heavyiron | 115 | @@: |
116 | |||
1098 | Lrz | 117 | cmp al,9 |
118 | jne @f |
||
119 | mov [status.text],dword bad_fat_table |
||
205 | heavyiron | 120 | @@: |
121 | |||
1098 | Lrz | 122 | cmp al,10 |
123 | jne @f |
||
124 | mov [status.text],dword ac_den |
||
205 | heavyiron | 125 | @@: |
126 | |||
1098 | Lrz | 127 | cmp al,11 |
128 | jne @f |
||
129 | mov [status.text],dword device_er |
||
205 | heavyiron | 130 | @@: |
1098 | Lrz | 131 | call send_draw_status |
205 | heavyiron | 132 | popa |
133 | ret |