Merge pull request #2480 from phire/GamesDoWeirdShit

Fix invalid pointer errors in Burnout 2.
This commit is contained in:
Markus Wick
2015-05-31 23:26:55 +02:00
14 changed files with 74 additions and 32 deletions

View File

@ -23,11 +23,13 @@ void SWLoadCPReg(u32 sub_cmd, u32 value)
case 0x50:
g_main_cp_state.vtx_desc.Hex &= ~0x1FFFF; // keep the Upper bits
g_main_cp_state.vtx_desc.Hex |= value;
g_main_cp_state.bases_dirty = true;
break;
case 0x60:
g_main_cp_state.vtx_desc.Hex &= 0x1FFFF; // keep the lower 17Bits
g_main_cp_state.vtx_desc.Hex |= (u64)value << 17;
g_main_cp_state.bases_dirty = true;
break;
case 0x70:
@ -48,7 +50,7 @@ void SWLoadCPReg(u32 sub_cmd, u32 value)
// Pointers to vertex arrays in GC RAM
case 0xA0:
g_main_cp_state.array_bases[sub_cmd & 0xF] = value;
cached_arraybases[sub_cmd & 0xF] = Memory::GetPointer(value);
g_main_cp_state.bases_dirty = true;
break;
case 0xB0:

View File

@ -16,8 +16,10 @@
#include "VideoBackends/Software/XFMemLoader.h"
#include "VideoCommon/VertexLoaderBase.h"
#include "VideoCommon/VertexLoaderManager.h"
#include "VideoCommon/VertexLoaderUtils.h"
SWVertexLoader::SWVertexLoader() :
m_VertexSize(0)
{
@ -176,6 +178,8 @@ void SWVertexLoader::LoadVertex()
// reserve memory for the destination of the vertex loader
m_LoadedVertices.resize(vdec.stride + 4);
VertexLoaderManager::UpdateVertexArrayPointers();
// convert the vertex from the gc format to the videocommon (hardware optimized) format
u8* old = g_video_buffer_read_ptr;
int converted_vertices = m_CurrentLoader->RunVertices(