Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve some LTCG specific patches #1670

Merged
merged 2 commits into from Jul 19, 2019

Conversation

LukeUsher
Copy link
Member

Slightly improves behavior of Conker and Halo 2, they still don't do anything worth mentioning, however.
But they run for a little bit longer before crashing now, so it's progress,

if (dwD3DDevice != xbnull) {
g_XboxD3DDevice = *((DWORD**)dwD3DDevice);
}
g_XboxD3DDevice = (DWORD*)it->second;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out we were deriving this incorrectly before: This approach matches what I see on the Xbox side.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... I don't think the fix from targeted XbSymbolDatabase did occur to find D3DDEVICE symbol in LTCG applications.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s not a problem. Nowhere uses this variable at the moment anyway. It was used in the past before we had trampolines working.

I just noticed it was derived wrong by cxbxr and fixed it

Copy link
Member

@RadWolfie RadWolfie Jul 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully soon we'll update the target XbSymbolDatabase to take advantage of existing symbols detecting properly.

EDIT: Of course we'll need to re-update the symbol name from D3DDEVICE to D3D__PDEVICE since there is such thing as D3D__DEVICE symbol.

// This uses a custom calling convention passed unknown parameters
// Test-case: Ninja Gaiden
// This uses a custom calling with parameters passed in eax, ecx and the stack
// Test-case: Ninja Gaiden, Halo 2
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing this prevents an issue where CreateDevice would corrupt the D3DDevice pointer on the Xbox side

// This uses a custom calling convention where parameter is passed in EBX and Stack
// Test Case: Conker
// ******************************************************************
VOID WINAPI XTL::EMUPATCH(D3DDevice_SetIndices_4)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes a crash in Conker caused by corrupted internal D3D index buffer state

// This uses a custom calling convention where parameter is passed in ECX, EAX and Stack
// Test Case: Conker
// ******************************************************************
VOID WINAPI XTL::EMUPATCH(D3DDevice_DrawVertices_4)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Draw function that was detected, but not patched in Conker

@PatrickvL
Copy link
Member

LGTM, merging

@PatrickvL PatrickvL merged commit 8cba417 into Cxbx-Reloaded:develop Jul 19, 2019
@LukeUsher LukeUsher deleted the ltcg-fixes branch July 29, 2019 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants