forked from sin365/AxibugEmuOnline
MAME:内联渲染和音频函数,缓存一些数组高频读取固定index,减少寻址
This commit is contained in:
parent
200ee3830b
commit
909d1b35f1
@ -325,7 +325,8 @@
|
||||
red = ((Video.bitmapbaseN_Ptrs[Video.curbitmap][i] & 0xff0000) >> 16) * bright / 0xff;
|
||||
green = ((Video.bitmapbaseN_Ptrs[Video.curbitmap][i] & 0xff00) >> 8) * bright / 0xff;
|
||||
blue = (Video.bitmapbaseN_Ptrs[Video.curbitmap][i] & 0xff) * bright / 0xff;
|
||||
Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)Palette.make_argb(0xff, red, green, blue);
|
||||
//Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)Palette.make_argb(0xff, red, green, blue);
|
||||
Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)((((uint)(0xff) & 0xff) << 24) | (((uint)(blue) & 0xff) << 16) | (((uint)(green) & 0xff) << 8) | ((uint)(red) & 0xff));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,9 +143,20 @@ namespace MAME.Core
|
||||
rows = 0x20;
|
||||
return rows * 0x10;
|
||||
}
|
||||
//public static bool sprite_on_scanline(int scanline, int y, int rows)
|
||||
//{
|
||||
// int max_y = (y + rows_to_height(rows) - 1) & 0x1ff;
|
||||
// return (((max_y >= y) && (scanline >= y) && (scanline <= max_y)) ||
|
||||
// ((max_y < y) && ((scanline >= y) || (scanline <= max_y))));
|
||||
//}
|
||||
|
||||
//手动内联
|
||||
public static bool sprite_on_scanline(int scanline, int y, int rows)
|
||||
{
|
||||
int max_y = (y + rows_to_height(rows) - 1) & 0x1ff;
|
||||
//int max_y = (y + rows_to_height(rows) - 1) & 0x1ff;
|
||||
if ((rows == 0) || (rows > 0x20))
|
||||
rows = 0x20;
|
||||
int max_y = (y + (rows * 0x10) - 1) & 0x1ff;
|
||||
return (((max_y >= y) && (scanline >= y) && (scanline <= max_y)) ||
|
||||
((max_y < y) && ((scanline >= y) || (scanline <= max_y))));
|
||||
}
|
||||
@ -405,7 +416,16 @@ namespace MAME.Core
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (sprite_on_scanline(scanline, y, rows))
|
||||
|
||||
//if (sprite_on_scanline(scanline, y, rows))
|
||||
//手动内联 开始
|
||||
int tempRows = rows;
|
||||
if ((rows == 0) || (rows > 0x20))
|
||||
tempRows = 0x20;
|
||||
int max_y = (y + (tempRows * 0x10) - 1) & 0x1ff;
|
||||
if (((max_y >= y) && (scanline >= y) && (scanline <= max_y)) ||
|
||||
((max_y < y) && ((scanline >= y) || (scanline <= max_y))))
|
||||
//手动内联 结束
|
||||
{
|
||||
sprite_line = (scanline - y) & 0x1ff;
|
||||
zoom_line = sprite_line & 0xff;
|
||||
@ -704,7 +724,17 @@ namespace MAME.Core
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!sprite_on_scanline(scanline, y, rows))
|
||||
|
||||
//if (!sprite_on_scanline(scanline, y, rows))
|
||||
|
||||
//手动内联 开始
|
||||
int tempRows = rows;
|
||||
if ((rows == 0) || (rows > 0x20))
|
||||
tempRows = 0x20;
|
||||
int max_y = (y + (tempRows * 0x10) - 1) & 0x1ff;
|
||||
if (!(((max_y >= y) && (scanline >= y) && (scanline <= max_y)) ||
|
||||
((max_y < y) && ((scanline >= y) || (scanline <= max_y)))))
|
||||
//手动内联 结束
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -482,8 +482,9 @@ namespace MAME.Core
|
||||
}
|
||||
private uint volume_calc(int c, int s)
|
||||
{
|
||||
int AM = LFO_AM >> CH[c].ams;
|
||||
return (uint)(CH[c].SLOT[s].vol_out + (AM & CH[c].SLOT[s].AMmask));
|
||||
//int AM = LFO_AM >> CH[c].ams;
|
||||
//return (uint)(CH[c].SLOT[s].vol_out + (AM & CH[c].SLOT[s].AMmask));
|
||||
return (uint)(CH[c].SLOT[s].vol_out + ((LFO_AM >> CH[c].ams) & CH[c].SLOT[s].AMmask));
|
||||
}
|
||||
private void update_phase_lfo_slot(int s, int pms, uint block_fnum)
|
||||
{
|
||||
@ -558,15 +559,93 @@ namespace MAME.Core
|
||||
CH[c].SLOT[3].phase += (uint)CH[c].SLOT[3].Incr;
|
||||
}
|
||||
}
|
||||
//public void chan_calc(int c, int chnum)
|
||||
//{
|
||||
// uint eg_out;
|
||||
// out_fm[8] = out_fm[9] = out_fm[10] = out_fm[11] = 0;//m2 = c1 = c2 = mem = 0;
|
||||
// set_mem(c);
|
||||
// eg_out = volume_calc(c, 0);
|
||||
// int out1 = CH[c].op1_out0 + CH[c].op1_out1;
|
||||
// CH[c].op1_out0 = CH[c].op1_out1;
|
||||
// set_value1(c);
|
||||
// CH[c].op1_out1 = 0;
|
||||
// if (eg_out < 832)
|
||||
// {
|
||||
// if (CH[c].FB == 0)
|
||||
// {
|
||||
// out1 = 0;
|
||||
// }
|
||||
// CH[c].op1_out1 = op_calc1(CH[c].SLOT[0].phase, eg_out, (out1 << CH[c].FB));
|
||||
// }
|
||||
// eg_out = volume_calc(c, 1);
|
||||
// if (eg_out < 832)
|
||||
// {
|
||||
// out_fm[iconnect3[c]] += op_calc(CH[c].SLOT[1].phase, eg_out, out_fm[8]);
|
||||
// }
|
||||
// eg_out = volume_calc(c, 2);
|
||||
// if (eg_out < 832)
|
||||
// {
|
||||
// out_fm[iconnect2[c]] += op_calc(CH[c].SLOT[2].phase, eg_out, out_fm[9]);
|
||||
// }
|
||||
// eg_out = volume_calc(c, 3);
|
||||
// if (eg_out < 832)
|
||||
// {
|
||||
// out_fm[iconnect4[c]] += op_calc(CH[c].SLOT[3].phase, eg_out, out_fm[10]);
|
||||
// }
|
||||
// CH[c].mem_value = out_fm[11];//mem;
|
||||
// if (CH[c].pms != 0)
|
||||
// {
|
||||
// if (((ST.mode & 0xC0) != 0) && (chnum == 2))
|
||||
// {
|
||||
// update_phase_lfo_slot(0, CH[c].pms, SL3.block_fnum[1]);
|
||||
// update_phase_lfo_slot(2, CH[c].pms, SL3.block_fnum[2]);
|
||||
// update_phase_lfo_slot(1, CH[c].pms, SL3.block_fnum[0]);
|
||||
// update_phase_lfo_slot(3, CH[c].pms, CH[c].block_fnum);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// update_phase_lfo_channel(CH, c);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// CH[c].SLOT[0].phase += (uint)CH[c].SLOT[0].Incr;
|
||||
// CH[c].SLOT[2].phase += (uint)CH[c].SLOT[2].Incr;
|
||||
// CH[c].SLOT[1].phase += (uint)CH[c].SLOT[1].Incr;
|
||||
// CH[c].SLOT[3].phase += (uint)CH[c].SLOT[3].Incr;
|
||||
// }
|
||||
//}
|
||||
|
||||
//手动内联
|
||||
public void chan_calc(int c, int chnum)
|
||||
{
|
||||
uint eg_out;
|
||||
out_fm[8] = out_fm[9] = out_fm[10] = out_fm[11] = 0;//m2 = c1 = c2 = mem = 0;
|
||||
set_mem(c);
|
||||
eg_out = volume_calc(c, 0);
|
||||
|
||||
//减少寻址
|
||||
int imem_To_c = imem[c];//
|
||||
FM_SLOT[] CH_c_SLOT = CH[c].SLOT;//因为是引用类型,所以敢这么玩
|
||||
|
||||
//set_mem(c);
|
||||
if (imem_To_c == 8 || imem_To_c == 10 || imem_To_c == 11)
|
||||
out_fm[imem_To_c] = CH[c].mem_value;
|
||||
|
||||
//eg_out = volume_calc(c, 0);
|
||||
eg_out = (uint)(CH_c_SLOT[0].vol_out + ((LFO_AM >> CH[c].ams) & CH_c_SLOT[0].AMmask));
|
||||
|
||||
int out1 = CH[c].op1_out0 + CH[c].op1_out1;
|
||||
CH[c].op1_out0 = CH[c].op1_out1;
|
||||
set_value1(c);
|
||||
|
||||
//set_value1(c);
|
||||
if (iconnect1[c] == 12)
|
||||
{
|
||||
out_fm[11] = out_fm[9] = out_fm[10] = CH[c].op1_out0;
|
||||
}
|
||||
else
|
||||
{
|
||||
out_fm[iconnect1[c]] = CH[c].op1_out0;
|
||||
}
|
||||
|
||||
CH[c].op1_out1 = 0;
|
||||
if (eg_out < 832)
|
||||
{
|
||||
@ -574,22 +653,25 @@ namespace MAME.Core
|
||||
{
|
||||
out1 = 0;
|
||||
}
|
||||
CH[c].op1_out1 = op_calc1(CH[c].SLOT[0].phase, eg_out, (out1 << CH[c].FB));
|
||||
CH[c].op1_out1 = op_calc1(CH_c_SLOT[0].phase, eg_out, (out1 << CH[c].FB));
|
||||
}
|
||||
eg_out = volume_calc(c, 1);
|
||||
//eg_out = volume_calc(c, 1);
|
||||
eg_out = (uint)(CH_c_SLOT[1].vol_out + ((LFO_AM >> CH[c].ams) & CH_c_SLOT[1].AMmask));
|
||||
if (eg_out < 832)
|
||||
{
|
||||
out_fm[iconnect3[c]] += op_calc(CH[c].SLOT[1].phase, eg_out, out_fm[8]);
|
||||
out_fm[iconnect3[c]] += op_calc(CH_c_SLOT[1].phase, eg_out, out_fm[8]);
|
||||
}
|
||||
eg_out = volume_calc(c, 2);
|
||||
//eg_out = volume_calc(c, 2);
|
||||
eg_out = (uint)(CH_c_SLOT[2].vol_out + ((LFO_AM >> CH[c].ams) & CH_c_SLOT[2].AMmask));
|
||||
if (eg_out < 832)
|
||||
{
|
||||
out_fm[iconnect2[c]] += op_calc(CH[c].SLOT[2].phase, eg_out, out_fm[9]);
|
||||
out_fm[iconnect2[c]] += op_calc(CH_c_SLOT[2].phase, eg_out, out_fm[9]);
|
||||
}
|
||||
eg_out = volume_calc(c, 3);
|
||||
//eg_out = volume_calc(c, 3);
|
||||
eg_out = (uint)(CH_c_SLOT[3].vol_out + ((LFO_AM >> CH[c].ams) & CH_c_SLOT[3].AMmask));
|
||||
if (eg_out < 832)
|
||||
{
|
||||
out_fm[iconnect4[c]] += op_calc(CH[c].SLOT[3].phase, eg_out, out_fm[10]);
|
||||
out_fm[iconnect4[c]] += op_calc(CH_c_SLOT[3].phase, eg_out, out_fm[10]);
|
||||
}
|
||||
CH[c].mem_value = out_fm[11];//mem;
|
||||
if (CH[c].pms != 0)
|
||||
@ -608,10 +690,10 @@ namespace MAME.Core
|
||||
}
|
||||
else
|
||||
{
|
||||
CH[c].SLOT[0].phase += (uint)CH[c].SLOT[0].Incr;
|
||||
CH[c].SLOT[2].phase += (uint)CH[c].SLOT[2].Incr;
|
||||
CH[c].SLOT[1].phase += (uint)CH[c].SLOT[1].Incr;
|
||||
CH[c].SLOT[3].phase += (uint)CH[c].SLOT[3].Incr;
|
||||
CH_c_SLOT[0].phase += (uint)CH_c_SLOT[0].Incr;
|
||||
CH_c_SLOT[2].phase += (uint)CH_c_SLOT[2].Incr;
|
||||
CH_c_SLOT[1].phase += (uint)CH_c_SLOT[1].Incr;
|
||||
CH_c_SLOT[3].phase += (uint)CH_c_SLOT[3].Incr;
|
||||
}
|
||||
}
|
||||
public void refresh_fc_eg_slot(int type, int c, int s, int fc, int kc)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user