7 ms·
Recompiler: Porting Xbox360 Executables to Windows
- 4lch3m1st 9y agoThis is amazing -- seems almost like a better way to play an Xbox 360 game on PC, without an emulator. Could even be what Microsoft wanted, for better retrocompatibility support. I wonder if it can also be done to other consoles? Let's hope it gives good fruits.
- Fej 9y agoThis is an emulator. It looks very promising... we'll see how long it takes.
- khedoros1 9y agoSeems like the core part is a static recompiler, probably with emulation of the extra hardware tacked on.
- Jasper_ 9y agoHonestly, I think the emulator approach is a lot better -- you can do a lot more with JIT than trying to translate instructions AOT 1:1.
- bri3d 9y agoYeah - as evidenced by the NES story the other day, the elegance of AOT blows up completely as soon as there's any form of self-modifying code or even memory arithmetic tricks or jump tables. It's all possible to work around, but JIT is cleaner and more flexible in the long run.
- reificator 9y agoI'm fairly sure that the 360 specifically did not allow self modifying code. Makes it a good candidate for this approach.
- ZenoArrow 9y agoIn the case of self-modifying code, I wonder if the techniques behind profile-guided optimisation could work for decompilation: https://en.m.wikipedia.org/wiki/Profile-guided_optimization https://en.m.wikipedia.org/wiki/Profile-guided_optimization In other words, you create a JIT to run the executable, building a profile of the execution paths at runtime, and use that profile to guide a static decompilation process. That way it should be easier to identify the sections of self-modifying code, as well as model the behaviour of this code. The only difficulty I can see is how much time it might take to map out all the code paths, but in principal it's possible, and there may be some efficient approaches for doing so.
- AntiRush 9y agoThere are at least a couple of other examples of similar projects: NES -> native executables: http://andrewkelley.me/post/jamulator.html http://andrewkelley.me/post/jamulator.html x86/Windows starcraft -> arm/Linux for openpandora: https://pyra-handheld.com/boards/threads/starcraft.73844/ https://pyra-handheld.com/boards/threads/starcraft.73844/ (Tools used for this: https://github.com/notaz/ia32rtools https://github.com/notaz/ia32rtools) For a lot of consoles, particularly older ones, this tends to yield worse performance than a JIT. Between different memory layouts, weird threaded code, jump tables, (and especially) self modifying code, a JIT can do a much better job building efficient code since it has all of the runtime information. For newer consoles which more closely resemble PC hardware, things are definitely better; the current generation will basically look like the Starcraft port; an API compatibility layer.
- RickSanchez2600 9y agoIf they can emulate a PowerPC system then they can run AmigaOS and MacOS/MacOSX for PowerMacs to run some legacy programs on Windows, Linux, Modern MacOSX, iOS, etc. There were rumors that Microsoft would port Windows 10 to the XBox One and then convert XBox games to Windows 10 via the Windows Store, etc. Then you could buy or rent XBox, XBox 360, and XBox One games. Apple had a Rosetta software that ran PowerMac stuff on Intel Macs until 10.7 removed it IIRC. So Apple has the patents and IP for that. There was also an old ARDI Executor program that ran old Mac 68K stuff in Windows, Linux, BeOS, etc.
- cnorthwood 9y agoRosetta was licensed from Transitive, which is now owned by IBM. I suspect they still have the IP for it.
- spullara 9y agoThe Rosetta software (original name was QuickTransit) was developed by Transitive Corporation and licensed by Apple. They were acquired by IBM in 2009.
- mobilio 9y agoLearn Something New Every Day!
- bluedino 9y agoIsn’t the challenge with Xbox in the obscure GPU emulation? I mean there’s no Xbox emulator and it was designed with an Intel CPU.
- ZenoArrow 9y agoYeah, the GPU is a custom part not found elsewhere (IIRC the NV2A GPU is meant to be somewhat similar to the GeForce 2 and GeForce 3). However, there is an emulator being worked on for the original Xbox called CxBx Reloaded, which is a continuation of the CxBx emulator. To give an idea of how far along it is, here's some recent footage of JSRF: https://m.youtube.com/watch?v=8fYaMc18apI https://m.youtube.com/watch?v=8fYaMc18apI
- monocasa 9y agoNormally static recompilation of video games breaks down due to self modifying code. If you're going to have to have go through the motions of JIT anyway (and in places where, if they're going through the motions of self modifying code, it's probably computationally expensive code at that), then you might as well go whole hog. That way you only have to build one kind of compiler, and you can take advantage of profile information for everything. But the 360's security model specifically out rules self modifying code. And this is enforced by the hypervisor; the system is W xor X, and the transition of a page from W to X has to be accompanied by signatures signed by Microsoft's private key. Nobody, including the kernel, can modify their code. That might make this one of the first platforms where the static recompilation scheme might make sense in the long term architecture of the emulator.
- Scaevolus 9y agoSelf modifying code hasn't been common in video games for 20 years. The main problem is that static recompilation requires accurate alias analysis-- knowing what values a given pointer might have at a particular point of execution. This is especially important for indirect calls through function pointers (C++ virtual functions), where entire chunks of code might be missed.
- tsomctl 9y agoBut you can still have video games implement their own form of dynamically loaded modules, which (to a jit) is the same problem as self modifying code. I know several PS2 games do this.
- a_t48 9y agoThis still isn't really common. Code size typically pales in comparison to data size.
- tsomctl 9y agoBut it's still something to be aware of, so that you don't have to make major architectural changes to your jit so that one game will work. It's a million and one little things like this that make emulators hard.
- tomyws 9y agoI've always wanted to find time looking at recompiling the Xbox Live Arcade (XBLA) titles from the 360 to Windows. The games are just dotNET applications which run against a variation of the standard libraries.
- shinymark 9y agoI think you might be correct for Xbox Live Indie Games (XBLIG) but that’s not correct for XBLA. Source: personally worked on native C++ XBLA games.
- BillinghamJ 9y agoYeah I think he might just be thinking about XNA? In which case, it can almost directly be replaced by MonoGame.
- devbug 9y agoXenia is a similar project that uses static recompilation (with fallbacks for tricky parts). https://github.com/benvanik/xenia https://github.com/benvanik/xenia
- BackPropagate 9y agoThere used to be a company called Hunter Systems in the late 80s that recompiled DOS binaries for Unix workstations. I worked there.
- Jaruzel 9y agoTangentially but related, does anyone know how to convert xbox360 XMV video files back to WMV or better yet MP4? Asking for a friend...
- kyriakos 9y agowould it be easier to do the same for Xbox One games instead? no different architecture complications
- h43k3r 9y agoHow is it possible for one single person to figure all of these things ? I am new to the industry ( 2 years ) and have only worked on Front End and Back End ( APIs) .