More lazyusf rsp_hle fixes

CQTexperiment
Chris Moeller 2014-04-02 18:46:59 -07:00
parent e6da9d6db7
commit a8ca0c83ff
1 changed files with 23 additions and 20 deletions

View File

@ -58,12 +58,12 @@ static int16_t* sample(struct hle_t* hle, unsigned pos)
static uint8_t* alist_u8(struct hle_t* hle, uint16_t dmem) static uint8_t* alist_u8(struct hle_t* hle, uint16_t dmem)
{ {
return u8(hle->alist_buffer, dmem); return &hle->alist_buffer[dmem ^ S8];
} }
static int16_t* alist_s16(struct hle_t* hle, uint16_t dmem) static int16_t* alist_s16(struct hle_t* hle, uint16_t dmem)
{ {
return (int16_t*)u16(hle->alist_buffer, dmem); return (int16_t*)(&hle->alist_buffer[dmem ^ S16]);
} }
@ -184,7 +184,7 @@ void alist_move(struct hle_t* hle, uint16_t dmemo, uint16_t dmemi, uint16_t coun
void alist_copy_every_other_sample(struct hle_t* hle, uint16_t dmemo, uint16_t dmemi, uint16_t count) void alist_copy_every_other_sample(struct hle_t* hle, uint16_t dmemo, uint16_t dmemi, uint16_t count)
{ {
while (count != 0) { while (count != 0) {
*alist_s16(hle, dmemo) = *alist_s16(hle, dmemi); *(uint16_t*)(alist_u8(hle, dmemo)) = *(uint16_t*)(alist_u8(hle, dmemi));
dmemo += 2; dmemo += 2;
dmemi += 4; dmemi += 4;
--count; --count;
@ -373,7 +373,7 @@ void alist_envmix_ge(
const int32_t *rate, const int32_t *rate,
uint32_t address) uint32_t address)
{ {
unsigned k; unsigned k, i, ptr;
size_t n = (aux) ? 4 : 2; size_t n = (aux) ? 4 : 2;
const int16_t* const in = (int16_t*)(hle->alist_buffer + dmemi); const int16_t* const in = (int16_t*)(hle->alist_buffer + dmemi);
@ -407,35 +407,38 @@ void alist_envmix_ge(
} }
count >>= 1; count >>= 1;
for (k = 0; k < count; ++k) { for (ptr = 0, k = 0; k < count; k += 8) {
int16_t gains[4]; int16_t gains[4];
int16_t* buffers[4]; int16_t* buffers[4];
int16_t l_vol = ramp_step(&ramps[0]); int16_t l_vol = ramp_step(&ramps[0]);
int16_t r_vol = ramp_step(&ramps[1]); int16_t r_vol = ramp_step(&ramps[1]);
buffers[0] = dl + (k^S); gains[0] = clamp_s16((l_vol * dry + 0x4000) >> 15);
buffers[1] = dr + (k^S); gains[1] = clamp_s16((r_vol * dry + 0x4000) >> 15);
buffers[2] = wl + (k^S); gains[2] = clamp_s16((l_vol * wet + 0x4000) >> 15);
buffers[3] = wr + (k^S); gains[3] = clamp_s16((r_vol * wet + 0x4000) >> 15);
gains[0] = clamp_s16((l_vol * dry + 0x4000) >> 15); for (i = 0; i < 8; i++) {
gains[1] = clamp_s16((r_vol * dry + 0x4000) >> 15); buffers[0] = dl + (ptr^S);
gains[2] = clamp_s16((l_vol * wet + 0x4000) >> 15); buffers[1] = dr + (ptr^S);
gains[3] = clamp_s16((r_vol * wet + 0x4000) >> 15); buffers[2] = wl + (ptr^S);
buffers[3] = wr + (ptr^S);
alist_envmix_mix(n, buffers, gains, in[k^S]); alist_envmix_mix(n, buffers, gains, in[ptr^S]);
ptr++;
}
} }
*(int16_t *)(save_buffer + 0) = wet; /* 0-1 */ *(int16_t *)(save_buffer + 0) = wet; /* 0-1 */
*(int16_t *)(save_buffer + 2) = dry; /* 2-3 */ *(int16_t *)(save_buffer + 2) = dry; /* 2-3 */
*(int32_t *)(save_buffer + 4) = ramps[0].target; /* 4-5 */ *(int32_t *)(save_buffer + 4) = (int32_t)ramps[0].target; /* 4-5 */
*(int32_t *)(save_buffer + 6) = ramps[1].target; /* 6-7 */ *(int32_t *)(save_buffer + 6) = (int32_t)ramps[1].target; /* 6-7 */
*(int32_t *)(save_buffer + 8) = ramps[0].step; /* 8-9 (save_buffer is a 16bit pointer) */ *(int32_t *)(save_buffer + 8) = (int32_t)ramps[0].step; /* 8-9 (save_buffer is a 16bit pointer) */
*(int32_t *)(save_buffer + 10) = ramps[1].step; /* 10-11 */ *(int32_t *)(save_buffer + 10) = (int32_t)ramps[1].step; /* 10-11 */
/**(int32_t *)(save_buffer + 12);*/ /* 12-13 */ /**(int32_t *)(save_buffer + 12);*/ /* 12-13 */
/**(int32_t *)(save_buffer + 14);*/ /* 14-15 */ /**(int32_t *)(save_buffer + 14);*/ /* 14-15 */
*(int32_t *)(save_buffer + 16) = ramps[0].value; /* 12-13 */ *(int32_t *)(save_buffer + 16) = (int32_t)ramps[0].value; /* 12-13 */
*(int32_t *)(save_buffer + 18) = ramps[1].value; /* 14-15 */ *(int32_t *)(save_buffer + 18) = (int32_t)ramps[1].value; /* 14-15 */
memcpy(hle->dram + address, (uint8_t *)save_buffer, 80); memcpy(hle->dram + address, (uint8_t *)save_buffer, 80);
} }