phibiaNES emulator.

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
phibiaNES emulator.
by on (#128199)
I am currently working on a NES emulator. This is my first emulator in general. Working already some time on it.
It is in the state that it becomes a bit usefull.

Currently emulating:

* 6502 CPU
* 2A03 APU (Sampling up to 192kHz, but 96kHz downto 44.1kHz recommended, 192kHz strains apu emulation too much)
* NES PPU ( still not happy about it, performance wise )
* VRC6 extended audio (Castlevania 3 JP version, Esper Dream 2 - Aratanaru Tatakai and Mouryou Senki Madara)
* Mapper support list: 0, 1, 2, 3, 4, 5(partially), 7, 8, 21, 23, 24, 25, 26, 31, 34, 44, 52, 69, 71, 73, 85, 87
* Image enhancement filters: 2xSAI, Super 2xSAI, 2xBRZ, 3xBRZ, 4xBRZ, TV Scanline 50/75/75SR, Blargg NTSC, Doubler and Tripler.
* GPU acceleration thru Direct2D
* Loading and saving of gamestates ( still needs bug fixing, sometimes you have to load a state 5 a 6 times due PPU issues, needs looking into )
* Rewind emulation in steps of 5 seconds. Able to go back up to 100 seconds.
* Write APU logs
* Write APU Wave
* Loads really fast. ( got that goin' )
* Play considerable amount of NSFs
* AVI recording / on the fly encoding.
* Game Controllers (Gamepads, WIImote, etc)
* 1:1 / 8:7 aspect ratio.
* Very little PAL nes support. It does something but don't expect it to work perfectly.
* Phosphor lag emulation.
* 60 -> 30 fps pulldown for AVI recording also 30 fps (frameblend) option is available!

New release of phibiaNES beta #9 (unstable release)

added/changed:

* VRC7 audio
* ROM browser ( functional, but unstable )
* Open File now combines NSFs and ROMs (therefore removing the Open NSF option)
* Recent ROMs also show recent NSFs.
* Lots of emulation improvements.
* Fixed mapper #31 (CHR_ROM emulation)


Current issues:

* Very little PAL support.
* No Lightgun support. (can't figure that one out)
* Pausing emulation doesn't pause audio (sorry for that, repeating samplebuffer issue, should be easily fixed, but very low priority) <-- still not fixed @ 10-02-2015 (02-10-2015 american)

Included in the file:

* The emulator itself
* The "dropped" project.. The emulator for developers ( no waaaaay done yet... should not use it )
* My "NSF" player firmware routine for my emulator. (Folder resources)
* My "NSF" player source code for my emulator (Folder "Resources - Source")

Any ideas about it will be greatly appreciated. This is project for me too learn the innards of computing in general. I have to say.. It sounds easy to emulate/simulate a NES but it actually far from it. But very educational :D

To see a very old version in action:
https://www.youtube.com/watch?v=4Oi5FHf0V8M

Me playing / recording Crisis Force on my emulator:
https://www.youtube.com/watch?v=eZ83eJ-fvY8

>>> Latest beta download BETA 9b22 (unstable) <<<
Attachment:
pNES-beta9b2.7z [925.57 KiB]
Downloaded 355 times


>>> beta download BETA 9 (unstable) <<<
Attachment:
phibiaNES-beta9_unstable.7z [912.79 KiB]
Downloaded 408 times


>>> Latest stable beta download BETA 8b1 below <<<
Attachment:
pNES-beta8b1.7z [931.73 KiB]
Downloaded 451 times
Re: phibiaNES (pNES) emulator.
by on (#128207)
Be careful with your emulator name, it's already been used; doesn't matter if it's an abandoned project or not, when I saw the name I was like "there's already an emulator by that name, I remember it" -- http://www.3e8.org/pnes.html | http://freecode.com/projects/pnes

Stick with just calling it phibiaNES in full. :-)

P.S. -- Congratulations for being one of the (few) people who implemented Vsync (i.e. no tearing) correctly while in windowed mode on XP. It deserves mention because it's remarkable how many people screw this up. Edit: Oh, I take that back, it does have tearing but in a very bizarre way and very gradual, but it's still tolerable. You might be limited by SDL in this regard, so no hard feelings.
Re: phibiaNES (pNES) emulator.
by on (#128209)
That and use as an abbreviation for PocketNES, not to mention what a ROM or cartridge collection allegedly compensates for. During the GBA era, I made this title screen for PocketNES:
Image
Not my photo.
Re: phibiaNES (pNES) emulator.
by on (#128210)
Don't worry Tepples, pNES and A/NES will soon combine forces. ;-) Just had to say something like this because of the text on the pnes home page: I just wanted to finally expose pNES to the public (yeah sure, that wasn't intentionally phrased at all, nosiree...)
Re: phibiaNES (pNES) emulator.
by on (#128215)
Well, my vpnes emulator sounds even more hilarious. I don't have any intentions to change the emulator's name though.
Re: phibiaNES (pNES) emulator.
by on (#128221)
About the tearing and stuff.. I do use SDL for audio, but not for display. for Display I use GDI ( worst case scenario ) or direct2d (Not D3D, OGL)
maybe I would implement these later on. but for now.. I stick with D2D graphics as GPU acceleration option.

This means that accelerated options (and therefore proper vSYNC) is only supported with Windows 7 or higher. sorry bout that :)

With windows XP it probably will fallback to GDI with framerate syncronisation at precise 60fps. if your display does 59.9995 hz or something like that. You might see weird tearing (not your normal one though)

You can see the currently used render mode below the application screen:
Attachment:
pnesdown.png
pnesdown.png [ 2.19 KiB | Viewed 13094 times ]


For it to do its full glory it needs to be "Direct2D GPU mode"

Make sure that disable gpu acceleration is not enabled:
Attachment:
pnesopt.png
pnesopt.png [ 12.66 KiB | Viewed 13093 times ]
Re: phibiaNES (pNES) emulator.
by on (#128234)
What other kind of pnes options are there?

:beer:

Maybe a piercing? Circumcision? A ring? Bifurcation? Erectile assistance implant? :lol:
Re: phibiaNES (pNES) emulator.
by on (#128241)
..... ok that's it.

OK guys. you had your fun :D
I will rename every p in front of NES to phibia.... Seems better that way... :?

Don't be too serious, ok?
Re: phibiaNES emulator.
by on (#128242)
Thanks. Now there is no ambiguity. This should work.

So is there anything you need help with?

by on (#128256)
Congratulations on getting this far and, I'm sure, learning a lot along the way! Also congratulations at getting vsync working in a window, I still can't really manage that myself.
If you want some constructive criticism, I ran through my usual list of test games and here's what I saw.

First of all, here's a list of games I tried that didn't work at all.

Black screen:

Bad Dudes
Bee 52
Bill and Ted's Excellent Adventure
Bucky O'Hare
Burai Fighter (makes some sick sounding noises, probably executing data)
Big Nose Freaks Out (which doesn't work in my emulator currently either so that's no big deal)
GI Joe
Gremlins 2
Kickle Cubicle
Robocop 3
Zombie Nation

Other issues:
Driar freezes at title screen
Kick Master has graphical glitches then freezes in Level 1
Break Time gets stuck on the title screen in an infinite loop
You've made a mistake with MMC3 CHR banks which you will see when you get Kickle Cubicle working
Unforgivably, the default A and B button settings are backwards :)

Sound issues:
DPCM bass samples in Sunsoft games are out of tune
Very obvious aliasing artifacts (especially audible in Solstice), need to use a resampler
Triangle channel makes popping noises when enabled and disabled
APU hardware envelope seems to be missing on the noise channel and the noise channel is just too loud in general

That's probably enough to keep you busy poking around for a while.
Re: phibiaNES emulator.
by on (#128508)
Thanks,

I have really looked into the audio of the NES.. Playing a lot of NES captured videos for sound. I have the DPCM samples in tune now (Rounding errors). But now I have small popping noises through my audio output. Therefore I will completely revise the APU code. Right now I use approximation logic. So that I don't have to fully compute the APU on a clock-to-clock base. But it seems this won't do as the aliasing/popping and out-of-tune.. Especially in low sample rates (lower sample rate means more approximation logic) @ 96000Hz it becomes alot better.

Still revising as it is.

Still trying to get Kickle Cubicle to run. Still don't know why this game hangs. Been debugging it for hours.. :( ( tracing execution step-to-step, It just goes from subroutine to subroutine to subroutine, pffff )

To return a favor:
It seems your emulator has timing issues with Ducktales I (sprite #0 shows too much, and the glitch above the statusbar when walking around isn't visible. It shows on a real NES though) and especially with Shalom.. Artifacts due to timing errors in the track.

And about the B, A default button mappings. That is just the way I prefer it.. I am used having the 'B' button next to my d-pad. As it is mirrored on my keyboard. I default configured it to still be next to the "d-pad" :)
Re: phibiaNES emulator.
by on (#128791)
Bill & Ted (and a lot of other MMC1 games) won't run unless you limit 6502 -> MMC1 writes to 1 per opcode.

Edit: Go here for windowed vsync with Direct3D.

viewtopic.php?f=3&t=9262&start=47
Re: phibiaNES emulator.
by on (#128793)
I keep with my direct2d code. With GDI fallback for vista and lower. Since I target only newer windows versions. Maybe when the emulator becomes really compatible and all the kinks are being worked out. i might implement Direct3D / OpenGL renderers.

Got Kickle to run. Yay that is something. Had IRQ emulation issues. Fixed that though. Most of the problem games are.... Still problematic, but Kickle runs. And I did not see any glitches or some kind. It ran without hiccups. Therefore I don't see what mistake I made with the mmc3 characterbanking.
Re: phibiaNES emulator.
by on (#128824)
You might have fixed it already, but the issue is that the mmc3 ignores the last bit of the CHR bank select registers when they're used for 2k banking. I've only seen this cause problems in Kickle Cubicle and the Capcom OST compilation ROM.
Re: phibiaNES emulator.
by on (#128826)
Have you seen it cause problems in the MMC3 version of Holy Diver Batman mapper test?
Re: phibiaNES emulator.
by on (#128839)
OMG.

This is about the following problem:
* Timing problems, don't know why as I debug it the PPU cycles is exacly 3x CPU cycles at any given time, maybe the way I emulate the CPU. Dunno yet.

Seems there weren't timing issues. (tested this with Battletoads, which always failed). Seems I haven't read the PPU wiki article right. This is about the screen_mask and sprite_mask behaivor. It seems it only masks the left 8 pixels of a scanline. not the first 8 and last 8 pixels. That was what I have implemented. That is also the reason why Battletoads didn't register the Sprite #0 hit :O

Implemented that it only masks the first 8 pixels and not the last 8 pixels. What do you know.. Battletoads just runs without issues.. Even in level 2.. * smacks face into wall *

Also fixed some serious MMC1 mapper faults. Busy implementing dummy reads for all instructions. And also may implement some unofficial opcodes. Probably will fix Driar and Streemers. Since these seem to crash due to unsupported unofficial opcodes.
Re: phibiaNES emulator.
by on (#128940)
Checked MMC3 irq code again. Seemed some all games required the irq not to be auto reloaded. Megaman 3 for example. But definitely saw this on turtles 3. The whole introduction was halfly rendered. Because the IRQ triggered too much? Fixed it and also the small glitches in SMB 3 were gone. Meaning it completely improved game compatibility. Turtles 3 renders nicely. Only no health or score visible..

Also implemented Rom address mirroring as most roms crashed because of selecting too high page numbers and thus executing garbage. Which breaks the game. Mirroring this seems to fix this. Actually a whole lot of no go games are going. This fixed a significant amount of games..

Happy coder :)
Re: phibiaNES emulator.
by on (#129041)
Anyone interested to try the 2nd public beta?

Attachment:
File comment: Public Beta #2
pnes-beta2.7z [707.04 KiB]
Downloaded 262 times
Re: phibiaNES emulator.
by on (#129063)
Two things:

The MMC3 scanline counter should be running unless both sprites and background are disabled. (If only one is disabled, the PPU still does both background and sprite fetches.) This would fix the intro for GI Joe and Burai Fighter.

Fester's Quest is using the wrong mirroring in game, and is a little less playable than it normally is.
Re: phibiaNES emulator.
by on (#129070)
Bill & Ted's Excellent Video Game Adventure doesn't work (but that game is using some pretty dirty stuff to even run in the first place).
Also, when I load a file that's read only, It won't open it.
Re: phibiaNES emulator.
by on (#129078)
Problems I've found (using beta 2):

* Audio/video gets out of sync quite easily; 1-2 full second delays were common when I was playing Contra. Adjusting frequency playback (under Options / Nes APU) did not improve/worsen the situation.

* Keyboard input (the default) seems... delayed in some way. It's very hard to explain what I mean by this, because the delay is slight. I will state that if I set up my controller for input I'd be able to determine if this was me being nitpicky or actually an issue. So you might ignore me on this one for the time being.

* On more than one occasion when doing File / Exit the emulator would continue to run (100% of a CPU core), but never exit -- furthermore, it would not respond to getting focus by clicking the mouse, alt-tab, etc. -- I had to End Task the process in Task Manager. To me this indicates your main WM_* handler is probably being done wrong (some logic bug/etc. somehow keeping the WM_* messages from being processed correctly). I will point out that under normal circumstances File / Exit takes a lot longer than it should (IMO) -- almost 1-2 full seconds before it quits. No idea what it's doing.

* Lots of audio emulation bugs (doesn't require a good ear), but I know you'll get to these eventually. I find audio to be a universally difficult thing to understand (I've never done any audio on the NES or SNES, FYI) so don't take my comment all that harshly. :-)

Recommendations:

* On systems lacking Direct2D, you should probably grey out the "Disable GPU Acceleration" checkbox under Options / Nes PPU since it wouldn't have any effect.

* Under Options, change the tab names from "Nes PPU" and "Nes APU" to "Graphics" and "Audio". The settings shown there do not really have to do with the PPU or the APU, they have more to do with the actual emulator internals/behaviour.

* Under File, you should reverse the order of "Save State" and "Load State"; Load should come first.

* Under File, put a section divider between "Open NSF" and (if you make the above improvement) "Load State", as well as one between "Save State" and "APU".

* Under File, I'd rename "APU" to "Audio" -- again, has nothing to do with the APU, has to do with logging audio to a WAV file...

* The word is "phosphor", not "fosfor" (assuming we're expecting English universally through all the menus), although I know in Dutch (thus probably Afrikaans) it's spelled "fosfor". (Yeah, I've tinkered in Afrikaans... eish!)

* If you plan on saving settings, please for the love of god use an .ini file or .xml file or your own .cfg format or something (though I really recommend text); don't go with the native Windows registry please. People REALLY like being able to have emulators operate as "standalone apps" so that they can run off a USB stick and be moved around. I believe there are some Win32 calls (if you're doing native Win32) that actually use registry-like API calls but instead of the data being written to the registry it's written to an .xml file.
Re: phibiaNES emulator.
by on (#129081)
koitsu wrote:
Problems I've found (using beta 2):

* Audio/video gets out of sync quite easily; 1-2 full second delays were common when I was playing Contra. Adjusting frequency playback (under Options / Nes APU) did not improve/worsen the situation.



I already plan to totally revise the APU emulation code. Since it has problems which seems to be specific in my approach.

Quote:

* Keyboard input (the default) seems... delayed in some way. It's very hard to explain what I mean by this, because the delay is slight. I will state that if I set up my controller for input I'd be able to determine if this was me being nitpicky or actually an issue. So you might ignore me on this one for the time being.



Interesting. It doesn't seem to lag on my computer.

Quote:

* On more than one occasion when doing File / Exit the emulator would continue to run (100% of a CPU core), but never exit -- furthermore, it would not respond to getting focus by clicking the mouse, alt-tab, etc. -- I had to End Task the process in Task Manager. To me this indicates your main WM_* handler is probably being done wrong (some logic bug/etc. somehow keeping the WM_* messages from being processed correctly). I will point out that under normal circumstances File / Exit takes a lot longer than it should (IMO) -- almost 1-2 full seconds before it quits. No idea what it's doing.



Shutting down the emulator will shut down the seperate thread for emulation. Most of the time it does what it needs to do.. but sometimes it refuses to stop. Still figuring out why..

Quote:

* Lots of audio emulation bugs (doesn't require a good ear), but I know you'll get to these eventually. I find audio to be a universally difficult thing to understand (I've never done any audio on the NES or SNES, FYI) so don't take my comment all that harshly. :-)



I use approximation logic in audio to speed-up emulation. didn't go the way I planned. Set @ 88200 or 96000Hz makes the reproduction alot better. That is why I am planning to totally revise the APU part. It also can't get the DMC Interrupts right.

Quote:
Recommendations:

* On systems lacking Direct2D, you should probably grey out the "Disable GPU Acceleration" checkbox under Options / Nes PPU since it wouldn't have any effect.

* Under Options, change the tab names from "Nes PPU" and "Nes APU" to "Graphics" and "Audio". The settings shown there do not really have to do with the PPU or the APU, they have more to do with the actual emulator internals/behaviour.

* Under File, you should reverse the order of "Save State" and "Load State"; Load should come first.

* Under File, put a section divider between "Open NSF" and (if you make the above improvement) "Load State", as well as one between "Save State" and "APU".

* Under File, I'd rename "APU" to "Audio" -- again, has nothing to do with the APU, has to do with logging audio to a WAV file...

* The word is "phosphor", not "fosfor" (assuming we're expecting English universally through all the menus), although I know in Dutch (thus probably Afrikaans) it's spelled "fosfor". (Yeah, I've tinkered in Afrikaans... eish!)

* If you plan on saving settings, please for the love of god use an .ini file or .xml file or your own .cfg format or something (though I really recommend text); don't go with the native Windows registry please. People REALLY like being able to have emulators operate as "standalone apps" so that they can run off a USB stick and be moved around. I believe there are some Win32 calls (if you're doing native Win32) that actually use registry-like API calls but instead of the data being written to the registry it's written to an .xml file.


About the last part. It actually stores .INI files. But I found a bug when you nicely do File -> Exit. It won't save the settings, but clicking on the 'X' does. something that is easily fixed.

Example INI file wrote:
[Controller1]
button_a=90
button_b=88
button_select=65
button_start=83
button_up=38
button_down=40
button_left=37
button_right=39
[Controller2]
button_a=87
button_b=81
button_select=0
button_start=0
button_up=104
button_down=98
button_left=100
button_right=102
[APU]
SampleRate=88200
StereoOutput=1
StereoIntermix=0,46
[PPU]
2XSAI=0
2XSAIMODE=1
DisableGPU=0
FosforDriveStrength=32
GPULinearFiltering=0


Grapeshot wrote:
Two things:

The MMC3 scanline counter should be running unless both sprites and background are disabled. (If only one is disabled, the PPU still does both background and sprite fetches.) This would fix the intro for GI Joe and Burai Fighter.

Fester's Quest is using the wrong mirroring in game, and is a little less playable than it normally is.


Interesting, as it only triggers when both rendering modes are enabled. just changing a logic AND to a logic OR might fix these issues? Gonna try this when I am at home.
Re: phibiaNES emulator.
by on (#129090)
Changing the line

if (dot = a12_toggle) and (enable_bg and enable_spr) then

to

if (dot = a12_toggle) and (enable_bg or enable_spr) then

fixed the issues with:

* Burai fighter
* Kick Master
* G.I. Joe

Thanks!

----

Checked MMC1 mirroring code:- it seems that never implemented 1-screen mirroring @ 2000,2800 for the MMC1 mapper. Probably was TODO since I wrote the MMC1 mapper code my PPU emulation couldn't do one-screen mirroring yet.. But that has long changed.. Implemented the 1-screen mirroring.. and Fester's Quest runs as it should. The same with Tetris (USA) (which gave a black game screen)

Still figuring out why Metroid goes almost fully blank when getting the "ball" thingy on the left @ start of the game.

----

some NEWS!

This is beta #3.

Revamped end-point renderer ( PPU buffer -> Display ) whole output is threaded. When compositing the image the emulated cpu and ppu keep running (not stalled so often anymore)
xBRZ filtering up to 4x - this is very CPU intensive. my trusty old Q9400 has trouble keeping up. Especially with games which alot of patterns. This is can be multithreaded.. Look in the System options. Recommended settings are 2 threads or 4 threads, 3 threads is still buggy. So triple-core users either set 2 or 4 threads.

Attachment:
File comment: Screenshot SMB3 with 4xBRZ
phibiaNES-4xBRZ.png
phibiaNES-4xBRZ.png [ 70.49 KiB | Viewed 7816 times ]


Download here:
Attachment:
File comment: PhibiaNES - Public Beta #3
pnes-beta3.7z [748.22 KiB]
Downloaded 274 times
Re: phibiaNES emulator.
by on (#129215)
Want to see the next video of CV 3 on my emulator utilizing the 2xsai and 2xBRZ filter. The latter seems way more crisp. At the expense of my CPU.. My CPU wasn't able to sustain 60fps in single-thread mode. Later on I enabled the dual-thread option for the display rendering. After that my CPU was able to sustain 60fps. So you need a hefty CPU for that. Some games require alot more CPU horsepower on ?xBRZ than others. For example: Quad-thread mode xBRZ with the game Crisis Force still chokes my CPU to death :o

Here you can watch it:
https://www.youtube.com/watch?v=Xzu_GImyW_M&feature=youtu.be

For ppl seeing small details: yes I also implemented custom palettes for the emulator.
Re: phibiaNES emulator.
by on (#129473)
Beta #4 is out now :)

Attachment:
File comment: phibiaNES beta #4 - Lots of filters, including Blargg NTSC filter and some scanline filters. Click high spec button to set a preset that will enable the filters.
pnes-beta4.7z [785.11 KiB]
Downloaded 260 times


Added mapper for Salamander

Added the following blitters:

* NTSC Filter ( way too slow and buggy )
* Scanlines 50%
* Scanlines 75%
* Scanlines 75% + Signalling Reflection
* Blargg NTSC Filter (+configurable)

Attachment:
File comment: screenshot SMB 3
phibiaNES-blargg-ntsc-3x.png
phibiaNES-blargg-ntsc-3x.png [ 266.37 KiB | Viewed 7716 times ]

screenshot is not final image; the flickering effect is not visible.. to fully support this you need to have Direct2D with a 60hz display refresh.

Attachment:
File comment: screenshot SMB 3 using SL75%SR
phibiaNES-scanl75sr-3x.png
phibiaNES-scanl75sr-3x.png [ 150.14 KiB | Viewed 7716 times ]

also utilizes some kind of flickering effect.
Re: phibiaNES emulator.
by on (#130411)
Currently I am rewriting the APU emulation part of my NES emulator. Total rewrite that is. As I could not get it right, having audio quality issues with it.

What I already have reimplemented is:

* Pulse Channels 1 and 2
* Triangle Channel.

ToDo:

* Noise Channel
* Dreaded DPCM channel. ( this bugged the previous APU implementation horribly )
* VRC6 Pulse 1 and 2
* VRC6 Sawtooth

The audio is already a lot cleaner than the previous implementation when comparing the first 3 channels! :)
Still some small issues are pertaining. as always -_-

I will update the post with before and after sample files.
Re: phibiaNES emulator.
by on (#137707)
A new release phibiaNES beta 5
------------------------------------

Tremendous amount of bugfixes, compatibiliy issue fixes. Audio emulation improved, still has issues ( I sure suck at audio programming that is for sure ) For best audio quality set the samplingrate @ 88200Hz with stereo disabled and a 2 kB play buffer/16kB render buffer. ( plays most clean without disturbing audio lag )

With the audio part. I already ditched the new-emulation core and continued to work on my old trusty APU code. Merging the new ideas into it and bugfix the hell of out. VRC6 games sound good @ 88k2/mono/2kB/16kB.

Pixel doubler (2x, 3x) implemented for people who loves the blockiness with 8:7/Linear filtering. It looks good. Advanced filters require the multithread display option to be enabled under (System). Only advanced filters that doesn't need this is the xBRZ filters, but it is very required to do so because the performance will suck tremedously when this isn't the case.

Ctrl+Backspace rewinds the emulation 5 seconds. On some games this still bugs around. (probably look at my state saving technique, probably some very important variable isn't dumped)
you can also drag & drop NES files onto the phibiaNES window to open them.

VRC7 implemented, it can also emulate Lagrange Point, BUT! I haven't implemented the VRC7 audiochip yet. Reading how this thing works scares me and uses alot of audio/music jibberisch I still do not 100% understand.

Implemented some other mappers too.
Implemented 4-screen support (4kB CIRAM) - Games such as Gauntlet and Rad Racer II run without issues now.

You can get it here:
Attachment:
pnes-beta5.zip [1.5 MiB]
Downloaded 261 times


Audio sample from Castlevania 3 Japanese Edition (VRC6, Riddle)
Attachment:
Aku-Riddle.mp3 [1.97 MiB]
Downloaded 320 times
Re: phibiaNES emulator.
by on (#137914)
a new feature is about to be finished.

I am implementing AVI video recording capabilities in my emulator using VfW (DirectShow is a bit unclear with sending data to an inputpin of a compressor. Or it is required to write a videosource filter and use interproces communication)

Perhaps tomorrow it is ready for Beta #6. Here is a screenshot of the settings.
Attachment:
generaloptions-system.png
generaloptions-system.png [ 9.48 KiB | Viewed 7431 times ]


You can select the required compressor. video framerate (30 or 60 fps).
Audio will always be downsampled to 44.1/48kHz (or the filesize will grow to big)

Nice to know:
phibiaNES doesn't capture the preprocess video, but it captures the post-process video. This means you can also record the NTSC video filter, ?xBRZ filters, SuperxSAI filters, TV-scanline filters, etc.

If filesize or CPU utilization gets out of hand while recording videos you can always select 30 fps instead of 60fps.

Press CTRL+A to start capturing and CTRL+S to stop capturing. But that is for later.. probably will upload the new beta (6) in around 16 hours or so.

If you got ideas? They're welcome and I always will see if I can implement those ideas.
Re: phibiaNES emulator.
by on (#137916)
A naive 30 fps recording will mess up with a lot of the 30 Hz flicker seen especially in early NES games, such as after Mario gets hurt. Could you add a way to blend pairs of frames for 30 Hz recording?

Or if there is a copy of ffmpeg or avconv on a system, you could pipe video output through those.
Re: phibiaNES emulator.
by on (#137941)
tepples wrote:
A naive 30 fps recording will mess up with a lot of the 30 Hz flicker seen especially in early NES games, such as after Mario gets hurt. Could you add a way to blend pairs of frames for 30 Hz recording?

Or if there is a copy of ffmpeg or avconv on a system, you could pipe video output through those.


If you install ffdshow (which is a directshow/vfw filter for ffmpeg's libavcodec) you can record using this codec. Settings can be configured using the FFDShow VfW configuration utility.

I will implement a frameblender for 30fps video. That is actually the reason that I have not published Beta#6 yet. I want to get that in before I release it to the public.
Re: phibiaNES emulator.
by on (#137951)
as promised I will release the version which supports recording today:
Attachment:
pnes-beta6.7z [665.12 KiB]
Downloaded 266 times


Video showcasing the frameblending option for 30fps. (Super mario bros)
https://www.youtube.com/watch?v=99MZ12g ... e=youtu.be

3xBRZ recording Akumajou Densetsu
https://www.youtube.com/watch?v=a_xQooX6Sbo

Super Mario Bros 3 -- Early work of the AVI streaming feature
https://www.youtube.com/watch?v=RP5locELbH8

Try it. Something not ok? tell me.

-------

Fixes after this release:

* Found a massive bug in the Audio Engine. whoa. yeah. It seems I set a wrong variable with the Noise channel, Noise sounds more true.
* Multiple small fixes in the Pulse/Square generators. Better frequency (0x7FF) cut off handling. Finally the Code Masters logo doesn't fuck up with Pulse#2

Updates after this release:
* CPU 6502 core mapper updated.. The memory mapping code was horrible, but now I have completely rewritten it and ofcourse updated all mapper code to accomodate. Right now the entire memory map is divided in 4kB mapping chucks. This enable me to implement mappers with 4kB granularity.

ToDo:
* Mapper status not being written to the savestate.. probably causes the fuckups when rewinding, restoring from snapshot. and also why Mario 1 never has problems. :P
* Update mapper savestate to 4kB programrom granularity instead of 8kB.

Bugs found:
* See fixes and....
* Record to AVI breaks when stereo sound is selected, gotta see why it does this.
Re: phibiaNES emulator.
by on (#139252)
Upcoming beta will feature:

* Primilary MMC5 support, as only Castlevania 3 runs, maybe other games do work. but not sure.. ExRAM not implemented at all. Switchable programram is implemented but not tested. Because it is in its infancy state, save states are not reliable with MMC5 games as of yet.
* Implementation of DirectPlay controllers started. Right now it is wonky as setting up may crash phibiaNES when closing and even so.. phibiaNES requires a restart when you have configured the controller. But when you start and do not edit the settings it runs stable. Actually I have tested it with a Wiimote connected to my computer using bluetooth.. Works good I might say.
* AVI Audio/Video postresync code. It's fast (<.1 sec) and takes care that all recordings are in perfect sync.
* PPU can emulate 12kB of Patterndata (Required for MMC5 emulation)
* A lot of of code cleanup, reallocation. Trying to get emulation specific code out of my GUI code. (hacks I know, but I can say this is already fearly cleanup as of now)


Bug fixes:
* DMC port 0x4011 playback doesn't work.. But now it is! in the upcoming beta 7

Because I am moving out code of the main GUI thread I will drop the PNESDevel utility as it is now and start programming the Developer IDE. This is a really huge project, because I don't have much free time this means it will complete very slowly.

Features planned:

* Build-in assembler.
* Build-in emulation, but choice to run the compiled .NES file in a different emulator.
* in IDE help information such as Amount of cycles, etc.
* Libraries.
* Macro's.
* Debugger / Breakpoints / Watches.
* Board (MMC1/3/5/VRCx/ETC) debuggers.
* Graphics editor.
* Tilemap editor.
* Resource management (including but not limited to compressed tilemaps)
* My own small library set. (Basic control PPU/APU/Controllers with decompression schemes)

If anyone wants to see a feature planned? Don't hesitate to reply.
Re: phibiaNES emulator.
by on (#139397)
Beta #7 can be found here. Fixes and stuff. see previous post.
Attachment:
pnes-beta7.7z [936.53 KiB]
Downloaded 248 times
Re: phibiaNES emulator.
by on (#140327)
Currently implemented all unofficial opcodes:-

result:
Attachment:
phibianes-unofficial-opcodes-test.png
phibianes-unofficial-opcodes-test.png [ 55.52 KiB | Viewed 8212 times ]


Games such as Streemerz, Driar are running now!
Re: phibiaNES emulator.
by on (#140896)
pNES beta #8!
-----------------

Fixes/Added:

* NSF player plays much more NSF's as any load address is supported now and bankswitching also.
* PPU more accurate.. emulates PALlette pointer and Emphasis bits. (NTSC still needs to be updated for emphasis)
* All instructions supported, including unofficial ones too.
* Considerable amount of bugfixes and GUI cleanup.
* Press ~ to speed up emulation, releasing it will resume normal speed. (60 -> 120fs, on GDI >120fps)
* Included updated XBRZ (which is faster), but requires VC Redist v12 (there it is included as archive, old xbrz.dll still default)
* PNESDEVEL.EXE build updated with new features ( it is actually becoming obsolete, as I am not updating it anymore but it shares the emulation core )

get it here:
Attachment:
pnes-beta8.7z [1.13 MiB]
Downloaded 263 times


If you are wondering.. most of the code is written in Delphi.
Re: phibiaNES emulator.
by on (#140942)
Sorry,

it seems there are 2 massive bugs slipped into beta #8 release.

namely:

* blackscreen when using the default-system palette (only on the blargg ntsc filter you get an image) - Workaround(s): use blargg ntsc filter or apply a custom palette.
* nsf files sized 20,24,28,36,40,44,52,56,60, etc loads incorrectly.. phibiaNES works with internal 16kB addressing blocks. Due of some loading issues. 20kB NSF's won't get 2x 16kB allocated but 1x 16kB.. losing 4kB of program rom of the NSF. which makes it really not usable. I have already fixed this. It seems NSF are also very reliant on the memory space of $6000-$7000. where the nsf player resides. Now when phibiaNES loads an NSF the player code is loaded into the $800-$1FFF area (6kB). Normally this RAM is mirrored but it is enabled when an NSF is loaded.

Still need to fix the palette bug. Will be releasing beta #8.1 shortly.
Re: phibiaNES emulator.
by on (#140958)
Beta with the bugfixes (beta 8b1)

Also added the sourcecode of the NSF player. So if someone likes to tinker with it.. be my guest.

Attachment:
pNES-beta8b1.7z [931.73 KiB]
Downloaded 277 times


Bugfixes are:

* Page boundary bug NSF loader fixed.
* Palette bug fix (when no custom palette is loaded the emphasis palettes are not generated!)

-----
Structure of custom NSF player:

When writing a NSF player "firmware" for phibiaNES you should generate code @ base $800. This
is where the firmware will be loaded in RAM. Note!: you shouldn't include an .NES header as it isn't
a NES rom. It is just a binary blob.

When phibiaNES loads the binary it will look for reset, nmi, irq, song, copyright, author, numtracks, firstinit, selectinit and playroutine(s) in $800-$812 to be exact:

0x800 - reset vector address
0x802 - NMI vector address
0x804 - IRQ vector address
0x806 - Pointer for phibiaNES to write the song name to (patching), phibiaNES only writes the first 14 bytes of the 32-byte song name!
0x808 - Pointer for phibiaNES to write the copyright to (patching), 14 bytes only.
0x80A - Pointer for phibiaNES to write the author name to (patching), 14 bytes only.
0x80C - Pointer for phibiaNES to write the amount of songs to. (byte)
0x80E - Pointer for phibiaNES to write the NSF_INIT pointer to (first start)
0x810 - Pointer for phibiaNES to write the NSF_INIT pointer to (song select)
0x812 - Pointer for phibiaNES to write the NSF_PLAY pointer to (for use in NMI vector / IRQ)

--- after that.. 0x814 -> $1FFFF is your playground.

See included source of the "factory default" NSF player in the "Resources - Source" folder included.
Re: phibiaNES emulator.
by on (#156121)
New release of phibiaNES beta #9 (unstable release)

added

* VRC7 audio
* ROM browser ( functional, but unstable )
* Open File now combines NSFs and ROMs (therefore removing the Open NSF option)
* Recent ROMs also show recent NSFs.
* Lots of emulation improvements.
* Fixed mapper #31 (CHR_ROM emulation)

After this release the updates will come more slowly as I am going put all my effort to phibiaNES Next. Making hopefully all the right choices.
Re: phibiaNES emulator.
by on (#235772)
Currently I have implemented a new filter. It is called 2x upscaling with sprite shadows.

Whaddya' think?
Re: phibiaNES (pNES) emulator.
by on (#235802)
koitsu wrote:
Don't worry Tepples, pNES and A/NES will soon combine forces. ;-) Just had to say something like this because of the text on the pnes home page: I just wanted to finally expose pNES to the public (yeah sure, that wasn't intentionally phrased at all, nosiree...)

Does A/NES have a pNES plugin?
Re: phibiaNES emulator.
by on (#235812)
nIghtorius wrote:
Currently I have implemented a new filter. It is called 2x upscaling with sprite shadows.

Whaddya' think?

I think it might add some depth to some games, but in most cases it won't make sense. In your example, Mario definitely shouldn't be casting shadows on the sky or on the faces of the blocks that are facing us... Maybe this evokes a certain "Paper Mario" aesthetic that some will think is pleasing, but it certainly doesn't look right in-universe.