# Oblivion DX Detours

This topic is 4486 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

##### Share on other sites
I'll be sure to get my addicted brother the sample to test out.
Great stuff :)

##### Share on other sites
Thanks, although my guess is the problem will be the same.

I have changed the code around a bit and found the drawing primitives works just fine, its drawing the text that causes the issues...

Anyone see a glaring problem in the following code that might lead to a hiccup? Any input is appricated.

	STDMETHOD(EndScene)(THIS)	{		LPD3DXFONT m_font;		D3DXCreateFont( m_device, 20, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Arial"), &m_font );		D3DCOLOR fontColor = D3DCOLOR_ARGB(255,255,0,0);  		// Create a rectangle to indicate where on the screen it should be drawn		RECT rct;		rct.left=2;		rct.right=780;		rct.top=10;		rct.bottom=rct.top+20; //There is a plus between the top and 20, it just isn't showing in this post.		// Draw some text		m_font->DrawText(NULL, "Hello World", -1, &rct, DT_LEFT|DT_NOCLIP , fontColor );		return m_device->EndScene();	}

Some Shots to show you what is happening.

This is with the Text Being Drawn...

And here is with the primitive...

So As is clear, its somthing to do with the font... if anyone has any ideas please let me know =).

##### Share on other sites
Well after many fruitless attempts i have given up on the DX method.

Instad I pulled out the good ol IDA and found the ingame message functions and just used those..

Although i am still very interested in why the overlay text doesn't work, i am happy with these results.

The one problem with the current method i am using is that it uses direct addressing to the message function, which means natrually if there is a patch released its a possiblity that the address will change, so i would like to try to find a way to use DX still.

Message Text using internal Oblivion Message Functions

If anyone wants the code to the message function as seen here let me know.

P.S. Still looking for input on the DX Detour!!

##### Share on other sites
Quote:
 Instad I pulled out the good ol IDA and found the ingame message functions and just used those..

Nice! How did you go about finding these? What adresses are they located at?

(sorry i can't help with the DX thing)

##### Share on other sites
Quote:
 If anyone wants the code to the message function as seen here let me know.

Well, I don't know if I'd be able to make some use of it in C#, but I know for certain that it would also be of much use to several other addicted people, including myself [smile] So, if you could share it, please go ahead. Should be interesting to see how it's done even if I might not be able to use it.

Quote:
 P.S. Still looking for input on the DX Detour!!

On the font issue, I'm guessing that using the LPD3DXFONT somehow messes things up. I'm not 100% sure how those fonts work under the hood, but I believe they use some kind of caching mechanism and it might be that somehow this caching corrupts the Oblivion font. But that's just plain guessing.

As an alternative, you could use bitmap fonts on a sprite helper to do your text rendering.

##### Share on other sites
I'm thinking the font drawing is changing some renderstates that Oblivion is relying on. Try capturing the current state with a state block and restoring it after you render the font.

##### Share on other sites
Same as Jamesw : it defenitely looks like a render states problem (the alpha blending seems to be of when the Oblivion text is rendered)

In the article you linked, Muhammad gave a little warning on renderstates : you should backup all the render states as they are before you modify them, and you restore them after drawing your overlay stuff.

A little :

// creation
IDirect3DStateBlock9 * pStateBlockBackup;
d3dDevice->CreateStateBlock(D3DSBT_ALL, &pStateBlockBackup);

// backup
pStateBlockBackup->Capture();

// do your stuff here ...

// restore
pStateBlockBackup->Restore();

Might solve the problem

##### Share on other sites
Thanks for all the input guys, sadly none of it worked =P (i didn't try the gif font method)

This is the code i used, and it produced the same results as before...
		IDirect3DStateBlock9 * pStateBlockBackup;		m_device->CreateStateBlock(D3DSBT_ALL, &pStateBlockBackup);		pStateBlockBackup->Capture();		LPD3DXFONT m_font;		D3DXCreateFont( m_device, 20, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Arial"), &m_font );		D3DCOLOR fontColor = D3DCOLOR_ARGB(255,255,0,0);  		// Create a rectangle to indicate where on the screen it should be drawn		RECT rct;		rct.left=2;		rct.right=780;		rct.top=10;		rct.bottom=rct.top+20;		m_font->DrawText(NULL, "Hello World", -1, &rct, DT_LEFT|DT_NOCLIP , fontColor );		pStateBlockBackup->Apply();		return m_device->EndScene();

Its really not a big issue at this point, the only big disatvantage to using the ingame message system is its single line, so each line of text recieved has to be sent one at a time, but it works for now =).

I finished a trillian plugin that takes advantage of it you can download it here, i will release the source once i finish a few more touch ups in the code, if you find any bugs let me know.

SS of Trillian Plugin communicating with Oblivion.

The plugin is set to accept only private messages, so things like group chats or irc shouldn't be sent through.

The package has two files.
OblivionMessage.dll - This is the trillian plugin file, it loads the message catch into trillian.
OMessageLoader.dll - This is the message detour DLL, whenever there is a message this DLL is sent into oblivion and executes the message call with the provided text. The DLL uses shared memory to accomplish the task, so far it works rather well.

There is overhead in the fact that it reloads/unloads the dll each time a message is sent, i am planning on changing this to a speicific function call which will be directly addressed once the function is loaded, however for now this works.

Oblivion Message Plugins

Code is comming...

Still looking for a fix to the DX problem though so i might be able to display multiple lines.

##### Share on other sites
Now you need to implement replying to msgs through oblivion and you'll be set! :P

1. 1
2. 2
Rutin
21
3. 3
JoeJ
18
4. 4
5. 5

• 14
• 39
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631719
• Total Posts
3001885
×