Next Generation Emulation banner

1 - 20 of 21 Posts

·
Registered
Joined
·
34 Posts
Discussion Starter #1
Happy Holidays! Hopefully everyone is enjoying a bit of time and maybe a couple of days off from work.

Anyways. I wanted to make a brief post about my HLE Xbox emulator that I've spending a bit of time on recently. Currently it's still very early in development, but some of the key features and major differences from CXBX is what I wanted to talk about.

The main focus is to accurately emulate as much as possible via HLE.

Current Features:
Plugin Support
OpenGL Graphics
32bit and 64bit versions of Windows

As of right now it only runs a few examples from the SDK, but it does run stable under 32bit and 64bit versions of Windows with no problems at all.

For now I've attached a little teaser of my work and hopefully soon we'll see it running a commercial game.
 

·
Premium Member
Joined
·
6,071 Posts
If you're willing to share the source, I could help out (from time to time) if you want. Just know that my main goal would be to play Azurik and once I get that working, I will die a happy man.
 

·
Registered
Joined
·
34 Posts
Discussion Starter #4
If you're willing to share the source, I could help out (from time to time) if you want. Just know that my main goal would be to play Azurik and once I get that working, I will die a happy man.
Will do! Currently re-factoring the symbol generation/caching to work better with IDA and improving comments/documentation. Project will also be open source later on once the structure of the code is a bit more stable (cleaned up).
 

·
Premium Member
Joined
·
6,071 Posts
Also, I wanted to re-iterate this one more time. You'll soon find out that HLE is going to be more trouble than it's worth. I still support you on this and available to help, but you'll get tired of the whole HLE thing rather fast, I guarantee it. :)
 

·
Registered
Joined
·
34 Posts
Discussion Starter #8
Also, I wanted to re-iterate this one more time. You'll soon find out that HLE is going to be more trouble than it's worth. I still support you on this and available to help, but you'll get tired of the whole HLE thing rather fast, I guarantee it. :)
Understandable. LLE is something I would honestly really love to do, but as I've said before this is mainly for the learning experience and to hopefully expand my knowledge of OpenGL, x86 ASM, and some of the inner workings of the Xbox before moving on to LLE which is exponentially more complex.
 

·
Premium Member
Joined
·
2,299 Posts
None of them is low level, and for a good reason...
 

·
Premium Member
Joined
·
2,299 Posts
I was referring to released projects, not blue's wip emu with no stable releases yet.
 

·
Premium Member
Joined
·
6,071 Posts
None of them is low level, and for a good reason...
The only good reason to use HLE is when you're using the host PC's address space to run the .xbe file's code because of the restrictions Windows has on it's memory map and privilege levels.

For anything else, LLE is a better choice. I understand his choice for using HLE, but having dependencies on XDK versions is a nightmare I'd rather avoid and for completeness sake it's not as feasible.
 

·
Registered
Joined
·
196 Posts
By the way blueshogun, on your blog (iirc) you mention something about having to do some trickery to load the code at the address you want, wouldn't a simple VirtualAllocEx specifying the address have worked?
 

·
Premium Member
Joined
·
6,071 Posts
No, it's not that simple.

If you want access to 0x10000 in Windows, there's multiple precautions you need to take, and it's not a simple approach either.

1. Set the compiler to give the .exe a base address of 0x10000 and always load that address.
2. Create a static global array of 64mb (or 128mb, what ever you need).
3. Call VirtualProtect to change the protection settings on the memory address where RAM is located for Xbox.
4. And before you can clear out that entire memory range, you have to be careful not to overwrite the .exe header or else it won't work.
5. THEN you can start doing whatever you want in that given memory range. A smart thing to do is back up the memory range and restore the contents from the .exe file so the .exe can exit properly.
 

·
Registered
Joined
·
196 Posts
So VirtualAllocEx with an address of 0x10000 fails?
edit: because I use VirtualAllocEx with 0x82000000 and it seems to work just fine (same with mmap), so I was wondering what differences you could have that prevented you from pushing the data in that allocated block, VirtualProtect'ing it then executing it, but I guess you're loading the Xbox binaries in an entirely different way...
 

·
Registered
Joined
·
34 Posts
Discussion Starter #17
So VirtualAllocEx with an address of 0x10000 fails?
edit: because I use VirtualAllocEx with 0x82000000 and it seems to work just fine (same with mmap), so I was wondering what differences you could have that prevented you from pushing the data in that allocated block, VirtualProtect'ing it then executing it, but I guess you're loading the Xbox binaries in an entirely different way...
If I remember correctly it's not possible to. I could write a static re-locator and load it a different address. But for simplicity I wrote a 'loader' with a base address of 0x10000 and size of about 8MBs, then in after that is the code to load the XbeNext main DLL. So, basically what blueshogun96 said.
 

·
Premium Member
Joined
·
6,071 Posts
So VirtualAllocEx with an address of 0x10000 fails?
edit: because I use VirtualAllocEx with 0x82000000 and it seems to work just fine (same with mmap), so I was wondering what differences you could have that prevented you from pushing the data in that allocated block, VirtualProtect'ing it then executing it, but I guess you're loading the Xbox binaries in an entirely different way...
If it were that easy, we would have done it that way from the beginning. :)

Tbh, I want to see if it's possible to use mmap() for the same purpose you described on MacOSX. I have the feeling it isn't, but it's worth a try. If possible, I'd like to try the direct code execution method one more time, but in a 64-bit environment. It's a bit more work though, since I'd have to patch up any opcodes that 64-bit doesn't support.

Btw, why would you want to use 0x82000000? Just curious.
 

·
Premium Member
Joined
·
6,071 Posts
It's what most Xbox 360 titles use for the base address
Oh, yeah. I forgot about that. On my last job, we had access to XDK tools and almost every game we ran had that same base address. It rarely changes.
 
1 - 20 of 21 Posts
Top