Codebase list mupen64plus-rsp-hle / b7e1df3
Merge pull request #61 from Gillou68310/re2 Implement RE2 fill video double buffer ucode bsmiles32 authored 6 years ago GitHub committed 6 years ago
3 changed file(s) with 46 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
382382 return true;
383383
384384 case 0x3d84:
385 /* FIXME: implement proper ucode
386 * Forward the task if possible,
387 * otherwise just skip it as it seems to work OK like that
388 */
389 if (HleForwardTask(hle->user_defined) != 0) {
390 rsp_break(hle, SP_STATUS_TASKDONE);
391 }
385 fill_video_double_buffer_task(hle);
392386 return true;
393387 }
394388
177177
178178 rsp_break(hle, SP_STATUS_TASKDONE);
179179 }
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 }
145145 /* Resident evil 2 ucode */
146146 void resize_bilinear_task(struct hle_t* hle);
147147 void decode_video_frame_task(struct hle_t* hle);
148
148 void fill_video_double_buffer_task(struct hle_t* hle);
149149
150150 #endif
151151