Is the NES Classic's emulator a port of an existing one?

Discussion in 'General Gaming Discussion' started by Harsky, Nov 15, 2016.

  1. Harsky
    OP

    Harsky Madmin

    Member
    5,339
    445
    Aug 2, 2004
    Sorry if this has already been discussed but looking at this page:

    https://www.nintendo.co.jp/support/oss/index.html

    Shows that the NES Classic has some open sourced software which Nintendo has released as part of the licensing agreement. Does this mean that they took an existing emulator and modified it or is it a case of they were cherry picking some software while using proprietry software as well?

    I just find it interesting that they decided not to use an existing emulator from the Wii/3ds/Wii U.
     
  2. xtheman

    xtheman GBAtemp Guru

    Member
    5,847
    5,275
    Jan 28, 2016
    United States
    The thing is suppose to be running linux so sources have to be given.
     
  3. FAST6191

    FAST6191 Techromancer

    pip Reporter
    23,516
    9,335
    Nov 21, 2005
    At this point I have downloaded the thing linked and am now looking through it. I have not read any analysis of emulator binaries, nor any other analysis beyond seeing headlines about it being hacked and running Linux of some flavour.
    They might well have used modified versions of their existing emulators though, the filters and such they were showing off the other month are not especially long winded things to code, though nice to have I guess. Many times this sort of thing is often just the code used in the menus, help files (if it is all HTML then why write your own browser when you can just port/compile and existing one and release any changes? If you are not in the business of selling a browser or having it as a main feature of your device...) and whatever else. It looks like the hacking is already done so no great use for me in doing version number analysis to see about exploits.

    Anyway in the download

    alsa-lib-1.0.29.tar.bz2
    busybox-1.24.1.tar.bz2
    clovercon-km-6b883396add00817aa112e0ec4dbc112def803e8.zip
    cryptsetup-1.6.8.tar.xz
    eudev-3.1.2.tar.gz
    ext-luajit-83dda3b07286174de43ee5adb25e7cc5fbe308e3.tar.gz
    ext-sdl2-23fb2205dd1044dc0ab0858aaa59af9aebb20d1b.zip
    ext-sdl2_mixer-2f88185f477e203619a82d530a31cf72fb076a68.zip
    ext-soloud-fed891f0123d9ca70df1e5a3927018216c964f7b.tar.gz
    glibc-2.22.tar.xz
    kmod-20.tar.xz
    libpng-1.6.20.tar.xz
    linux-3.4.110.tar.xz
    linux-9ed0e6c8612113834e9af9d16a3e90b573c488ca.tar.gz
    LVM2.2.02.132.tgz
    lzo-2.09.tar.gz
    pax_global_header
    popt-1.16.tar.gz
    r16-uboot-fc3061df4dbd4153819b2d2f141d82b88fea51cf.tar.gz
    util-linux-2.27.1.tar.xz
    zlib-1.2.8.tar.xz

    alsa
    http://alsa-project.org/main/index.php/Main_Page
    One of the Linux sound... I don't want to say libraries as it is more than that but it is one of the methods Linux distros manage sound with. I don't know how popular it is right now as some other things have risen up and are nipping at its heels but is it not a niche thing by any means.

    busybox
    https://busybox.net/about.html
    Designed for embedded linux. It bills itself as a program that bundles the features of many other command line programs Linux uses into one big program. https://busybox.net/downloads/BusyBox.html
    Useful to have, saves maintaining a whole list of them or removing specific ones if you are locking things down a bit.

    clovercon
    A Nintendo developed program/library/tool/module,
    " * Controllers I2C driver
    * Copyright (C) 2016 Nintendo Co. Ltd
    MODULE_AUTHOR("Christophe Aguettaz <christophe.aguettaz@nerd.nintendo.com>");
    MODULE_DESCRIPTION("Nintendo Clover/Wii Classic/Wii Pro controllers on I2C");
    "
    Was Clover the dev name of the device? Anyway i2c is a popular chip to chip communications protocol, used by wii nunchucks and many things besides
    http://www.britishideas.com/2011/08/20/reading-a-wii-nunchuck-using-i2c/
    Probably of interest to those making PC adapters or adapting controllers to this device.
    I attached it to this as it is tiny and might save someone downloading a couple of hundred megs for no great gain otherwise.

    cryptsetup
    https://gitlab.com/cryptsetup/cryptsetup/
    https://gitlab.com/cryptsetup/cryptsetup/wikis/FrequentlyAskedQuestions
    A means to allow disc encryption to interact with various aspects of Linux. I imagine Nintendo encrypted the NAND image and whatever else and encryption is usually only any good if you can have the people/things that need to read it actually able to do so. (the times where it is not useful being when you want your enemies to spend their resources analysing essentially random information).

    eudev.
    https://wiki.gentoo.org/wiki/Project:Eudev
    It says " fork of systemd-eudev. Potentially contentious this one, though not for this module.
    systemd is a newer way of having things load at startup, compared to the older init stuff, and this is then a thing which acts as a device manager for it.

    LuaJIT
    "LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language."
    Project Homepage: http://luajit.org/
    Lua is a popular, ish, programming language and one with a long history in emulation and embedded systems (I have fished it out of commercial DS games on several occasions). Just In Time is a method of turning script based coding stuff into actual executable code but not long before it is run but actually on the system, possibly just before it is run and maybe in response to other things which have happened before it. You would probably have heard about it in relation to Java before, maybe also in discussion in the 3ds' appalling javascript performance. Alternatively it is sort of related to the concept used in many higher level emulators which is known as dynamic recompilation.
    Anyway nothing particularly interesting, other than speaking to a more flexible security setup for memory than the 3ds. I don't know if it will be able to speak to emulators a la http://www.fceux.com/web/help/fceux.html?LuaScripting.html or is used somewhere else in the system.

    SDL
    http://www.libsdl.org/
    I could waffle but from the readme
    "Simple DirectMedia Layer is a cross-platform development library designed
    to provide low level access to audio, keyboard, mouse, joystick, and graphics
    hardware via OpenGL and Direct3D. It is used by video playback software,
    emulators, and popular games including Valve's award winning catalog
    and many Humble Bundle games."

    SDL mixer
    http://www.libsdl.org/projects/SDL_mixer/
    Once more the readme says nice things
    "Due to popular demand, here is a simple multi-channel audio mixer.
    It supports 8 channels of 16 bit stereo audio, plus a single channel
    of music, mixed by the popular MikMod MOD, Timidity MIDI and SMPEG MP3
    libraries."
    I opened one of the batch files in it and it mentions nerd-dev.com along with a bunch of very windows related stuff, nothing but a basic just installed hosting page on the site
    Doing a whois on said site
    "Registrant Name: Nintendo Support IT
    Registrant Organization: MOBICLIP
    Registrant Street: 128 rue de Rivoli
    Registrant City: PARIS
    Registrant State/Province: Ile-de-France
    Registrant Postal Code: 75001
    Registrant Country: FR
    Registrant Phone: +33.153300365
    Registrant Phone Ext:
    Registrant Fax: +33.153300122
    Registrant Fax Ext:
    Registrant Email: [it is there on the whois]
    "
    Mobiclip is a company Nintendo purchased some time back which made a video format used by various Nintendo consoles ever since.

    SoLoud
    http://sol.gfxile.net/soloud/
    "SoLoud is an easy to use, free, portable c/c++ audio engine for games."
    Curious as the folks over at nesdev have questioned the audio quality for this emulation. http://forums.nesdev.com/viewtopic.php?f=3&t=15073
    Not sure what goes with alsa and the mixer library above though.

    lib C
    Standard C library used with linux and its dev tools.
    https://www.gnu.org/software/libc/

    kmod
    http://git.kernel.org/cgit/utils/kernel/kmod/kmod.git/about/
    "kmod is a set of tools to handle common tasks with Linux kernel modules like
    insert, remove, list, check properties, resolve dependencies and aliases."

    libpng
    A library for viewing PNG images. Very popular for this sort of thing. Not sure of its exploit history but historically a lot of image libraries have been good places to look (the PSP having several).
    http://www.libpng.org/pub/png/libpng.html

    Linux
    The Linux kernel and bulk of the download. 3.4 is an older kernel ( Linux 3.4 has been released on 20 May, 2012. https://kernelnewbies.org/Linux_3.4 ), other things in this source date from 2015 but seemingly not that.

    LVM2
    A logical volume manager. Keeps the various drives and files/devices purporting to be them and the kernel running the show all happy. Might have been of some interest if injecting new games proves to be hard at some level
    https://sourceware.org/lvm2/

    lzo
    " LZO is a portable lossless data compression library written in ANSI C.
    It offers pretty fast compression and very fast decompression.
    Decompression requires no memory."
    http://www.oberhumer.com/opensource/lzo/
    Compression is useful to have, this is one that works and is pretty well tested.

    pax global header is just a file which git dumps have to help identify times and people involved.

    popt3
    "This is the popt(3) command line option parsing library...
    Complete documentation on popt(3) is available in popt.ps (included in [the download]".
    There have been some interesting things in command line fiddling over the years, shellshock for instance ( https://blog.cloudflare.com/inside-shellshock/ ), but whether this would be interesting to the general hacker I am not sure.

    uboot
    http://www.denx.de/wiki/view/U-Boot
    "U-Boot, a boot loader for
    Embedded boards based on PowerPC, ARM, MIPS and several other
    processors, which can be installed in a boot ROM and used to
    initialize and test the hardware or to download and run application
    code."
    Tapping into bootup is a goal of hackers of embedded devices like this, I don't know if uboot itself is inherently interesting as the stuff layered on top of it. Might be worth seeing what was changed and if that gives any clues on the crypto involved. That said nobody cares if it is 2 cycles or 2 seconds into bootup where you take over so if you have another means to get your code in then why spend the effort, unless you are doing some kind of brick protection I guess.

    util-linux
    http://git.kernel.org/cgit/utils/util-linux/util-linux.git/about/
    Another bundle program containing common commands seen in Linux. Might be worth having a look to see what was stripped out or nerfed, if anything, as it does include some fairly far reaching commands if the wikipedia page is anything to go by
    https://en.wikipedia.org/wiki/Util-linux

    zlib.
    http://www.zlib.net/
    Another popular compression library, used everywhere for everything really.


    -----

    So yeah no emulator code included, mostly just libraries and things. I imagine some poor bastard had to go through it and see what went but they also appear to have released stuff which could almost compile as is rather than a list of changes (which is the extent of their legal obligation). I certainly did not undertake any kind of analysis of anything here (no compares against current or the versions they were based on, much less anything I might want to work up into an exploit) and this is just a basic overview and what might be interesting to would be hackers. The controller stuff and the web stuff mentioned are the things I am looking at with most interest, though the udev stuff I don't want to dismiss either.
    Certainly no indication that they just took fceux and recompiled it or anything, though again I await analysis of the binaries to see how similar it might be to some virtual console or GBA emulators or anything like that really.
     

    Attached Files:

  4. RevPokemon

    RevPokemon GBATemp's 3rd Favorite Transgirl

    Member
    4,843
    2,429
    Aug 24, 2014
    United States
    Fort Gay, West Virginia
    In order for them not to have to they could have just done like Valve did with SteamOS.

    Of course the issue which would prevent them is the fact of the legal reasons as most of the NES emulators use a GPL variety and would be required to give their code which I doubt they would want to show to be completely honest. But I would argue it is likely at least semi based off their current NES emulators.
     
  5. Sonic Angel Knight

    Sonic Angel Knight GBAtemp Legend

    Member
    10,008
    5,049
    May 27, 2016
    United States
    New York
    Maybe they will release a Gameboy classic system that is just rapsberry pi inside of the original game boy or gameboy color with 30 games to play, have like a 720P 5 inch screen. :P
     
    hobbledehoy899 likes this.
  6. FAST6191

    FAST6191 Techromancer

    pip Reporter
    23,516
    9,335
    Nov 21, 2005
    Who knows who might have looked at what when writing something else. That said they have rolled their own NES emulators since the GBA at least (various commercial devs did use pocketnes quite legitimately but Nintendo's classic nes/famicom mini line was their own work from what I saw, and people did drill into it, and similar stories with the Wii VC. Not sure about the GC Animal Crossing stuff).
    The question then becomes what modifications would Nintendo have to/want to do to FCEUX (which yes is GPL2 licensed if https://sourceforge.net/projects/fceultra/ is anything to go by) or the MAME core (also GPL as of not so long ago) that handles NES stuff? Accuracy wise it seems they are better than Nintendo's present offering, assuming that nesdev thread is accurate and I have no reason to doubt that, and that mainly leaves just stripping out all the functionality you might not want. Maybe if those fancy filters they were showing off represented some real work (for my money nothing shown there was anything close to what http://bogost.com/games/a_television_simulator/ had however many years ago that was showcased), though I would also find it hard to believe they could not do an end run around that somehow.

    I reckon the bigger issue would be it then legitimises the emulators they and that puts it somewhat at odds with the "emulation is basically piracy" stance they took otherwise ( https://www.nintendo.com/corp/legal.jsp#emulator ), and have done nothing to dissuade ( http://www.gdcvault.com/play/1023470/-It-s-Just-Emulation ) since.
     
  7. RevPokemon

    RevPokemon GBATemp's 3rd Favorite Transgirl

    Member
    4,843
    2,429
    Aug 24, 2014
    United States
    Fort Gay, West Virginia
    In some sense it almost makes my think of Napster (off topic watch Downloaded if you can as it is a great documentary) in that you have the technology side of it which everyone knows is great and impressive yet you have the fact that the impressive technology is mainly used for questionable reasons. In fact even when I read what they think it is basically like Napster in that it is not the technologies that they are against (since they use them as do other companies like Capcom or Sega) but it is the fact that so often they are used against their wishes. And I would add that they know this as well. However I feel that from their stand point it is hard to separate the cool tech side from the piracy side which causes them to hate this technology and want to attack it. But at the same time it is not just Nintendo as most companies have similar attitudes to some extent since regardless it is costing them some money in their eyes (as seen by the views of the ESA) altough many have heavily taken cue.
     
  8. FAST6191

    FAST6191 Techromancer

    pip Reporter
    23,516
    9,335
    Nov 21, 2005
    Though there are laws based upon people, a majority or a significant in some way minority, not being able to handle things (drugs, weapons and animals being popular examples) most tech stuff tends to have phrases like "substantial non infringing uses" fly all around in the eventual rulings and judgements. As homebrew would then be part of that use*, and emulation as an alternative in the case of legitimately owned software probably could be some flavour of OK (I know what I would rule but I don't want to bet on what a judge might be swayed to do), possibly also disabled peoples getting a chance to play then that gets hard to argue against emulation.

    *given the DMCA exemptions that get revisited every so often specifically exempt a lot of things to do with running user code on locked devices then I reckon that could almost be some kind of precedent, even if we do end up throwing out sega vs accolade or galoob and Nintendo..