Emuforums.com

Go Back   Emuforums.com > Xbox Emulation > Cxbx Official Discussion
About Us Register FAQ Members List Calendar Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old June 17th, 2004   #1 (permalink)
Emu author
 
blueshogun96's Avatar
 
Join Date: Jun 2004
Location: Unidentified
Posts: 2,158
Lightbulb Addressing the pResource problem. Caustik, please read

I've had this idea for almost a month now, and I'm now getting a chance to post it. I tried once before, but I deleted it by mistake. So here we go again. First of all, let's read the words of the creator himself

Quote:
Direct3D resources are going to be a little bit of a hack.
There is a tough situation, because precompiled resources
(XPR) can be loaded into memory manually by an Xbox Game,
and then "Registered" with pResource->Register(addr);

This is a problem because we never have an opportunity to
intercept the "this" pointer for this datatype. The base
resource class looks like this:

DWORD Common;
DWORD Data;
DWORD Lock;

The first idea is to tuck away the PC Direct3D resource
pointer inside of pResource->Data. The trouble with this
is that some Xbox Games will directly access and modify
this member.

Another technique is to hide the PC Direct3D resource pointer
inside of the buffer allocated by Data. This could work, as
long as Xbox Games do not access the resource Data after the
initial Register function is called.

The currently used method is to tuck the pointer away inside
of the Lock member, and hijack any functions that attempt to
access the Lock member variable.
Ok here goes. Caustik stated that xbox games can access members of the pResource variable. So, would it work if we just tried a swap method by making an exact copy of pResource? Ex:

pResourceCopy=pResource;

Then when xbox games moddify a member that we want to keep unmoddified, we could just do this for the methods that caustik wrote. Ex:

Method 1: tuck away the PC Direct3D resource pointer inside of pResource->Data

pResourceCopy->Data=pResource->Data;
//after the game moddifies it, switch it back
pResoucre->Data=pResourceCopy->Data;

And you get the picture for the rest, right? Caustik, if you're reading this, I just want you to know that I appreaciate you, and I'm doing the best I can to contribute. I've noticed that too many members are always asking things like:

when will commercial games be playable?
what's taking so long?
when will this work?
when will that work?
How come this...?
How come that...?
You should do this ...
You should do that...
Why can't you just use the DVD drive?

It ticks me off as much as it does you. I mean, come on people, show some respect. Don't you know how hard it is to do all this? It doesn't take one day to do everything. Just trying to stick up for you, that's all. Oh yeah, please tell me if this is a good idea.
__________________

[Sagat] Windows XP x64 Pro | AMD Athlon 3000+ (~2.0GHz) | NVIDIA GeForce 6600 PCI-E | Realtek AC97 Audio | 512MB Ram | NVIDIA NForce 4-4X chipset | Seagate HDD 160GB | LG 8614 DVD-ROM | HP DVD 1040d CD/DVD -/+ RW w/ LightScribe

GeneralEmu - December 27, 2005 and beyond!
My programming, emulation and Xbox blog! - Click or die! (Updated Thursday, October 2, 2008)
Visit my YouTube page! http://www.youtube.com/blueshogun96
blueshogun96 is offline   Reply With Quote
Old June 17th, 2004   #2 (permalink)
Emu author
 
Join Date: Jun 2003
Location: San Diego
Posts: 172
pResource->Data can not be used because some apps directly retrieve that pointer and write to it. Problem is, we cant possibly detect all the places where games are doing this, so we just have to allow it. pResource->Lock is an ideal place to keep our emulation data, because nobody ever accesses it directly. This is how I implemented it a long long long time ago, and it has yet to cause any problems, so I consider it to be a very good technique, and it's very efficient.
caustik is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 02:31.

© 2006 - 2008 Emu Forums | About Emu Forums | Legal | A member of the Crowdgather Forum Community


Powered by vBulletin® Version 3.7.0 Release Candidate 3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5