177 | 177 |
|
178 | 178 |
rsp_break(hle, SP_STATUS_TASKDONE);
|
179 | 179 |
}
|
|
180 |
|
|
181 |
void fill_video_double_buffer_task(struct hle_t* hle)
|
|
182 |
{
|
|
183 |
int data_ptr = *dmem_u32(hle, TASK_UCODE_DATA);
|
|
184 |
|
|
185 |
int pSrc = *dram_u32(hle, data_ptr);
|
|
186 |
int pDest = *dram_u32(hle, data_ptr + 0x4);
|
|
187 |
int width = *dram_u32(hle, data_ptr + 0x8) >> 1;
|
|
188 |
int height = *dram_u32(hle, data_ptr + 0x10) << 1;
|
|
189 |
int stride = *dram_u32(hle, data_ptr + 0x1c) >> 1;
|
|
190 |
|
|
191 |
assert((*dram_u32(hle, data_ptr + 0x28) >> 16) == 0x8000);
|
|
192 |
|
|
193 |
#if 0 /* unused, but keep it for documentation purpose */
|
|
194 |
int arg3 = *dram_u32(hle, data_ptr + 0xc);
|
|
195 |
int arg5 = *dram_u32(hle, data_ptr + 0x14);
|
|
196 |
int arg6 = *dram_u32(hle, data_ptr + 0x18);
|
|
197 |
#endif
|
|
198 |
|
|
199 |
int i, j;
|
|
200 |
int r, g, b;
|
|
201 |
uint32_t pixel, pixel1, pixel2;
|
|
202 |
|
|
203 |
for(i = 0; i < height; i++)
|
|
204 |
{
|
|
205 |
for(j = 0; j < width; j=j+4)
|
|
206 |
{
|
|
207 |
pixel1 = *dram_u32(hle, pSrc+j);
|
|
208 |
pixel2 = *dram_u32(hle, pDest+j);
|
|
209 |
|
|
210 |
r = (int)((float)(((pixel1 >> 24)&0xff) + ((pixel2 >> 24)&0xff)) / 2.f);
|
|
211 |
g = (int)((float)(((pixel1 >> 16)&0xff) + ((pixel2 >> 16)&0xff)) / 2.f);
|
|
212 |
b = (int)((float)(((pixel1 >> 8)&0xff) + ((pixel2 >> 8)&0xff)) / 2.f);
|
|
213 |
|
|
214 |
pixel = (r << 24) | (g << 16) | (b << 8) | 0;
|
|
215 |
|
|
216 |
dram_store_u32(hle, &pixel, pDest+j, 1);
|
|
217 |
}
|
|
218 |
pSrc += stride;
|
|
219 |
pDest += stride;
|
|
220 |
}
|
|
221 |
|
|
222 |
rsp_break(hle, SP_STATUS_TASKDONE);
|
|
223 |
}
|