X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=plugins%2Fgpulib%2Fgpu.c;h=d67df03c39a4e5d89d74f34f99b4e5b445ae6004;hp=0e6fe63d6e30d76a1a9dea6302e0f44c300f5987;hb=afec9d44d1170fd6391528f4985211ffb00e8bea;hpb=09159d99cd07a084d8643f87c6c23e86c79060ff diff --git a/plugins/gpulib/gpu.c b/plugins/gpulib/gpu.c index 0e6fe63d..d67df03c 100644 --- a/plugins/gpulib/gpu.c +++ b/plugins/gpulib/gpu.c @@ -21,7 +21,6 @@ #define unlikely(x) #define preload(...) #define noinline -#error huh #endif #define gpu_log(fmt, ...) \ @@ -458,6 +457,12 @@ static noinline int do_cmd_buffer(uint32_t *data, int count) cmd = data[pos] >> 24; if (0xa0 <= cmd && cmd <= 0xdf) { + if (unlikely((pos+2) >= count)) { + // incomplete vram write/read cmd, can't consume yet + cmd = -1; + break; + } + // consume vram write/read cmd start_vram_transfer(data[pos + 1], data[pos + 2], (cmd & 0xe0) == 0xc0); pos += 3; @@ -522,7 +527,6 @@ void GPUwriteData(uint32_t data) long GPUdmaChain(uint32_t *rambase, uint32_t start_addr) { uint32_t addr, *list, ld_addr = 0; - uint32_t *llist_entry = NULL; int len, left, count; long cpu_cycles = 0; @@ -531,15 +535,6 @@ long GPUdmaChain(uint32_t *rambase, uint32_t start_addr) if (unlikely(gpu.cmd_len > 0)) flush_cmd_buffer(); - // ff7 sends it's main list twice, detect this - if (*gpu.state.frame_count == gpu.state.last_list.frame && - *gpu.state.hcnt - gpu.state.last_list.hcnt <= 1 && - gpu.state.last_list.cycles > 2048) - { - llist_entry = rambase + (gpu.state.last_list.addr & 0x1fffff) / 4; - *llist_entry |= 0x800000; - } - log_io("gpu_dma_chain\n"); addr = start_addr & 0xffffff; for (count = 0; (addr & 0x800000) == 0; count++) @@ -586,9 +581,6 @@ long GPUdmaChain(uint32_t *rambase, uint32_t start_addr) } } - if (llist_entry) - *llist_entry &= ~0x800000; - gpu.state.last_list.frame = *gpu.state.frame_count; gpu.state.last_list.hcnt = *gpu.state.hcnt; gpu.state.last_list.cycles = cpu_cycles;