title: tvOS istream failure
body: <p>I'm trying to run the <a href="https://github.com/jzdziarski/nestopia/" rel="nofollow">Nestopia NES Emulation library</a> on tvOS but every time it tries to load its database or the game file it halts here</p>
  
  <pre><code>void In::SafeRead(byte* data,dword size) {
      static_cast&lt;std::istream*&gt;(stream)-&gt;read( reinterpret_cast&lt;char*&gt;(data), size);
  }
  </code></pre>
  
  <p>Without any console output and with EXC_BAD_ACCESS (code=1 address=0xffffffff00000000)</p>
  
  <p>This is my ViewController</p>
  
  <pre><code>class ViewController: UIViewController {
      let emuWidth: CGFloat = 341.0
      let emuHeight: CGFloat = 320.0
  
      var emulatorCore: EmulatorCore!
      var emulatorView: ScreenView!
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          self.emulatorView = ScreenView(frame: CGRectMake(0, 0, emuWidth, emuHeight))
          self.emulatorView.backgroundColor = UIColor.blackColor()
          self.view.addSubview(self.emulatorView)
  
          self.emulatorCore = EmulatorCore()
          self.emulatorCore.initializeEmulator()
          self.emulatorCore.frameBufferSize = CGSizeMake(emuWidth, emuHeight)
  
          do {
              let fileManager = NSFileManager.defaultManager()
  
              if !fileManager.fileExistsAtPath((NSTemporaryDirectory() as NSString).stringByAppendingPathComponent("NstDatabase.dat")) {
                  try NSFileManager.defaultManager().copyItemAtPath(NSBundle.mainBundle().pathForResource("NstDatabase", ofType: "dat")!, toPath: (NSTemporaryDirectory() as NSString).stringByAppendingPathComponent("NstDatabase.dat"))
              }
  
              if !fileManager.fileExistsAtPath((NSTemporaryDirectory() as NSString).stringByAppendingPathComponent("mega_man.nes")) {
                  try NSFileManager.defaultManager().copyItemAtPath(NSBundle.mainBundle().pathForResource("mega_man", ofType: "nes")!, toPath: (NSTemporaryDirectory() as NSString).stringByAppendingPathComponent("mega_man.nes"))
              }
          } catch _ {
              print("Error copying files!")
          }
  
          if self.emulatorCore.loadROM((NSTemporaryDirectory() as NSString).stringByAppendingPathComponent("mega_man.nes")) {
              self.emulatorCore.configureEmulator()
              self.emulatorCore.screenDelegate = self.emulatorView
              self.emulatorCore.frameBufferAddress = self.emulatorView.frameBufferAddress
  
              self.emulatorView.delegate = self.emulatorCore
          } else {
              print("Error: invalid game path")
          }
      }
  }
  </code></pre>
  
  <p>The same code runs just fine on iOS.</p>
  
  <p>Thank you!</p>