Commit graph

29 commits

Author SHA1 Message Date
Daniel Prilik
67cfa183f8 re-enterant scenes!
wowie this was a trickyboi to figure out, but I think I managed to
get a decent-working solution.

The algorithm consists of 2 parts: 1) detecting scene transitions,
and 2) figuring out if the new scene is a duplicate.

Part 1) was solved using perceptual hashing, and watching the delta
of the frame hash between frames. When it spikes, odds are that's a
scene change.

Part 2) was a bit trickier, but boils down to hashing every frame
and associating it with a scene + scroll values. That way, when a
scene transition is detected, I can check the hash-maps to see if
the "new" frame is actually one I've seen before.
There is a bit of extra work that gets the technique working with
elaborate fade-in animations / animated backgrounds, but it's not
magic or anything.

What's left?

Well, 1) needs to be improved, since the current delta threshold
value i'm using has been pulled out of thin air, and while it gives
reasonable results on many games, ideally, it should be more robust

2) is pretty good though!

All that I need to do now to be super happy with it is serialize
the scene data and enable loading / saving it to disk! Once that's
done, the initial vision of being able to automatically map out a
game will have come true!

exciting!
2018-07-20 15:23:31 -07:00
Daniel Prilik
e0b5ceef39 made ppu_debug into a GUI module + cli toggle wideNES and ppu_debug
no more SDL in ANESE core!

Also, with this commit, I can merge back into master, since wideNES
is hidden behind a flag :)

Before I do that though, a bit of cleanup is in order :)
2018-07-12 17:40:00 -07:00
Daniel Prilik
871daf6aa1 tweaked callbacks + refactored SDL_inprint
I wanted to use SDL_inprint in multiple renderers, and that meant I
had to modify the library a little bit.

also, I just noticed that the smearing issue is back! Not as bad as
before, but MMC3 games seems to be affected when the screen scrolls
upwards...

wierd.
2018-07-12 11:28:54 -07:00
Daniel Prilik
245a8b4d97 basic persistent config
cross-platform support man. it's tricky.

I didn't want to include more libraries, but I really didn't want to
deal with cross-platform pathfinding, or coming up with a custom
config format.

I still had to slap together a janky solution for getting a folder's
absolute path across platforms, but it seems to get the job done...
2018-06-29 12:20:59 -07:00
Daniel Prilik
3bfe347fa5 begin work on custom APU
I have no idea what i'm doing lol.

I'm starting with the noise channel, since I think that might be the
easiest to do?

I _think_ I implemented it properly, since sniffing the output gives
reasonable volumes, but I don't really understand how to generate
sound waves from it yet...
2018-06-25 10:40:39 -07:00
Daniel Prilik
f65b943078 replace heavyweight args with single-header clara
oh, and fixed a bug where I didn't clear save-states across game
loads / saves.
2018-06-19 18:58:48 -07:00
Daniel Prilik
e99b7d13c3 added a SDL filepicking UI
tinyfiledialogs was a good band-aid, but it was always kind-of a
janky solution. Mind-you, this file-browser I threw together ain't
the nicest either, but at least it's within the main SDL window.

Now that the menu is in place, it's possible to switch between
games without restarting! Also, opening the file-picker pauses
ANESE, so that's good to finally have.

Thanks a bunch to cute_headers for a neat little cross-platform
directory traversal library, and also SDL_inprint for a quick-and-
dirty embedded font for use in the menu. Not having to bring-in
SDL_ttf is a huge load off my shoulders.

Oh, and i've noticed that `gui.cc` has started to get bloated, so
now I need to get around to cleaning it up weeeeee.
2018-06-11 18:36:48 -07:00
Daniel Prilik
60836bd54c added macOS bundle creation to make install
It's kinda jank, but hey, it works?
The serious issue is that it relies on the SDL2 dylib installed
from homebrew, and if that verion ever gets bumped, RIP.
2018-06-05 15:44:15 -07:00
Daniel Prilik
2aa17b3c97 add appveyor CI 2018-06-05 11:05:30 -07:00
Daniel
eaba4fdb6c windows fixes
fucking windows REEEEEEEEEEEEEEEEEEEEEEEE
fopen() silently converts line-endings on windows, and since I did
not explicitly say I was wiring binary data, it solently bloated my
sav size.
Literally fixed by adding a single char: "w" -> "wb"

Also cleaned up some things that were causing compiler warnings.
Nothing mission-critical, but its nice to keep things clean.
2018-06-01 22:14:16 -07:00
Daniel Prilik
4751db118d mapper cleanup and major reorg - part II
I shuffled A LOT of files and functions around.

Two big things in this change:

1) There is no more Cartridge class.

I wrote that class when I was just starting out with ANESE, and
before I had a good idea of how NES hardware operates. As it turned
out, the Cartridge class essentially just mirrored the Mapepr
interface! The only real functionality it brought to the table was
routing the raw ROM data through into thte ROM_File class, which
would parse the ROM data.

I restructured all that.

File parsing shouldn't be under the /nes directory, since the nes
couldn't care less if the ROM file is iNES, NES2.0, or whatever
other formats there are. All the NES cares bout is that there is a
ROM_File struct with good data in it.
So, I moved the specifics of file-format parsing out of /nes, and
put them under /ui/fs/parse_rom.h.

I've changed all the interfaces that used Cartridge to just use
Mapper, and pushed the construction and ownership of the ROM_File
struct to main() for now. Which leads to number 2...

2) Main doesn't have any filesystem code anymore.

Yep, i've moved all the code required to read roms (and general
files) into /ui/fs/load_rom.h, so all main() has to do is pass the
path to a ROM / file, and it gets back a fully validated ROM_File
struct, or filled data pointers!

The code could still use some work, reorganizing the freestanding
functions into classes / namespaces, but this is a big step-up
from just having it all cluttering up main()

----

So yeah. Not much on the emulation front today, mostly just
improving code-quality.

(i'm also just procrastinating having to implement MMC3 lol)
2018-05-22 17:45:08 -07:00
Daniel
338cb9895a fixed windows builds 2018-05-20 11:42:25 -07:00
Daniel Prilik
41a5ae8cb6 more granular speed-adjust, some cleanup in main.cc and CMakeLists
I'm just procrastinating debugging the PPU.
2018-05-16 13:19:07 -07:00
Daniel Prilik
8ad770c589 fix windows build 2017-12-20 00:19:30 -05:00
Daniel Prilik
edb40e42e7 APU courtesy of Blargg's 💯 nes_snd_emu library
I started looking into how to make the APU, and boy, let me tell
ya, it's going to be a massive undertaking.

Undoubtedly a fun undertaking, but still...

Since it's a personal goal to get Super Mario Bros 2 running
before new years (after all, that game has won
game-of-the-year i don't even know _how_ many years in a row),
i've decided to just use Blargg's venerable `nes_snd_emu` library
for now.

It took some wrestling, it it's in, and it works!

Almost.

I still don't know why enabling the Frame IRQ kills most games, but
i'll look into that!

Welp, on to bigger and better things!
Namely: MMC1, which will give me Zelda and... Super Mario Bros 2!
2017-12-20 00:00:56 -05:00
Daniel Prilik
c0e9556e1d add support for zipped roms
golly, i sure do hate cmake.
why does c++ package management have to be so bloody hard?
2017-12-18 22:26:56 -05:00
Daniel Prilik
14d278e5d2 ui and build improvements
added some 3rd party libs today! man, cmake is pretty complicated,
so it took a while to figure out, but hey, it seems to be working,
so that's good!

I added two libraries:
- `tinyfiledialogs` to handle opening a file-select window (that
  varies per platform) in the case that no rom is specified on the
  commandline.
- `args` handles parsing and validation of commandline arguments.
  As I start to add more and more flags, it's probably a good idea
  to set up a more extensible framework to configure ANESE

Oh, and FYI, this is all me procrastinating working on the PPU.

weeeeeeee!! isn't emulation fun?!
2017-12-14 16:17:51 -08:00
Daniel Prilik
c47461cdc0 add logo + windows exe icon 2017-12-13 13:58:39 -08:00
Daniel Prilik
8b7c5f525e switch msvc to use Release config
yeah, i'm a bit of a dummy. I was building ANESE in _Debug_ config
with MSVC, and wondering why it was so bloody slow. Well, no shit
it's slow, it's not even being optimized!

I've set all the flags properly now, and have killed the windows
clang portion of the cmake script. Clang is a massive pain in the
ass to set up on windows with visual studio, so finally getting
MSVC to run ANESE properly is awesome.
2017-12-13 11:35:56 -08:00
Daniel Prilik
fd43f2bc13 add apu foundations 2017-12-09 20:54:14 -08:00
Daniel Prilik
145a46914a add clang build to windows
At this point in development, MSVC is not generating optimized
code for ANESE, and struggles to hit 60 fups.

Clang makes beautifully performant builds though :D
2017-12-04 09:49:35 -08:00
Daniel Prilik
e1da1e65d3 work on sprite rendering
this isn't going well.

i've decided to forget accuracy for the moment, and to focus on
just getting the damn thing working with simple stuff, like the
Zelda title-screen demo, or Donkey Kong.

But fuck me man, this shit is complicated.

I'm going to bed now, and hopefully, next time I work on this,
i'll be able to get sprite rendering working properly.

hell, maybe i'll just scrap that, and instead focus on rendering
the background properly. I have a feeling that's going to be
a bit easier...

Right now, I really want to give up, and call it quits on this
project, because holy crap am I getting annoyed.
But then I remember that one day soon, everything is going to
work, and all this effort will have been worth it.

I hope that day comes soon.
2017-11-20 01:26:31 -08:00
Daniel Prilik
8b78cddbbb clean up DEBUG_PPU + start nametable debug
goddam i really hope things start working once I start implementing
the PPU loop propertly.
2017-11-04 21:55:52 -07:00
Daniel Prilik
e5ee0c606a add interupt lines (for NMI)
I wasn't planning on reworking interrupts today, but one thing led
to another, and... yeah.

All I really wanted to do today was get a Palette Table debug view,
but for some reason, it isn't being populated! I had a suspicion
that maybe implementing interrupts would make something click, but
alas, interrupts are in, and no data is being written to the
palette tables :(

I'm just going to leave it be for now, and hope that as more of the
PPU comes together, it will just start working.
2017-11-04 17:52:54 -07:00
Daniel Prilik
7d722d9132 fix g++ and MSVC warnings + do some cppcheck linting 2017-10-31 17:03:23 -07:00
Daniel Prilik
98fe81f7ef add cmake option for NESTEST builds 2017-10-30 19:20:00 -07:00
Daniel Prilik
a4519a76db building on MSVC 2017-10-26 10:29:37 -07:00
Daniel Prilik
911d36f23f add SDL dependency 2017-10-25 21:17:58 -07:00
Daniel Prilik
0528392bf0 switch to cmake 2017-10-18 17:03:52 -07:00