Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mednafen+atari800+poke #566

Merged
merged 123 commits into from
Dec 17, 2017
Merged

Conversation

JoeMatt
Copy link
Member

@JoeMatt JoeMatt commented Apr 14, 2017

This PR combines #561 #563 and #564 in addition to some bug fixes, and warning fixes.

JoeMatt and others added 30 commits August 22, 2016 03:04
# Conflicts:
#	PVGB/PVGB.xcodeproj/xcshareddata/xcschemes/PVGB.xcscheme
#	PVGB/PVGB.xcodeproj/xcshareddata/xcschemes/PVGBTV.xcscheme
#	PVGBA/PVGBA.xcodeproj/xcshareddata/xcschemes/PVGBA.xcscheme
#	PVGBA/PVGBA.xcodeproj/xcshareddata/xcschemes/PVGBATV.xcscheme
#	PVGenesis/PVGenesis.xcodeproj/xcshareddata/xcschemes/PVGenesis.xcscheme
#	PVGenesis/PVGenesis.xcodeproj/xcshareddata/xcschemes/PVGenesisTV.xcscheme
#	PVNES/PVNES.xcodeproj/xcshareddata/xcschemes/PVNES.xcscheme
#	PVNES/PVNES.xcodeproj/xcshareddata/xcschemes/PVNESTV.xcscheme
#	PVSNES/PVSNES.xcodeproj/xcshareddata/xcschemes/PVSNES.xcscheme
#	PVSNES/PVSNES.xcodeproj/xcshareddata/xcschemes/PVSNESTV.xcscheme
#	PVSupport/PVSupport.xcodeproj/project.pbxproj
#	PVSupport/PVSupport.xcodeproj/xcshareddata/xcschemes/PVSupport.xcscheme
#	PVSupport/PVSupport.xcodeproj/xcshareddata/xcschemes/PVSupportTV.xcscheme
#	Provenance.xcodeproj/xcshareddata/xcschemes/Provenance-Release.xcscheme
#	Provenance.xcodeproj/xcshareddata/xcschemes/Provenance.xcscheme
#	Provenance.xcodeproj/xcshareddata/xcschemes/ProvenanceTV-Release.xcscheme
#	Provenance.xcodeproj/xcshareddata/xcschemes/ProvenanceTV.xcscheme
#	Provenance/Provenance-Info.plist
#	ProvenanceTV/Info.plist
# Conflicts:
#	PVGB/PVGB.xcodeproj/xcshareddata/xcschemes/PVGB.xcscheme
#	PVGB/PVGB.xcodeproj/xcshareddata/xcschemes/PVGBTV.xcscheme
#	PVGBA/PVGBA.xcodeproj/xcshareddata/xcschemes/PVGBA.xcscheme
#	PVGBA/PVGBA.xcodeproj/xcshareddata/xcschemes/PVGBATV.xcscheme
#	PVGenesis/PVGenesis.xcodeproj/xcshareddata/xcschemes/PVGenesis.xcscheme
#	PVGenesis/PVGenesis.xcodeproj/xcshareddata/xcschemes/PVGenesisTV.xcscheme
#	PVNES/PVNES.xcodeproj/xcshareddata/xcschemes/PVNES.xcscheme
#	PVNES/PVNES.xcodeproj/xcshareddata/xcschemes/PVNESTV.xcscheme
#	PVSNES/PVSNES.xcodeproj/xcshareddata/xcschemes/PVSNES.xcscheme
#	PVSNES/PVSNES.xcodeproj/xcshareddata/xcschemes/PVSNESTV.xcscheme
#	PVSupport/PVSupport.xcodeproj/project.pbxproj
#	PVSupport/PVSupport.xcodeproj/xcshareddata/xcschemes/PVSupport tvOS.xcscheme
#	PVSupport/PVSupport.xcodeproj/xcshareddata/xcschemes/PVSupport.xcscheme
#	PVSupport/PVSupport/PVSupport.h
#	Provenance.xcodeproj/xcshareddata/xcschemes/ProvenanceTV-Release.xcscheme
#	Provenance.xcodeproj/xcshareddata/xcschemes/ProvenanceTV.xcscheme
#	Provenance.xcworkspace/contents.xcworkspacedata
#	Provenance/Provenance-Info.plist
#	Provenance/Resources/systems.plist
#	ProvenanceTV/Info.plist
# Conflicts:
#	Provenance.xcworkspace/contents.xcworkspacedata
#	Provenance/Provenance-Info.plist
These changes will require a way for a core to specfify these overrides
# Conflicts:
#	Provenance.xcodeproj/project.pbxproj
#	Provenance/Emulator/PVEmulatorConfiguration.m
#	Provenance/Emulator/PVEmulatorConstants.h
#	Provenance/Emulator/PVEmulatorConstants.m
#	Provenance/Emulator/PVGLViewController.m
Removed CDAFReader_SF.cpp which was causing link issue for missing libsnd binary for arm. It built fine with static lib, perhaps the linker doesn’t care about missing symbols when making static libs since it’s possible they’ll be combined with other static libs which resolve the missing symbols?
Also threw in the controller methods for the NEC’s
For PSX controller, extended gamepad:
Assigned Select key assignment to trigger L2
Reassigned Start key to trigger R2
PSX: Re/Assign Start and Select
These tests fail after the first game is loaded, unloaded, and another game loaded. There are static values here that should be reset between loads since we’re destroying and making new instancse of the mednafen core. Whatever reason that’s not working right, and these tests don’t pre-init, so they fail. Screw em.
Fix for game stutter. mednafenCoreTiming flutters on init before settling and we only read it after the first frame wot set the current->gameInterval in the super class. This work around resets the value after a few frames.
…mednafen

# Conflicts:
#	Provenance.xcodeproj/project.pbxproj
# Conflicts:
#	PVGB/PVGB.xcodeproj/xcshareddata/xcschemes/PVGB.xcscheme
#	PVGB/PVGB.xcodeproj/xcshareddata/xcschemes/PVGBTV.xcscheme
#	PVGBA/PVGBA.xcodeproj/project.pbxproj
#	PVGBA/PVGBA.xcodeproj/xcshareddata/xcschemes/PVGBA.xcscheme
#	PVGBA/PVGBA.xcodeproj/xcshareddata/xcschemes/PVGBATV.xcscheme
#	PVPicoDrive/PVPicoDrive.xcodeproj/project.pbxproj
#	PVProSystem/PVProSystem.xcodeproj/project.pbxproj
#	PVSNES/PVSNES.xcodeproj/project.pbxproj
#	PVSNES/PVSNES.xcodeproj/xcshareddata/xcschemes/PVSNES.xcscheme
#	PVSNES/PVSNES.xcodeproj/xcshareddata/xcschemes/PVSNESTV.xcscheme
#	PVStella/PVStella.xcodeproj/project.pbxproj
#	PVStella/PVStella.xcodeproj/xcshareddata/xcschemes/Stella tvOS.xcscheme
#	PVStella/PVStella.xcodeproj/xcshareddata/xcschemes/Stella.xcscheme
#	PVSupport/PVSupport.xcodeproj/xcshareddata/xcschemes/PVSupport tvOS.xcscheme
#	PVSupport/PVSupport.xcodeproj/xcshareddata/xcschemes/PVSupport.xcscheme
#	Provenance.xcodeproj/xcshareddata/xcschemes/Provenance-Release.xcscheme
#	Provenance.xcodeproj/xcshareddata/xcschemes/Provenance.xcscheme
#	Provenance.xcodeproj/xcshareddata/xcschemes/ProvenanceTV-Release.xcscheme
#	Provenance.xcodeproj/xcshareddata/xcschemes/ProvenanceTV.xcscheme
#	Provenance/Controller/PVControllerViewController.m
#	Provenance/Emulator/PVEmulatorViewController.m
#	Provenance/Provenance-Info.plist
@armaanaki
Copy link

Just tested new changes, working on iPhone 6s Plus iOS 11.0.2

@sledgehammer617
Copy link

Any possible fixes to the distorted audio in PSX games?

@Cepheidsong
Copy link

On similar emulator I've been able to solve similar distorted audio by raising buffer or using a CD Image Cache option. Maybe in the build itself that can be adjusted to be bigger or on.

It was leaving the ‘.’ as part of the match case on the file. Fixed extension deletion on the cue
The 800 core initilaizes the var Sound_enabled to true on it’s static, but then sets to false on deinit. On the next init, unless you set ‘-sound’ argv that static is still false on reinit. Which cuaes it to not initialize it’s sound buffers. When we go to reneder sound it crashes on the second time the core is used. Why they init a static to 1 and later reset it to 0 I have no fucking clue.
@JoeMatt
Copy link
Member Author

JoeMatt commented Dec 17, 2017

I've pushed a number of updated recently. I believe this PR to be release ready for all intents and purposes. There may be some outlying non-critical bugs. It could use some community testing though for those that are tracking this PR.

The major features / bug fixes

  • Import ROMs by MD5 or filename when extension has multiple destinations
  • BIOS recognition and copy to proper destination by MD5 or filename
  • Mednafen occasional slow playback fixed (the previous work around was selecting Normal playback speed. Any audio stuttering that isn't fixed by that work around is either too slow device or user is running Debug configuration. Please report issues with playback that are still fixed by workaround since that implies my playback calculation fix isn't correct)
  • Fix crash in Atari 800 core when loading a second ROM

I've been playing around with this branch and everything seems ok to me. There are some issues to fix that aren't related to this branch

Hopefully we can get this approved and merged soon. XMAS preset for the community!

@braindx
Copy link
Contributor

braindx commented Dec 17, 2017

I can take a pass at optimizing the shader from #608. The expensive bits are the multiple texture samples for the blurring so maybe I’ll refactor that to a separable blur. Could also just lower the # of samples when running on Apple TV 4 through a preprocessor macro. I don’t have my Mac with me right now so I won’t be able to get to it for a little bit. I also don’t have an Apple TV 4 so someone else will have to test it out and let me know how the performance is.

@JoeMatt
Copy link
Member Author

JoeMatt commented Dec 17, 2017

@braindx That's very generous thank you. The shader looks amazing on all the other cores. Looks great on PSX just lowers the frame rate a bit too much.

I have a branch here where I've merged #608 plus this branch and a few others together to test in combination.
https://github.com/JoeMatt/Provenance/tree/Mednafen+Atari800+Poke+OthersUpdates

@JoeMatt
Copy link
Member Author

JoeMatt commented Dec 17, 2017

As far as the preprocessor macro, I estimate the power of an ATV is around an iPad 4 or iPhone 6. I believe it's a slightly under-clocked A8. Perhaps 2 versions of the shader so the user can select quality vs performance. Ideally we'd have a way to rate the processing requirements of the core + hardware running on and smartly select the optimal version. It would just require some man power on coming up with rating estimations for each device and core combination. For now a manual low / high setting would be adaquette. Perhaps we could make it changeable during run time like OpenEMU has for shaders. Now that we have the architecture it shouldn't be difficult to copy other FOSS shaders into the project. I realise iOS has a somewhat unstandardised shader language compared to the other cross platform emulators. I have basically no knowledge and hit a brick wall trying to get shaders from other projects to work. Now that we have a working base from you though it gives a framework to test other shaders wether copied or cross converted from other shader standards. Once we have a few options an at runtime menu to change shaders would be preferable.

@jasarien jasarien merged commit d16d610 into Provenance-Emu:master Dec 17, 2017
@appletv4
Copy link

For neogeo

I need to import the neogeo.zip into provenance?
And what version of neogeo rom set do I need to use

@braindx
Copy link
Contributor

braindx commented Jan 21, 2018

Just getting a chance to take another look at this now... forget everything I said about a separable blur... I forgot I ended up only using a 1D blur and taking 3 taps so there's nothing to be done there. That also means it should be relatively cheap.

The CRT shader is performed on the GPU as a pixel shader and so conceptually, since all the emulation cores are run exclusively on the CPU (as far as I'm aware), the emulation should be equally performant on all emulator cores since the GPU should always have the full frame to execute that pixel shader. In practice, however, at the end of each frame that the emulator core finishes I believe the renderer is blocking the emulator core from beginning its work on the next frame until the frame is rendered due to a @synchronized block in PVGLViewController. From a cursory glance, it seems this is probably there because the framebuffer generated by the emulator core needs to be transferred to the GPU and you don't want the emulator core overwriting it as it works on the next frame before the GPU has gotten a hold of it. The better approach would be to make the framebuffer double-buffered so that the emulator core alternates which buffer it's rendering to and the GPU can operate on one while the emulator core writes to the other.

I'll mess around with a couple of things on my end here but if you're available to test some changes out on your Apple TV 4 let me know!

@JoeMatt
Copy link
Member Author

JoeMatt commented Jan 21, 2018

Yeah that sounds amazing if you can improve the general rendering infrastructure, it would give us a lot of room to breathe on implementing more advance cores. We copied the rendering structure from OpenEMU so i assumed it was all up to best practices but if there's improvements to be made, especially since we're targeting much more restricted hardware than OpenEMU, it would open us up to implementing more advanced gen cores. Would love to test anything you put out.

@braindx
Copy link
Contributor

braindx commented Jan 22, 2018

The general rendering infrastructure seems fine. The core and renderer are already on separate threads. The only issue I could see was that the mutex for the emulator core remained locked while the framebuffer was being uploaded to the GPU which may or may not have been impacting performance particularly on cores with larger internal resolutions. Check out https://github.com/braindx/Provenance/tree/doublebuffered and let me know if that helps or hurts PSX performance on Apple TV 4. What are the steps for running PSX games by the way? What files need to be uploaded and in what formats?

On another note, could you explain the widescreen flag that is now used in the renderer? I'm not sure why that's necessary and/or what it's supposed to be doing.

@braindx
Copy link
Contributor

braindx commented Jan 23, 2018

Don't bother testing that. I've confirmed locally that the framebuffer copy is too expensive to be worth doing. I'm going to add support to PVEmulatorCore for double-buffered framebuffers and will implement that for the Mednafen core for now. This will assume that the emulator core keeps two framebuffers around and writes to one while the other is returned from [self.emulatorCore videoBuffer]. For cores where this isn't implemented, it will operate as before.

I've also found the wiki for getting PSX games up and running, so I've got that working now so I can test locally. As far as the widescreen flag, it seems like that's just a hack to address the fact that the frame isn't written at the top-left (0,0) of the framebuffer for PSX, a situation which isn't currently handled correctly by the renderer. Is that right or is there something else going on? If that's all it is, I can fix that up as well.

@braindx braindx mentioned this pull request Jan 24, 2018
@XxXStefannXxX
Copy link

I know I am not in the right discussion room but i have a request to make, to all programmers working on Provenance. Would it be possible to make r2 and l2 buttons in the app? Some update or smth? I’m not an expert or anything, and don’t know how its made but it would be great to have all buttons that were on Ps1 controller. Thanks guys

@JoeMatt
Copy link
Member Author

JoeMatt commented Feb 10, 2018

@XxXStefannXxX You know one comment is enough. We get alerts. There are 3 part time people working on about 12 other things right now. Until someone else steps up and fixes #644 you'll have to wait, and please search next and and don't double post or post in closed threads.

@XxXStefannXxX
Copy link

XxXStefannXxX commented Feb 11, 2018 via email

@XxXStefannXxX
Copy link

XxXStefannXxX commented Feb 11, 2018 via email

@JoeMatt JoeMatt deleted the Mednafen+Atari800+Poke branch May 18, 2018 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-related emulation specific
Projects
None yet
Development

Successfully merging this pull request may close these issues.