Fixed possible segfault caused by Voodoo2 control panel applet.

Added some reserved register names for debug output and minor code cleanup.
This commit is contained in:
Volker Ruppert 2014-01-05 14:01:10 +00:00
parent 35789633e8
commit 0b43928f6a
3 changed files with 3 additions and 20 deletions

View File

@ -325,7 +325,7 @@ void bx_voodoo_c::register_state(void)
new bx_shadow_data_c(fbi, "clut", (Bit8u*)v->fbi.clut, sizeof(v->fbi.clut));
new bx_shadow_bool_c(fbi, "clut_dirty", &v->fbi.clut_dirty);
bx_list_c *tmu = new bx_list_c(vstate, "tmu", "textures");
for (i = 0; i < 2; i++) {
for (i = 0; i < MAX_TMU; i++) {
sprintf(name, "%d", i);
bx_list_c *num = new bx_list_c(tmu, name, "");
new bx_shadow_data_c(num, "ram", v->tmu[i].ram, (4 << 20));

View File

@ -715,7 +715,7 @@ static const char *const voodoo_reg_name[] =
"nccTable1.3", "nccTable1.4", "nccTable1.5", "nccTable1.6",
"nccTable1.7", "nccTable1.8", "nccTable1.9", "nccTable1.A",
/* 0x380 */
"nccTable1.B"
"nccTable1.B", "reserved384", "reserved388", "reserved38c"
};

View File

@ -1207,9 +1207,6 @@ void swap_buffers(voodoo_state *v)
swapbuffer - execute the 'swapbuffer'
command
-------------------------------------------------*/
//#include "vga.h"
bool dump_lfb=false;
bool dump_tmu=false;
Bit32s swapbuffer(voodoo_state *v, Bit32u data)
{
/* set the don't swap value for Voodoo 2 */
@ -1217,20 +1214,6 @@ Bit32s swapbuffer(voodoo_state *v, Bit32u data)
v->fbi.vblank_swap = (data >> 1) & 0xff;
v->fbi.vblank_dont_swap = (data >> 9) & 1;
if (dump_lfb) {
FILE *f=fopen("e:/lfb.raw","wb");
fwrite(v->fbi.ram,4<<20,1,f);
fclose(f);
}
if (dump_tmu) {
FILE*f=fopen("e:/tmu0.raw","wb");
fwrite(v->tmu[0].ram,4<<20,1,f);
fclose(f);
f=fopen("e:/tmu1.raw","wb");
fwrite(v->tmu[1].ram,4<<20,1,f);
fclose(f);
}
/* if we're not syncing to the retrace, process the command immediately */
// if (!(data & 1))
{
@ -2066,7 +2049,7 @@ Bit32s texture_w(Bit32u offset, Bit32u data)
v->stats.tex_writes++;
/* point to the right TMU */
if (!(v->chipmask & (2 << tmunum)))
if (!(v->chipmask & (2 << tmunum)) || (tmunum >= MAX_TMU))
return 0;
t = &v->tmu[tmunum];