# Nestopia (NES emulator)



## vsoto (May 15, 2012)

Nestopia is reputed to be the most accurate NES emulator.
With three very minor modifications to the Linux port it compiles and runs under FreeBSD 9. Everything seems to be working OK except that it dumps core when trying to save a movie of the gameplay. This happens right after closing the GTK dialog where the name of the movie file is selected. The file is created but it is empty.
Using *gdb* on the core file gives the following:


```
(gdb) bt
#0  0x0000000804a93b35 in sentry (this=0x7fffffffd190, __os=@0x80eaf6010) at ostream.tcc:221
#1  0x0000000804a93c37 in std::ostream::write (this=0x80eaf6010, __s=0x7fffffffd1c0 "NSV\032\b", __n=4) at ostream.tcc:221
#2  0x00000000005a2272 in Nes::Core::Stream::Out::Write32 (this=Variable "this" is not available.
) at basic_ios.h:114
#3  0x000000000059c25e in Nes::Core::State::Saver::Begin (this=0x80eb15e58, chunk=Variable "chunk" is not available.
) at source/core/NstState.cpp:71
#4  0x00000000005bc347 in Nes::Core::Tracker::Movie::Record (this=0x80fffd9c0, stream=@0x80eaf6000, append=false)
    at source/core/NstTrackerMovie.cpp:68
#5  0x00000000005abfe1 in Nes::Core::Tracker::RecordMovie (this=0x80903b030, emulator=@0x80903b000, stream=@0x80eaf6000, 
    append=false) at source/core/NstTracker.cpp:51
#6  0x00000000005c6b0e in Nes::Api::Movie::Record (this=Variable "this" is not available.
) at source/core/api/NstApiMovie.cpp:47
#7  0x000000000041a022 in auxio_do_movie_save () at source/linux/auxio.cpp:339
#8  0x00000008fffffffd in ?? ()
#9  0x0000000000000000 in ?? ()
#10 0x73762f656d6f682f in ?? ()
#11 0x706d6f632f6f746f in ?? ()
#12 0x7473656e2f656c69 in ?? ()
#13 0x7861462f6169706f in ?? ()
#14 0x736e2e7564616e61 in ?? ()
#15 0x000000080ed30076 in ?? ()
#16 0x000000080eff6700 in ?? ()
#17 0x000000080ed41200 in ?? ()
#18 0x000000080ed41200 in ?? ()
#19 0x00000000005c2500 in Nes::Core::Tracker::Rewinder::Execute (this=Variable "this" is not available.
) at basic_ios.h:274
#20 0x0000000000000002 in ?? ()
#21 0x00000000ffffffff in ?? ()
#22 0x0000000000000002 in ?? ()
#23 0x0000000000000000 in ?? ()
#24 0x0000000800d8d5fe in SDL_mutexV () from /usr/local/lib/libSDL-1.2.so.11
#25 0x0000000800d4dd7c in SDL_PeepEvents () from /usr/local/lib/libSDL-1.2.so.11
#26 0x0000000000000000 in ?? ()
#27 0x0000000000000000 in ?? ()
#28 0x000000000040a5e5 in main (argc=Variable "argc" is not available.
) at gthr-default.h:199
(gdb)
```

I think it fails when trying to write the string "NSV\032\b" to the movie file, maybe it is some kind of magic number to identify the movie files which have .nsv as suffix. This failure happens when compiled with g++, g++46, and clang++.
Any ideas on how to fix this?
Thanks.


----------



## Bentley (May 28, 2012)

vsoto said:
			
		

> With three very minor modifications to the Linux port it compiles and runs under FreeBSD 9.


What are those modifications?

Your backtrace would be a lot more useful if it had complete debug symbols. It looks like the executable or some libraries on your system are stripped and donâ€™t have them.


----------



## tehcloud (Dec 31, 2012)

I forked Nestopia a few months back, and recently made some changes to "officially" support the three major BSDs. Available on the devel branch here: https://github.com/rdanbrook/nestopia

As for the crash when saving movies, that's not a BSD-specific problem. I've been looking deeper into it and hope to have it fixed before I tag another release. Of course, if someone else can figure it out I'd be more than happy .


----------



## tehcloud (May 16, 2013)

There's full upstream support for the BSDs in Nestopia now. Source tarballs are available at http://sourceforge.net/projects/nestopiaue/files/ and the Git repo is in the above post.


----------

