The Quest to Build Xbox One and PS4 Emulators

A new generation of developers could make games for the Xbox One and PS4 available beyond the console.

Emulators have long been popular among gamers looking to relive the classic titles they enjoyed in their youth. Instead of playing Super Mario Bros. on a Nintendo console, one can go through the legally questionable yet widespread route of downloading a copy of the game and loading it with PC software that emulates the Nintendo Entertainment System.

Emulation is typically limited to older games, as developing an emulator is hard work and must usually be run on hardware that’s more powerful than the original console. Consoles from the NES and Super NES era have working emulators, as do newer systems such as Nintendo 64, GameCube and Wii, and the first two PlayStations.

While emulator development hit a dead end with the Xbox 360 and PS3, that may change with the Xbox One and PS4, according to software engineer Ben Vanik.

Vanik writes Javascript code by day for his full-time gig as a software engineer, while pursuing all other sorts of challenging projects in his spare time. He’s one of the few people to have even tried building an Xbox 360 emulator, although his version isn’t ready for general use. (For emulator development, he writes in C and C++.)

Vanik doesn’t have specific plans to develop an Xbox One or PS4 emulator, but is intrigued by the possibility. He is excited that both new consoles use AMD x86 CPUs, similar to the chips in most laptops and desktops (except that PCs generally use Intel’s x86 chips). The new consoles both use AMD Radeon graphics processing units as well, which is also good news because AMD’s “Mantle” API makes it easier for developers to write code for the chips. Finally, Vanik expects that the hardware virtualization readily available in today’s PCs will let emulators run without needing a computer four times as fast as the console.

“It would be easier to create a PS4 or Xbox One emulator within the next year or so than it would be to create a PS3 or Xbox 360 emulator that ran at the speed of the device,” Vanik told Slashdot in a phone interview.

All of Vanik’s optimism is based on one big caveat—that Microsoft and Sony aren’t able to lock down their consoles in ways that would make it impossible to hack into the systems.

Similar to jailbreaking or rooting a phone, developers hack consoles to let them run homebrew programs or other software that isn’t sold by the consoles’ original makers. That’s not what Vanik does, but he relies on such hacks.

“The big thing for writing an emulator is finding the information and reverse engineering it,” he said. “I don’t think it’s been the case that an emulator has been written without there first being some hardware hacks on the system such that people could put mod chips in and run homebrew.”

Until you have homebrew you can’t really have emulators, he added, “because people like me who are writing emulators are looking at the homebrew. The people who get Linux running on these things, I look at their code to see what the CPU registers are that they’re flipping as they’re doing things, and that’s what I use to build the emulator.”

Once Linux is running on an Xbox One or PS4, “an emulator won’t be too far behind,” Vanik said. So what’s the problem? “My worry with this generation is that maybe Sony and Microsoft have gotten really good at preventing homebrew.”

Enterprising hackers were able to break into the Xbox 360 and PS3. The fact that good emulators for these consoles don’t exist had to do with their PowerPC architecture, not a lack of access to the systems, Vanik added. But the Wii U does not yet have homebrew, and the Nintendo 3DS has also held firm against outside exploration.

“Every time a new [Nintendo] DS or Game Boy was released it was always hacked almost immediately and this is the first one that hasn’t been,” Vanik said. “It’s been on the market forever now at this point and no one’s done it yet, so I’m a little worried that companies are getting better at preventing us honest consumers from doing what we want with our hardware.”

Honest Work—But Is It Legal?

Vanik wasn’t joking about being an “honest consumer.” His goal isn’t to play games he hasn’t paid for, but to preserve video game history and to solve complex computer-programming challenges.

“I’m not a fan of piracy. I’m not a fan of stealing things, and software,” he said. “But I feel as a consumer, if I own a copy of this Super Mario World cart and I want to play it on a piece of hardware I own, I should be able to do that.”

The lack of backwards compatibility in new consoles makes it hard for gamers to play old titles—except those that game companies have re-released so that consumers can pay for them a second or third time. “All of those games that were created, all of those works of art and terrible shooters and stuff, they are gone,” Vanik said.

He’s also inspired by the engineering challenge: “An emulator is one of the most complex things that you can write as a piece of software… It touches on so many components of a system to a depth that most people, most engineers will never actually experience.”

Vanik’s Xbox 360 emulator is called Xenia, and is available only as source code. When compiled, the software can load the logos and menus of a few games, but not actually play them yet. A couple of years ago, Vanik wrote a series of in-depth blog posts describing the challenges of building a 360 emulator. He owns “several” Xbox 360s.

Vanik previously created a PlayStation Portable emulator, but stopped developing it after he got a couple of games to run on the platform. The fun was in proving that a PSP emulator could be created, not in the tedious process of ensuring compatibility with every game, which is challenging because each one uses a different subset of a system’s capabilities.

Vanik hasn’t released anything more than his source code because he doesn’t want to be mobbed by people looking for perfect compatibility for random games: “The second you say you have an emulator, you have a bunch of people asking you where they can pirate games and ‘How do I get it to work on my system?'”

Although video gamers playing their childhood favorites on an emulator are unlikely to end up the target of a police raid, doing so is likely illegal. One common belief is that if you own a physical copy of a game, it’s ok to download a digital copy and play it on an emulator. Not so, says Nintendo. While technically you can make a copy of a game you own for “archival purposes,” you’re at greater risk of outlawry when you download a copy from the Internet.

“There is a good deal of misinformation on the Internet regarding the backup/archival copy exception,” Nintendo’s website says. “It is not a ‘second copy’ rule and is often mistakenly cited for the proposition that if you have one lawful copy of a copyrighted work, you are entitled to have a second copy of the copyrighted work even if that second copy is an infringing copy.”

But that’s not the case, the website adds: “The backup/archival copy exception is a very narrow limitation relating to a copy being made by the rightful owner of an authentic game to ensure he or she has one in the event of damage or destruction of the authentic.” Whether or not you own the game, or possess a Nintendo ROM for a limited amount of time, “it is illegal to download and play a Nintendo ROM from the Internet.”

Copyright lawyer Ed Komen of Sheppard Mullin told Slashdot that “there’s always been a distinction in the copyright law between the physical copy of a work and the protected work itself.”

“You could own a copy of a book and have the right to resell the book, lend it, give it away, throw it away, burn it, whatever,” he said. “But that wouldn’t necessarily give you the right to scan it and send out multiple copies to your friends so they wouldn’t have to purchase their own copy.”

Even creating an emulator could potentially be illegal, Komen added: “The term emulator means you’re trying to mimic something else, and if you mimic it too closely you might actually be infringing what you’re emulating.”

Re-using code may constitute a copyright violation, which is why developers attempt to reverse-engineer code instead of re-using any of it. But the story doesn’t end there, because the Digital Millennium Copyright Act has prohibitions on circumventing digital locks. Thus, even reverse engineering code might be illegal if, in the course of reverse engineering, the developer accesses protected parts of the original system. “It’s not really a copyright infringement but it’s an infringement of a different part of the copyright statute called the anti-circumvention provisions,” Komen said.

Vanik regrets that emulation exists in a gray area. “It’s kind of disappointing because it’s just like people who preserve old books,” he said. “These are important pieces of our culture and the continued efforts of these companies to prevent that culture from being retained for history is disappointing.”

Nintendo, on the other hand, believes that “the introduction of emulators created to play illegally copied Nintendo software represents the greatest threat to date to the intellectual property rights of video game developers.”

A “Threat” That Isn’t Going Away

While it exists in murky legal waters, emulation development won’t stop—even though it seemed to have hit a dead end in the last console generation.

An emulator consists of many components: The CPU and graphics chip have to be emulated, as do audio systems, disc drives, controllers, and more. Even a working emulator may not be able to play more than a few games until work has been done to ensure compatibility with each title.

“If you think of all the different features that a GPU would have, it can do environment mapping and cube mapping and 2D textures and all these different shader commands,” Vanik said. “Each game uses a different subset of those features. There might be 1,000 different instructions on the CPU and each game uses a different set of 200 of them.”

If you search online for “Xbox 360 emulator” or “PS3 emulator,” you’re more likely to get a virus than an actual emulator. The PowerPC-based architecture of those systems is difficult to emulate on x86-based computers. “You’ve got to build this really fast and efficient translation layer from the PowerPC chip to the x86, and every single memory access you have to do you have to flip it around,” Vanik said. “It’s a real challenge to make that fast.”

Although the PS4 and Xbox One leverage 8-core CPUs, they’re not that fast compared to today’s high-end PCs; they only seem ultra-fast because games are given near-complete control over the systems. “They can touch any byte in memory they want, they can use every little piece of hardware at the same time,” Vanik said. On PCs, the Direct3D and OpenGL APIs required to interact with graphics chips are “too high-level for doing an efficient emulation of the graphics.”

AMD’s Mantle API “will make doing the GPU stuff really easy” by providing more direct access to the hardware, Vanik suggested, because Mantle “gives you the same exact access that you’d get if you were a software developer writing a game for the PS4, which is really cool.” As an emulator author, he would probably write a Mantle GPU core for this new project and tell followers that they need to buy an AMD GPU to actually perform a full emulation.

Hopefully, Nvidia will start supporting Mantle or create their own API that allows low-level access to their own hardware—but until that happens, emulators of Xbox One and PS4 are more likely to run well on PCs with AMD graphics chips, at least in Vanik’s thinking.

A translation layer between PowerPC and x86 is also unnecessary in this new console generation, thanks to the x86 chips in the Xbox One and PS4. Moreover, Vanik believes that technology such as AMD’s and Intel’s hardware-assisted virtualization for PCs will make it easier to run emulators at full speed.

“I see an emulator for these next-gen systems being similar to a piece of software like VMware or Xen or Hyper-V, where you’re actually building the machine to run as if it was a virtual machine. Normally, emulators are software executables that prop up their own little environment and play in a little sandbox,” he said. Hardware-assisted virtualization could help run emulator code “natively on the machine with hardware acceleration.”

With the Xbox 360, “you basically needed [a PC] four times faster [than the console] to run at the speed the 360 does because of this PowerPC to x86 translator that has to emulate all these hardware instructions.”

While the original Xbox (released in 2001) used an x86 chip, there wasn’t much interest in emulating the console because it had few exclusives that couldn’t be played on the PS2 or PS2 emulators. There won’t be any lack of interest for this latest console generation, and the common architecture between the Sony and Microsoft systems may allow respective emulators to share quite a bit of code.

As for the Wii U, it uses a PowerPC chip just as the Wii did, but talk on the Dolphin forums indicates there’s no development underway to let Dolphin support Wii U games. Building an emulator is a complicated task that often takes collaboration by many people. A forum comment written by Dolphin developer Pierre “delroth” Bourdon two months ago illustrates just how frustrating emulator development can be.

“Dolphin is not fun anymore for me, mostly because of its community, partly because of the code (code can be fixed with proper development methodology, proper development methodology cannot be fixed if other devs are not willing to fix it),” Bourdon wrote. “Also partly because taking on too many reponsibilities [sic](website dev, release manager, infrastructure maintainer, money management, …) means you get burned out much more quickly – and frankly the 4.0/4.0.1 fiasco did not help (not being able to find people to test 4.0.1 after asking around for about 3 days was the last straw).”

Dolphin succeeded as a Wii emulator in large part because the Wii’s active homebrew community made it relatively easy to find proper documentation of the system. That hasn’t happened with the Wii U. And as noted earlier, Vanik worries the same state of affairs will plague the PS4 and Xbox One. Until the new consoles are jailbroken and have active homebrew communities, emulation will have to wait. But Vanik, and surely others, will be ready when that day comes.

“For me, personally,” Vanik said, “it is a labor of love.”


Image: Sony

Upload Your ResumeEmployers want candidates like you. Upload your resume. Show them you’re awesome.

Post a Comment

Your email address will not be published.