Video Game Emulation and ROM Hacking Introduction
Total Page:16
File Type:pdf, Size:1020Kb
Chang Li Writing 340 – Harlynn Ramsey About the author – Chang is a junior previously majoring in computer science, now having turned to the dark side, also known as electrical engineering. In her spare time, she enjoys reading user-written documentation on reverse engineering and hacking. Spending time in gray area communities has led to many one-on-one encounters with a number of influential developers in the CS and EE world who also enjoy activities of questionable copyright legality. Keywords – electrical engineering, computer science, entertainment Suggested multimedia - http://www.youtube.com/watch?v=_lnogpRPvY4 – Speedrun of NES Rockman http://www.youtube.com/watch?v=3UnB1fomvAw – hacking Pokemon Yellow for arbitrary code execution http://www.youtube.com/watch?v=7_HMLvLB7b0 – CS student proposes by hacking SNES Chrono Trigger Abstract – Retro video games and game consoles are harder to find and use today, both because they are out of production and the units that still work slowly stop working with age. However, the experiences of the past live on through today's emulation capabilities on the computer. With new technologies come new possibilities, and video game emulation is no different. Against the danger of copyright violation, emulation has thrived, because of both its access to old gaming experiences and new gaming possibilities. F1 to Load State: Video Game Emulation and ROM Hacking Introduction Today, many games for consoles and handhelds such as the PlayStation or Gameboy can be played on the computer. This is accomplished through emulators, which read data from copies of original games and process it for play on the current operating system, usually the computer. Most discussion on emulation focus on issues of piracy, but rarely touches a separate area of gaming opened up by getting access to game data: ROM hacks. Anyone with a hex editor and a binary copy of the game can alter the code and therefore the game. Despite the controversial copyright status of emulation and ROM hacking, both activities have positively influenced the state of video games. Inside a ROM Dump Video game ROM media greatly changed over the years, from cartridges (Nintendo products) to CDs (Sony hardware). Non-CD ROM files can be easily dumped as a binary file onto a computer once they are connected to a computer with an interface that can read the stream of ROM data; a Gameboy ROM can dumped with just an Arduino connection [1]. Most users skip the cartridge disassembly and dumping (the top two procedures in Figure 1) and directly download predumped ROMs from online Figure 1: Pokemon Fire Red ROM. From cartridge to binary file. In the hex editor, each group of numbers correspond to a processor instruction. Sources: http://rakanalysis.files.wordpress.com/2012/08/pkmnfr2.jpg, http://www.insidegadgets.com/wp- content/uploads/2011/03/IMG_1996.jpg repositories. CD-ROMs are easier to read and copy, because almost all modern computers can directly use CDs. Once on a computer, the ROM dump can be freely edited with a hex editor, as shown by the bottom graphic in Figure 1. With an emulator, the games can be tested and debugged. For native computer files, hex editing is the only necessary step, as ROM dumping is unnecessary. How Emulation Works All digital electronics decompose into simple bits of ones and zeroes. In addition, all computers have a processor for calculating computer instructions, which are usually composed into three sections: two operands, which contain values to manipulate, and an “op code,” or the operation code, that specifies how to manipulate the operand values. Processors with different architectures (e.g. different processor technologies, such as Intel and ARM) have different instruction organization; this means processor instructions are not interchangeable unless specifically designed with compatibility. For older and less complex hardware with thorough documentation, such as the Gameboy and SNES [2, 3], one way of implementing emulation on a different architecture (such as on a computer operating system) is by reconstructing the emulated hardware system's structure. This way, the ROM file's instructions, such as the ones in hexadecimal at the bottom of Figure 1, can be processed the way original hardware would, which in turn can be processed for use on the running operating system [4]. The source code for two popular emulators, VisualBoyAdvance and Project 64, are shown in Figure 2. Figure 2: OpCodes for the Gameboy Advance (left) and N64 (right). Based on VisualBoyAdvance 1.7.2 and Project 64 2.0 Both emulators have structures for mapping instructions in the ROM with the corresponding opcodes, which allow for higher level processing. Better computing hardware brought about new successful emulator designs, but this form of low level emulation is still popular for emulating older consoles. Many past handheld and console emulators have retired and are no longer in production. This means emulators and the tools that manipulate ROM files can only improve on the existing hardware and allow more convenient ROM hacking. The ability to read and edit game data, down to the last byte, jumpstarted many new ways to play with games and data that the original hardware can never provide. Fan Translations Many major game hardware developer companies have resided in Japan (Sony, Nintendo, Sega), which means most games will be first developed in Japan before released in the western world with a translation. Unfortunately, for a variety of reasons, such as profitability or perceived lack of demographic interest, not all games can be translated and released in the west. Some official western releases also suffer from poor quality translations, as shown in Figure 3. Fortunately, this does not stop Figure 3: Official translations gone wrong. The left is from the game Zero Wing, and the right from Terranigma. Source: http://www.hardcoregaming101.net/Fantranslation/terranigma.png, http://www.allyourbasearebelongtous.com/allyourbase.jpg people with enough tech savvy to take matters into their own hands. Some of the most well-known Japanese titles, such as Square Enix's older NES and SNES titles, never officially released for the western world [5]. Existence of these translations allowed much of the western world to enjoy games that otherwise would never see the light of day or better localization (an official international release in a foreign language). While ROM hacks and translations remain a gray area in terms of copyright infringement, some developers have acknowledged their value in allowing a previously excluded player base to enjoy the same game. One of the biggest Nintendo “cult classics,” the Earthbound series, only had an official localization for one of the three games. Despite positive rave from actual players, sales were poor, which led to the company's never releasing any of the other titles [6]. Fans eventually released their own translations for the other two games, expanding the player base who wanted an official way to support the series. Fans have gone as far as sending physical petitions to Nintendo of America in hopes of a localized Mother 3, gathering some thirty thousand signatures [7]. Only recently has Earthbound been released over the Wii U's Virtual Console for western audiences, after years of fan attempts to get more official localization. Without the popularity generated by availability of the fan translations, not even the modern console's Virtual Console emulation center would have seen a release for this series. Other companies, like XSeed, western publisher for the Ys series, realized the potential in using already existing fan translations to simplify localization efforts, and work alongside translation groups to make high fidelity international releases [8]. The Ys collaboration effort show that companies can benefit by embracing fan translation work, even if fan translations skirt the edge between legal and illegal, instead of treating unlicensed work as a business threat. Fan translations usually focus on popular commercial titles that lack localization, but one rarely hears of a free game turning into a commercial success. Cave Story, a one-man project by “Pixel” Daisuke Amaya, was released in 2004, and translated into English by the ROM hacking group Aeon Genesis in 2005 [9]. The game skyrocketed in popularity once western gamers played it. It was so successful that Tyrone Rodriguez of Nicalis contacted Pixel about a Wiiware release [10]. Today, multiple ports of the original freeware game and commercial releases on the major computer operating systems and Nintendo handhelds are available. The game itself was a success, but held greater impact on the game industry itself. Cave Story's success in the mid 2000s is the paragon of the indie developer's humble beginnings into great achievement, spearheading the movement of the indie game industry into what it is today. Without Aeon Genesis's fan translation, Cave Story might have stayed unknown to the west, unnoticed for years or even forever. Fan Creations ROM hacks are not limited to just localization of games. With enough time, entirely new games can be made. The most prominent ROM hacking community is for Pokemon, one of the world's most successful franchises. With a rich battle system, large number of monsters, and a large explorable world, almost everything in Pokemon is customizable, limited only by the hacker's imagination. Many specialized tools save the user from having to deal with directly editing low level assembly code, and instead provide convenient interfaces for manipulating monster sprites, map tiles, and finding free space for storing added data. Figure 4 shows Touhoumon, a series of hacks that cross the Touhou games, another popular Japanese game series, with Pokemon [11]. The map tiles (the wooden house and shrine gate) are edited to fit Touhou's eastern setting, and the new character sprites resemble Touhou characters. The Pokemon data organization makes adding and editing text and graphics a Figure 4: Touhoumon overworld.