reapply changes from 4550-4551,4556-4559 correctly...sigh...some files were ignored by tortoisesvn, and myself :|
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4570 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
dc75095f99
commit
4622bd0c8b
|
@ -51,7 +51,7 @@ enum
|
||||||
ZCODE_END = 0x00,
|
ZCODE_END = 0x00,
|
||||||
ZCODE_NORM = 0x02,
|
ZCODE_NORM = 0x02,
|
||||||
ZCODE_ROW = 0x03,
|
ZCODE_ROW = 0x03,
|
||||||
ZCODE_MEM_COPY = 0x04,
|
ZCODE_04 = 0x04,
|
||||||
|
|
||||||
// Conditonal Codes
|
// Conditonal Codes
|
||||||
CONDTIONAL_IF_EQUAL = 0x01,
|
CONDTIONAL_IF_EQUAL = 0x01,
|
||||||
|
@ -227,16 +227,17 @@ void LogInfo(const char *format, ...)
|
||||||
|
|
||||||
void RunAllActive()
|
void RunAllActive()
|
||||||
{
|
{
|
||||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats) {
|
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats)
|
||||||
|
{
|
||||||
for (std::vector<ARCode>::iterator i = activeCodes.begin(); i != activeCodes.end(); ++i)
|
for (std::vector<ARCode>::iterator i = activeCodes.begin(); i != activeCodes.end(); ++i)
|
||||||
{
|
{
|
||||||
if (i->active)
|
if (i->active)
|
||||||
{
|
{
|
||||||
if (!RunCode(*i))
|
i->active = RunCode(*i);
|
||||||
i->active = false;
|
|
||||||
LogInfo("\n");
|
LogInfo("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!b_RanOnce)
|
if (!b_RanOnce)
|
||||||
b_RanOnce = true;
|
b_RanOnce = true;
|
||||||
}
|
}
|
||||||
|
@ -292,16 +293,18 @@ bool RunCode(const ARCode &arcode) {
|
||||||
LogInfo("Command: %08x", cmd);
|
LogInfo("Command: %08x", cmd);
|
||||||
|
|
||||||
// Do Fill & Slide
|
// Do Fill & Slide
|
||||||
if (doFillNSlide) {
|
if (doFillNSlide)
|
||||||
|
{
|
||||||
doFillNSlide = false;
|
doFillNSlide = false;
|
||||||
LogInfo("Doing Fill And Slide");
|
LogInfo("Doing Fill And Slide");
|
||||||
if (!ZeroCode_FillAndSlide(val_last, addr, data))
|
if (!ZeroCode_FillAndSlide(val_last, addr, data))
|
||||||
return false;
|
return false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Memory Copy
|
// Memory Copy
|
||||||
if (doMemoryCopy) {
|
if (doMemoryCopy)
|
||||||
|
{
|
||||||
doMemoryCopy = false;
|
doMemoryCopy = false;
|
||||||
LogInfo("Doing Memory Copy");
|
LogInfo("Doing Memory Copy");
|
||||||
if (!ZeroCode_MemoryCopy(val_last, addr, data))
|
if (!ZeroCode_MemoryCopy(val_last, addr, data))
|
||||||
|
@ -310,7 +313,8 @@ bool RunCode(const ARCode &arcode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionReplay program self modification codes
|
// ActionReplay program self modification codes
|
||||||
if (addr >= 0x00002000 && addr < 0x00003000) {
|
if (addr >= 0x00002000 && addr < 0x00003000)
|
||||||
|
{
|
||||||
LogInfo("This action replay simulator does not support codes that modify Action Replay itself.");
|
LogInfo("This action replay simulator does not support codes that modify Action Replay itself.");
|
||||||
PanicAlert("This action replay simulator does not support codes that modify Action Replay itself.");
|
PanicAlert("This action replay simulator does not support codes that modify Action Replay itself.");
|
||||||
return false;
|
return false;
|
||||||
|
@ -339,7 +343,7 @@ bool RunCode(const ARCode &arcode) {
|
||||||
LogInfo("ZCode: Executes all codes in the same row, Set register 1BB4 to 1 (zcode not supported)");
|
LogInfo("ZCode: Executes all codes in the same row, Set register 1BB4 to 1 (zcode not supported)");
|
||||||
PanicAlert("Zero 3 code not supported");
|
PanicAlert("Zero 3 code not supported");
|
||||||
return false;
|
return false;
|
||||||
case ZCODE_MEM_COPY: // Fill & Slide or Memory Copy
|
case ZCODE_04: // Fill & Slide or Memory Copy
|
||||||
if (((addr >> 25) & 0x03) == 0x3)
|
if (((addr >> 25) & 0x03) == 0x3)
|
||||||
{
|
{
|
||||||
LogInfo("ZCode: Memory Copy");
|
LogInfo("ZCode: Memory Copy");
|
||||||
|
@ -554,7 +558,7 @@ bool Subtype_WriteToPointer(u32 addr, u32 data)
|
||||||
bool Subtype_AddCode(u32 addr, u32 data)
|
bool Subtype_AddCode(u32 addr, u32 data)
|
||||||
{
|
{
|
||||||
// Used to incrment a value in memory
|
// Used to incrment a value in memory
|
||||||
u32 new_addr = (addr & 0x01FFFFFF) | 0x80000000;
|
u32 new_addr = (addr & 0x81FFFFFF);
|
||||||
u8 size = (addr >> 25) & 0x03;
|
u8 size = (addr >> 25) & 0x03;
|
||||||
LogInfo("Hardware Address: %08x", new_addr);
|
LogInfo("Hardware Address: %08x", new_addr);
|
||||||
LogInfo("Size: %08x", size);
|
LogInfo("Size: %08x", size);
|
||||||
|
@ -585,12 +589,15 @@ bool Subtype_AddCode(u32 addr, u32 data)
|
||||||
{
|
{
|
||||||
LogInfo("32-bit floating Add");
|
LogInfo("32-bit floating Add");
|
||||||
LogInfo("--------");
|
LogInfo("--------");
|
||||||
union conv {float x; u32 y;};
|
|
||||||
conv c1;
|
u32 read = Memory::Read_U32(new_addr);
|
||||||
c1.y = Memory::Read_U32(new_addr);
|
float fread = *((float*)&read);
|
||||||
c1.x += (float)data;
|
fread += (float)data;
|
||||||
Memory::Write_U32((u32)c1.x, new_addr);
|
u32 newval = *((u32*)&fread);
|
||||||
LogInfo("Wrote %08x to address %08x", (u32)c1.x, new_addr);
|
Memory::Write_U32(newval, new_addr);
|
||||||
|
LogInfo("Old Value %08x", read);
|
||||||
|
LogInfo("Increment %08x", data);
|
||||||
|
LogInfo("New value %08x", newval);
|
||||||
LogInfo("--------");
|
LogInfo("--------");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -615,7 +622,7 @@ bool Subtype_MasterCodeAndWriteToCCXXXXXX(u32 addr, u32 data)
|
||||||
|
|
||||||
bool ZeroCode_FillAndSlide(u32 val_last, u32 addr, u32 data) // This needs more testing
|
bool ZeroCode_FillAndSlide(u32 val_last, u32 addr, u32 data) // This needs more testing
|
||||||
{
|
{
|
||||||
u32 new_addr = (val_last & 0x01FFFFFF) | 0x80000000;
|
u32 new_addr = (val_last & 0x81FFFFFF);
|
||||||
u8 size = (val_last >> 25) & 0x03;
|
u8 size = (val_last >> 25) & 0x03;
|
||||||
s16 addr_incr = (s16)(data & 0xFFFF);
|
s16 addr_incr = (s16)(data & 0xFFFF);
|
||||||
s8 val_incr = (s8)((data & 0xFF000000) >> 24);
|
s8 val_incr = (s8)((data & 0xFF000000) >> 24);
|
||||||
|
|
|
@ -235,8 +235,7 @@ void PatchEngineCallback(u64 userdata, int cyclesLate)
|
||||||
// Patch mem and run the Action Replay
|
// Patch mem and run the Action Replay
|
||||||
PatchEngine::ApplyFramePatches();
|
PatchEngine::ApplyFramePatches();
|
||||||
PatchEngine::ApplyARPatches();
|
PatchEngine::ApplyARPatches();
|
||||||
|
CoreTiming::ScheduleEvent(((GetTicksPerSecond() / 5000) - cyclesLate, et_PatchEngine);
|
||||||
CoreTiming::ScheduleEvent((GetTicksPerSecond() / 60) - cyclesLate, et_PatchEngine);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init()
|
void Init()
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
// Supports simple memory patches, and has a partial Action Replay implementation
|
// Supports simple memory patches, and has a partial Action Replay implementation
|
||||||
// in ActionReplay.cpp/h.
|
// in ActionReplay.cpp/h.
|
||||||
|
|
||||||
|
// TODO: Still even needed? Zelda WW now works with improved DSP code.
|
||||||
// Zelda item hang fixes:
|
// Zelda item hang fixes:
|
||||||
// [Tue Aug 21 2007] [18:30:40] <Knuckles-> 0x802904b4 in US released
|
// [Tue Aug 21 2007] [18:30:40] <Knuckles-> 0x802904b4 in US released
|
||||||
// [Tue Aug 21 2007] [18:30:53] <Knuckles-> 0x80294d54 in EUR Demo version
|
// [Tue Aug 21 2007] [18:30:53] <Knuckles-> 0x80294d54 in EUR Demo version
|
||||||
|
|
|
@ -156,9 +156,10 @@ u16 dsp_read_accelerator()
|
||||||
// Set address back to start address.
|
// Set address back to start address.
|
||||||
Address = (gdsp_ifx_regs[DSP_ACSAH] << 16) | gdsp_ifx_regs[DSP_ACSAL];
|
Address = (gdsp_ifx_regs[DSP_ACSAH] << 16) | gdsp_ifx_regs[DSP_ACSAL];
|
||||||
|
|
||||||
// Do we really need both?
|
// Do we really need both? (nakee: seems to cause problems with some
|
||||||
DSPHost_InterruptRequest();
|
// AX games)
|
||||||
DSPCore_SetException(EXP_2);
|
// DSPHost_InterruptRequest();
|
||||||
|
// DSPCore_SetException(EXP_2);
|
||||||
DSPCore_SetException(EXP_ACCOV);
|
DSPCore_SetException(EXP_ACCOV);
|
||||||
|
|
||||||
// Somehow, YN1 and YN2 must be initialized with their "loop" values,
|
// Somehow, YN1 and YN2 must be initialized with their "loop" values,
|
||||||
|
|
|
@ -161,7 +161,7 @@ void gdsp_ifx_write(u16 addr, u16 val)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0xd3: // ZeldaUnk (accelerator WRITE)
|
case 0xd3: // ZeldaUnk (accelerator WRITE)
|
||||||
NOTICE_LOG(DSPLLE, "Write To ZeldaUnk pc=%04x (%04x)", g_dsp.pc, val);
|
// NOTICE_LOG(DSPLLE, "Write To ZeldaUnk pc=%04x (%04x)", g_dsp.pc, val);
|
||||||
dsp_write_aram_d3(val);
|
dsp_write_aram_d3(val);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ u16 gdsp_ifx_read(u16 addr)
|
||||||
return dsp_read_accelerator();
|
return dsp_read_accelerator();
|
||||||
|
|
||||||
case 0xd3:
|
case 0xd3:
|
||||||
NOTICE_LOG(DSPLLE, "Read from ZeldaUnk pc=%04x", g_dsp.pc);
|
//NOTICE_LOG(DSPLLE, "Read from ZeldaUnk pc=%04x", g_dsp.pc);
|
||||||
return dsp_read_aram_d3();
|
return dsp_read_aram_d3();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -316,7 +316,7 @@ void gdsp_do_dma()
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||||
NOTICE_LOG(DSPLLE, "DMA pc: %04x ctl: %04x addr: %08x da: %04x size: %04x", g_dsp.pc, ctl, addr, dsp_addr, len);
|
DEBUG_LOG(DSPLLE, "DMA pc: %04x ctl: %04x addr: %08x da: %04x size: %04x", g_dsp.pc, ctl, addr, dsp_addr, len);
|
||||||
#endif
|
#endif
|
||||||
switch (ctl & 0x3)
|
switch (ctl & 0x3)
|
||||||
{
|
{
|
||||||
|
|
|
@ -116,8 +116,8 @@ void CARCodeAddEdit::SaveCheatData(wxCommandEvent& WXUNUSED (event))
|
||||||
|
|
||||||
if (pieces.size() == 2 && pieces[0].size() == 8 && pieces[1].size() == 8)
|
if (pieces.size() == 2 && pieces[0].size() == 8 && pieces[1].size() == 8)
|
||||||
{
|
{
|
||||||
u32 addr = strtol(pieces[0].c_str(), NULL, 16);
|
u32 addr = strtoul(pieces[0].c_str(), NULL, 16);
|
||||||
u32 value = strtol(pieces[1].c_str(), NULL, 16);
|
u32 value = strtoul(pieces[1].c_str(), NULL, 16);
|
||||||
// Decrypted code
|
// Decrypted code
|
||||||
tempEntries.push_back(ActionReplay::AREntry(addr, value));
|
tempEntries.push_back(ActionReplay::AREntry(addr, value));
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ void PixelShaderManager::SetConstants()
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// 24 bits
|
// 24 bits
|
||||||
ftemp[0] = ffrac/65536.0f; ftemp[1] = ffrac/256.0f; ftemp[2] = ffrac; ftemp[3] = ffrac/16777216.0f;
|
ftemp[0] = ffrac/65536.0f; ftemp[1] = ffrac/256.0f; ftemp[2] = ffrac; ftemp[3] = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SetPSConstant4fv(C_ZBIAS, ftemp);
|
SetPSConstant4fv(C_ZBIAS, ftemp);
|
||||||
|
|
|
@ -60,6 +60,25 @@ int TexDecoder_GetTexelSizeInNibbles(int format)
|
||||||
case GX_TF_C8: return 2;
|
case GX_TF_C8: return 2;
|
||||||
case GX_TF_C14X2: return 4;
|
case GX_TF_C14X2: return 4;
|
||||||
case GX_TF_CMPR: return 1;
|
case GX_TF_CMPR: return 1;
|
||||||
|
case GX_CTF_R4: return 1;
|
||||||
|
case GX_CTF_RA4: return 2;
|
||||||
|
case GX_CTF_RA8: return 4;
|
||||||
|
case GX_CTF_YUVA8: return 8;
|
||||||
|
case GX_CTF_A8: return 2;
|
||||||
|
case GX_CTF_R8: return 2;
|
||||||
|
case GX_CTF_G8: return 2;
|
||||||
|
case GX_CTF_B8: return 2;
|
||||||
|
case GX_CTF_RG8: return 4;
|
||||||
|
case GX_CTF_GB8: return 4;
|
||||||
|
|
||||||
|
case GX_TF_Z8: return 2;
|
||||||
|
case GX_TF_Z16: return 4;
|
||||||
|
case GX_TF_Z24X8: return 8;
|
||||||
|
|
||||||
|
case GX_CTF_Z4: return 1;
|
||||||
|
case GX_CTF_Z8M: return 2;
|
||||||
|
case GX_CTF_Z8L: return 2;
|
||||||
|
case GX_CTF_Z16L: return 4;
|
||||||
default: return 1;
|
default: return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,6 @@ CUCode_AXWii::CUCode_AXWii(CMailHandler& _rMailHandler, u32 l_CRC)
|
||||||
{
|
{
|
||||||
// we got loaded
|
// we got loaded
|
||||||
m_rMailHandler.PushMail(0xDCD10000);
|
m_rMailHandler.PushMail(0xDCD10000);
|
||||||
m_rMailHandler.PushMail(0x80000000); // handshake ??? only (crc == 0xe2136399) needs it ...
|
|
||||||
|
|
||||||
templbuffer = new int[1024 * 1024];
|
templbuffer = new int[1024 * 1024];
|
||||||
temprbuffer = new int[1024 * 1024];
|
temprbuffer = new int[1024 * 1024];
|
||||||
|
@ -70,9 +69,12 @@ void CUCode_AXWii::HandleMail(u32 _uMail)
|
||||||
{
|
{
|
||||||
// a new List
|
// a new List
|
||||||
}
|
}
|
||||||
else if ((_uMail & 0xFFFF0000) == 0xCDD10000)
|
else if (_uMail == 0xCDD10000) // Action 0 - restart
|
||||||
|
{
|
||||||
|
m_rMailHandler.PushMail(0xDCD10001);
|
||||||
|
}
|
||||||
|
else if ((_uMail & 0xFFFF0000) == 0xCDD10000) // Action 1/2/3
|
||||||
{
|
{
|
||||||
//NOTICE_LOG(DSPHLE, "action mail %08X", _uMail);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -371,11 +373,13 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
|
||||||
case 0x000b:
|
case 0x000b:
|
||||||
uAddress += 2; // one 0x8000 in rabbids
|
uAddress += 2; // one 0x8000 in rabbids
|
||||||
uAddress += 4 * 2; // then two RAM addressses
|
uAddress += 4 * 2; // then two RAM addressses
|
||||||
|
m_rMailHandler.PushMail(0xDCD10004);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x000c:
|
case 0x000c:
|
||||||
uAddress += 2; // one 0x8000 in rabbids
|
uAddress += 2; // one 0x8000 in rabbids
|
||||||
uAddress += 4 * 2; // then two RAM addressses
|
uAddress += 4 * 2; // then two RAM addressses
|
||||||
|
m_rMailHandler.PushMail(0xDCD10004);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x000d:
|
case 0x000d:
|
||||||
|
@ -385,7 +389,7 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
|
||||||
case 0x000e:
|
case 0x000e:
|
||||||
// This is the end.
|
// This is the end.
|
||||||
bExecuteList = false;
|
bExecuteList = false;
|
||||||
SaveLog("%08x : AXLIST end, wii stylee.", uAddress);
|
m_rMailHandler.PushMail(0xDCD10002);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -428,7 +432,6 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
|
||||||
SaveLog("=====================================================================");
|
SaveLog("=====================================================================");
|
||||||
SaveLog("End");
|
SaveLog("End");
|
||||||
|
|
||||||
m_rMailHandler.PushMail(0xDCD10002);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -398,18 +398,18 @@ void drawShadedTexQuad(IDirect3DTexture9 *texture,
|
||||||
{
|
{
|
||||||
SaveRenderStates();
|
SaveRenderStates();
|
||||||
|
|
||||||
float span = ((rSource->right-rSource->left - 1.0f) * (rDest->right - rDest->left))/(SourceWidth*((rDest->right - rDest->left)-1.0f));
|
//float span = ((rSource->right-rSource->left - 1.0f) * (rDest->right - rDest->left))/(SourceWidth*((rDest->right - rDest->left)-1.0f));
|
||||||
float u1=((0.5f+rSource->left)/(float) SourceWidth)-(span*0.5f/(float)(rDest->right - rDest->left));
|
float u1=((float)rSource->left+1.0f)/(float) SourceWidth;//*/((0.5f+rSource->left)/(float) SourceWidth)-(span*0.5f/(float)(rDest->right - rDest->left));
|
||||||
float u2=u1+span;
|
float u2=((float)rSource->right-1.0f)/(float) SourceWidth;;//*/u1+span;
|
||||||
span = ((rSource->bottom-rSource->top - 1.0f) * (rDest->bottom - rDest->top))/(SourceHeight*((rDest->bottom - rDest->top)-1.0f));
|
//span = ((rSource->bottom-rSource->top - 1.0f) * (rDest->bottom - rDest->top))/(SourceHeight*((rDest->bottom - rDest->top)-1.0f));
|
||||||
float v1=((0.5f+rSource->top)/(float) SourceHeight)-(span*0.5f/(float)(rDest->bottom - rDest->top));
|
float v1=((float)rSource->top+1.0f)/(float) SourceHeight;//*/((0.5f+rSource->top)/(float) SourceHeight)-(span*0.5f/(float)(rDest->bottom - rDest->top));
|
||||||
float v2=v1+span;
|
float v2=((float)rSource->bottom-1.0f)/(float) SourceHeight;//*/v1+span;
|
||||||
|
|
||||||
struct Q2DVertex { float x,y,z,rhw,u,v; } coords[4] = {
|
struct Q2DVertex { float x,y,z,rhw,u,v; } coords[4] = {
|
||||||
{(float)rDest->left-1.0f, (float)rDest->top-1.0f, 0.0f, 1.0f, u1, v1},
|
{(float)rDest->left-0.5f, (float)rDest->top-0.5f, 0.0f, 1.0f, u1, v1},
|
||||||
{(float)rDest->right, (float)rDest->top-1.0f, 0.0f,1.0f, u2, v1},
|
{(float)rDest->right-0.5f, (float)rDest->top-0.5f, 0.0f,1.0f, u2, v1},
|
||||||
{(float)rDest->right, (float)rDest->bottom, 0.0f,1.0f, u2, v2},
|
{(float)rDest->right-0.5f, (float)rDest->bottom-0.5f, 0.0f,1.0f, u2, v2},
|
||||||
{(float)rDest->left-1.0f, (float)rDest->bottom, 0.0f,1.0f, u1, v2}
|
{(float)rDest->left-0.5f, (float)rDest->bottom-0.5f, 0.0f,1.0f, u1, v2}
|
||||||
};
|
};
|
||||||
dev->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1);
|
dev->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1);
|
||||||
dev->SetVertexShader(Vshader);
|
dev->SetVertexShader(Vshader);
|
||||||
|
|
|
@ -359,6 +359,9 @@ static void DX9DebuggerUpdateScreen()
|
||||||
D3D::dev->Present(NULL, NULL, NULL, NULL);
|
D3D::dev->Present(NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
D3D::dev->SetRenderTarget(0, FBManager::GetEFBColorRTSurface());
|
D3D::dev->SetRenderTarget(0, FBManager::GetEFBColorRTSurface());
|
||||||
|
|
||||||
|
if(D3D::GetCaps().NumSimultaneousRTs > 1)
|
||||||
|
D3D::dev->SetRenderTarget(1,FBManager::GetEFBDepthEncodedSurface());
|
||||||
D3D::dev->SetDepthStencilSurface(FBManager::GetEFBDepthRTSurface());
|
D3D::dev->SetDepthStencilSurface(FBManager::GetEFBDepthRTSurface());
|
||||||
D3D::dev->BeginScene();
|
D3D::dev->BeginScene();
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,31 @@ void TextureCache::Invalidate(bool shutdown)
|
||||||
textures.clear();
|
textures.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TextureCache::InvalidateRange(u32 start_address, u32 size)
|
||||||
|
{
|
||||||
|
TexCache::iterator iter = textures.begin();
|
||||||
|
while (iter != textures.end())
|
||||||
|
{
|
||||||
|
if (iter->second.IntersectsMemoryRange(start_address, size))
|
||||||
|
{
|
||||||
|
iter->second.Destroy(false);
|
||||||
|
ERASE_THROUGH_ITERATOR(textures, iter);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TextureCache::TCacheEntry::IntersectsMemoryRange(u32 range_address, u32 range_size)
|
||||||
|
{
|
||||||
|
if (addr + size_in_bytes < range_address)
|
||||||
|
return false;
|
||||||
|
if (addr >= range_address + range_size)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void TextureCache::Shutdown()
|
void TextureCache::Shutdown()
|
||||||
{
|
{
|
||||||
Invalidate(true);
|
Invalidate(true);
|
||||||
|
@ -183,6 +208,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
|
||||||
D3DFORMAT d3d_fmt;
|
D3DFORMAT d3d_fmt;
|
||||||
switch (pcfmt) {
|
switch (pcfmt) {
|
||||||
case PC_TEX_FMT_BGRA32:
|
case PC_TEX_FMT_BGRA32:
|
||||||
|
case PC_TEX_FMT_RGBA32:
|
||||||
d3d_fmt = D3DFMT_A8R8G8B8;
|
d3d_fmt = D3DFMT_A8R8G8B8;
|
||||||
break;
|
break;
|
||||||
case PC_TEX_FMT_RGB565:
|
case PC_TEX_FMT_RGB565:
|
||||||
|
@ -204,7 +230,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
|
||||||
d3d_fmt = D3DFMT_DXT1;
|
d3d_fmt = D3DFMT_DXT1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Make an entry in the table
|
//Make an entry in the table
|
||||||
TCacheEntry& entry = textures[texID];
|
TCacheEntry& entry = textures[texID];
|
||||||
|
|
||||||
|
@ -310,25 +336,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo
|
||||||
tex = entry.texture;
|
tex = entry.texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
have_texture:
|
have_texture:
|
||||||
/*TargetRectangle targetSource = Renderer::ConvertEFBRectangle(source_rect);
|
|
||||||
RECT source_rc;
|
|
||||||
source_rc.left = targetSource.left;
|
|
||||||
source_rc.top = targetSource.top;
|
|
||||||
source_rc.right = targetSource.right;
|
|
||||||
source_rc.bottom = targetSource.bottom;
|
|
||||||
RECT dest_rc;
|
|
||||||
dest_rc.left = 0;
|
|
||||||
dest_rc.top = 0;
|
|
||||||
dest_rc.right = tex_w;
|
|
||||||
dest_rc.bottom = tex_h;
|
|
||||||
|
|
||||||
LPDIRECT3DSURFACE9 srcSurface, destSurface;
|
|
||||||
tex->GetSurfaceLevel(0, &destSurface);
|
|
||||||
srcSurface = FBManager::GetEFBColorRTSurface();
|
|
||||||
D3D::dev->StretchRect(srcSurface, &source_rc, destSurface, &dest_rc, D3DTEXF_LINEAR);
|
|
||||||
destSurface->Release();
|
|
||||||
return;*/
|
|
||||||
float colmat[16]= {0.0f};
|
float colmat[16]= {0.0f};
|
||||||
float fConstAdd[4] = {0.0f};
|
float fConstAdd[4] = {0.0f};
|
||||||
|
|
||||||
|
@ -446,7 +454,8 @@ have_texture:
|
||||||
hr = tex->GetSurfaceLevel(0,&Rendersurf);
|
hr = tex->GetSurfaceLevel(0,&Rendersurf);
|
||||||
CHECK(hr);
|
CHECK(hr);
|
||||||
D3D::dev->SetDepthStencilSurface(NULL);
|
D3D::dev->SetDepthStencilSurface(NULL);
|
||||||
D3D::dev->SetRenderTarget(1, NULL);
|
if(D3D::GetCaps().NumSimultaneousRTs > 1)
|
||||||
|
D3D::dev->SetRenderTarget(1, NULL);
|
||||||
D3D::dev->SetRenderTarget(0, Rendersurf);
|
D3D::dev->SetRenderTarget(0, Rendersurf);
|
||||||
|
|
||||||
D3DVIEWPORT9 vp;
|
D3DVIEWPORT9 vp;
|
||||||
|
@ -468,17 +477,18 @@ have_texture:
|
||||||
|
|
||||||
|
|
||||||
PixelShaderManager::SetColorMatrix(colmat, fConstAdd); // set transformation
|
PixelShaderManager::SetColorMatrix(colmat, fConstAdd); // set transformation
|
||||||
//TargetRectangle targetSource = Renderer::ConvertEFBRectangle(source_rect);
|
TargetRectangle targetSource = Renderer::ConvertEFBRectangle(source_rect);
|
||||||
RECT sourcerect;
|
RECT sourcerect;
|
||||||
sourcerect.bottom = source_rect.bottom;
|
sourcerect.bottom = targetSource.bottom;
|
||||||
sourcerect.left = source_rect.left;
|
sourcerect.left = targetSource.left;
|
||||||
sourcerect.right = source_rect.right;
|
sourcerect.right = targetSource.right;
|
||||||
sourcerect.top = source_rect.top;
|
sourcerect.top = targetSource.top;
|
||||||
|
|
||||||
D3D::drawShadedTexQuad(read_texture,&sourcerect, EFB_WIDTH , EFB_HEIGHT,&destrect,(FBManager::GetEFBDepthRTSurfaceFormat() == D3DFMT_R32F && bFromZBuffer)? PixelShaderCache::GetDepthMatrixProgram(): PixelShaderCache::GetColorMatrixProgram(),NULL);
|
D3D::drawShadedTexQuad(read_texture,&sourcerect, Renderer::GetTargetWidth() , Renderer::GetTargetHeight(),&destrect,(FBManager::GetEFBDepthRTSurfaceFormat() == D3DFMT_R32F && bFromZBuffer)? PixelShaderCache::GetDepthMatrixProgram(): PixelShaderCache::GetColorMatrixProgram(),VertexShaderCache::GetSimpleVertexSahder());
|
||||||
|
|
||||||
D3D::dev->SetRenderTarget(0, FBManager::GetEFBColorRTSurface());
|
D3D::dev->SetRenderTarget(0, FBManager::GetEFBColorRTSurface());
|
||||||
D3D::dev->SetRenderTarget(1, FBManager::GetEFBDepthEncodedSurface());
|
if(D3D::GetCaps().NumSimultaneousRTs > 1)
|
||||||
|
D3D::dev->SetRenderTarget(1, FBManager::GetEFBDepthEncodedSurface());
|
||||||
D3D::dev->SetDepthStencilSurface(FBManager::GetEFBDepthRTSurface());
|
D3D::dev->SetDepthStencilSurface(FBManager::GetEFBDepthRTSurface());
|
||||||
VertexShaderManager::SetViewportChanged();
|
VertexShaderManager::SetViewportChanged();
|
||||||
Renderer::RestoreAPIState();
|
Renderer::RestoreAPIState();
|
||||||
|
|
|
@ -53,6 +53,7 @@ public:
|
||||||
oldpixel = 0;
|
oldpixel = 0;
|
||||||
}
|
}
|
||||||
void Destroy(bool shutdown);
|
void Destroy(bool shutdown);
|
||||||
|
bool IntersectsMemoryRange(u32 range_address, u32 range_size);
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -67,6 +68,7 @@ public:
|
||||||
static void Cleanup();
|
static void Cleanup();
|
||||||
static void Shutdown();
|
static void Shutdown();
|
||||||
static void Invalidate(bool shutdown);
|
static void Invalidate(bool shutdown);
|
||||||
|
static void InvalidateRange(u32 start_address, u32 size);
|
||||||
static TCacheEntry *Load(int stage, u32 address, int width, int height, int format, int tlutaddr, int tlutfmt);
|
static TCacheEntry *Load(int stage, u32 address, int width, int height, int format, int tlutaddr, int tlutfmt);
|
||||||
static void CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyfmt, int bScaleByHalf, const EFBRectangle &source_rect);
|
static void CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyfmt, int bScaleByHalf, const EFBRectangle &source_rect);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue