Provenance-Emu / Provenance

iOS & tvOS multi-emulator frontend, supporting various Atari, Bandai, NEC, Nintendo, Sega, SNK and Sony console systems… Get Started: https://wiki.provenance-emu.com |
https://provenance-emu.com
Other
5.93k stars 686 forks source link

Add support for Playstation 1 games #58

Closed XeresRazor closed 6 years ago

XeresRazor commented 9 years ago

Add support for Playstation 1 titles to Provenance.

XeresRazor commented 9 years ago

I've started work on this using the PSXReARMed codebase.

jasarien commented 9 years ago

Did you not fork and implement Mednafen?

XeresRazor commented 9 years ago

I did, but I could never get performance to a point where it was playable, even on an A8 device.

jasarien commented 9 years ago

Fair enough. I think the main barrier to a PSX core at the moment is the way Provenance currently handles ROM importing. CD based games require the cue sheet as well as the .bin or .img file, and right now .bins are assumed to be mega drive roms. It needs refactoring and some kind of user interface for a user to inform which system a CD is intended for (else there's no way for the code to know).

XeresRazor commented 9 years ago

I was thinking of modifying the search system to scan for cue's first, and then move PS1 games into a subdirectory in documents. Alternatively I think PSXReARMed supports the PSX2PSP eboot.pbp format, which can nicely wrap multiple discs in one package. If it does, I may just wire it up to only support that format.

jasarien commented 9 years ago

The eboot thing sounds useful. In terms of the cue sheet thing, I think a more generalised approach will be needed in case other systems that use CDs are implemented (eg, the Sega MegaCD which is already implemented, but just has no way of cleanly importing the CDs).

I'd like to refactor the entire game library/rom importer at some point anyway, it's in dire need of it :P

Tricertops commented 9 years ago

Supporting PlayStation would be amazing.

apexad commented 8 years ago

Any progress on this? I see that XerasRazor seems to have PSX working but it's based on a pretty old version of Provenance. Any chance in pulling that code over?

jasarien commented 8 years ago

As XeresRazor says in a comment above:

I did, but I could never get performance to a point where it was playable, even on an A8 device.

So no. There was some investigation into using a different emulation core (possibly psx reARMed) but I don't know if any progress was made.

apexad commented 8 years ago

Looks like XerasRazor has not updated it in a year though. The new iPhones are faster now, it would be really great if you could try brining that code ever and updating it and running it on new hardware to see how it does.

XeresRazor commented 8 years ago

If I get a chance I'll dig the code up and see how it's doing on my 6+.

On Oct 10, 2015, at 10:27 PM, apexad notifications@github.com wrote:

Looks like XerasRazor has not updated it in a year though. The new iPhones are faster now, it would be really great if you could try brining that code ever and updating it and running it on new hardware to see how it does.

— Reply to this email directly or view it on GitHub.

MonkeyInitiatives commented 8 years ago

I hope this happens one day. It's my most wanted feature. Maybe the new 6S and 6S Plus have enough power in them to run things better.

xoniq commented 8 years ago

+1

Would love to play classic PS1 games on the Apple TV. (Same voor N64 and NGC. However I thing NGC is to hard to emulate on the Apple TV hardware)

wahkiz commented 8 years ago

+1, playing psx games would be a dream on the new ATV. Feel like revisiting the times when I would play Crash Bandicoot from morning to night.

bronnel commented 8 years ago

Yeas this is probably the most wanted feature, adding psx support with pcsx rearmed

wahkiz commented 8 years ago

I noticed there is a fork for PSX in the graph, anybody can enlighten us on the situation of PSX support currently? I tried compiling but it was giving errors.

jasarien commented 8 years ago

@wahkiz read the comments above yours. This has already been discussed.

Mkaay83 commented 8 years ago

Hey Guys!!! I appreciate your work!!! And Love to use Provenance on my iPhone and  TV4. I really enjoy to revive my childhood by playing classic SNES Games. I'm no coder Or programmer.. So i really don't know how much work you have to put into this. But i love it!! Even my girlfriend uses it to play Super Mario World 24/7 and she Is 28... ;) So my questuion is... Btw it Is her question: will it be possible to Play Mario Kart from the Nintendo 64 someday?! It would be awesome!! So... Can you guys do that?! Greetz from Germany ;)

jasarien commented 8 years ago

@Mkaay83 this is a ticket discussing PSX support. There is another ticket for N64: #17

Mkaay83 commented 8 years ago

THX man 😏

termdisc commented 8 years ago

Is there anything in OpenEmu's codebase that would help? OpenEmu recently added N64 and PS1 support.

apexad commented 8 years ago

Between OpenEmu and RetroArch, the code is out there, but it will still take a considerable effort to port a PS1, N64, or any other video game core to Provenance. Especially in the case of PS1, since there will have to be somewhat of a refactor to allow multiple systems to have iso/bun/cue files (since currently MegaCD uses them).

GutlessGnat commented 8 years ago

Pcsxrearmed doesn't work on non jailbroken devices in retroarch they use an interpreter core to get it to run. But then some games won't run on the interpreter.

The retroarch interface is clunky and hard to navigate. A standalone psx emulator like ppsspp would be ideal. Implementing it into a multi emulator would be difficult if you ask me unless you could make it run eboot files. Even ppsspp won't run those though.

RedLucas commented 8 years ago

Forgive me if this is just non-sense, but could a potential solution to the multiple system having the same iso/bin/cue files be to change the file extensions to custom ones, then have the system still treat them as their original ones? Or something like game.psx.iso maybe.

ghost commented 8 years ago

@redlucas I think that would be too complicated . I think it would just be easier for the app to try and run each iso in a emulator core until it finds the correct one . ( trial and error)

tonycoco commented 8 years ago

What about just using a folder structure?

shruglins commented 8 years ago

Hi @jasarien , I guess this is still an ongoing petition as the issue hasn't been closed. I have done the porting of the psx emulator from the Mednafen emulator, just picked the one from OpenEmu and started changing stuff until it worked (basically I created a lib target for tvOS starting from the existing one in OpenEmu source code).

There's still a lot of work to do, controller input still is not working, and some tricks have to be done to launch a game correctly (create some config files manually that Mednafen needs), also probably right now with the changes I did I broke compatibility with SegaCD (cue rom extension)... I did it quick and dirty because i just wanted to know how much time would it take to just launch a game and see the performance on the apple tv (which is good, psx emulation only takes 70% of the apple tv cpu).

So, if anybody is interested, I could upload a patch containing the diff changes I did. I don't know if you would like me to keep working on it and fix the stuff that's still broken, the truth is I don't have much free time to spend on this, so if you want to keep the code and do whatever you want feel free.

Cheers!

apexad commented 8 years ago

You should definitely create a fork and push your changes to github.

msikma commented 7 years ago

@pmp174 "I think it would just be easier for the app to try and run each iso in a emulator core until it finds the correct one . ( trial and error)"

OpenEmu is able to ascertain which system an image is for by looking inside for a magic string.

Still...it is kind of a drag to have .cue, etc. files, and there's a second problem: multi-disc games. I still think it would be easier if we'd put all files into a directory, and then name that directory "GAMENAME.psxapp" or something like that. It's yet another non-standard implementation, but it would probably be better in the long run.

msikma commented 7 years ago

@shruglins: I'd be interested in having a look at this. Would you be interested in putting the code on Github, or sending a patch?

danielphillips commented 7 years ago

Is there anything available to have a look at?

jasarien commented 7 years ago

Nothing that works

shruglins commented 7 years ago

Hi,

as I'm a little lazy, I just created a patch that you can download from here: https://file.io/tLmQne

It's 29MB, the reason of the size I guess that comes from adding the whole mednafen library to Provenance (which is how psx emulation is implemented in OpenEmu).

As you will see in the patch there are still some hardcoded paths which need to be changed if you want to make it work on any machine.

Other things you need to know:

jasarien commented 7 years ago

@shruglins The link doesn't work: {"success":false,"error":404,"message":"Not Found"}

shruglins commented 7 years ago

sorry, get it from here: https://github.com/shruglins/test

msikma commented 7 years ago

What state of the repository does the patch apply to? I couldn't successfully apply it.

jasarien commented 7 years ago

Same. I'd really prefer it if you'd fork the repo, apply your patch, then create a pull request. It'd make things 100 times easier.

At the very least you'll need to let us know which revision you started with for your changes. That's the revision this patch will apply to.

Provenance [ps1] $ git apply --check ~/Desktop/dirty-psx-implementation.patch
error: patch failed: Provenance.xcodeproj/project.pbxproj:1696
error: Provenance.xcodeproj/project.pbxproj: patch does not apply
error: patch failed: Provenance/User Interface/Provenance.storyboard:1
error: Provenance/User Interface/Provenance.storyboard: patch does not apply
error: patch failed: ProvenanceTV/Info.plist:30
error: ProvenanceTV/Info.plist: patch does not apply
error: patch failed: Provenance.xcodeproj/project.pbxproj:221
error: Provenance.xcodeproj/project.pbxproj: patch does not apply
error: patch failed: PVNES/NES/FCEU/fceu.cpp:417
error: PVNES/NES/FCEU/fceu.cpp: patch does not apply
error: patch failed: PVNES/NES/FCEU/file.cpp:759
error: PVNES/NES/FCEU/file.cpp: patch does not apply
error: patch failed: PVNES/NES/FCEU/file.h:137
error: PVNES/NES/FCEU/file.h: patch does not apply
error: patch failed: ProvenanceTV/Info.plist:30
error: ProvenanceTV/Info.plist: patch does not apply
error: patch failed: Provenance.xcodeproj/project.pbxproj:222
error: Provenance.xcodeproj/project.pbxproj: patch does not apply
error: patch failed: Provenance/Emulator/PVEmulatorConfiguration.m:24
error: Provenance/Emulator/PVEmulatorConfiguration.m: patch does not apply
error: patch failed: Provenance/Emulator/PVEmulatorConstants.h:42
error: Provenance/Emulator/PVEmulatorConstants.h: patch does not apply
error: patch failed: Provenance/Emulator/PVEmulatorConstants.m:42
error: Provenance/Emulator/PVEmulatorConstants.m: patch does not apply
error: patch failed: ProvenanceTV/Info.plist:30
error: ProvenanceTV/Info.plist: patch does not apply
error: patch failed: ProvenanceTV/Info.plist:30
error: ProvenanceTV/Info.plist: patch does not apply
error: patch failed: ProvenanceTV/Info.plist:30
error: ProvenanceTV/Info.plist: patch does not apply
error: patch failed: ProvenanceTV/Info.plist:30
error: ProvenanceTV/Info.plist: patch does not apply
error: patch failed: ProvenanceTV/Info.plist:30
error: ProvenanceTV/Info.plist: patch does not apply
error: patch failed: ProvenanceTV/Info.plist:30
error: ProvenanceTV/Info.plist: patch does not apply
error: patch failed: Provenance/Emulator/PVGLViewController.m:129
error: Provenance/Emulator/PVGLViewController.m: patch does not apply
error: patch failed: ProvenanceTV/Info.plist:30
error: ProvenanceTV/Info.plist: patch does not apply
error: patch failed: Provenance.xcodeproj/project.pbxproj:2205
error: Provenance.xcodeproj/project.pbxproj: patch does not apply
error: patch failed: ProvenanceTV/Info.plist:30
error: ProvenanceTV/Info.plist: patch does not apply
error: patch failed: ProvenanceTV/Info.plist:30
error: ProvenanceTV/Info.plist: patch does not apply
error: patch failed: Provenance/Emulator/PVGLViewController.m:72
error: Provenance/Emulator/PVGLViewController.m: patch does not apply
error: patch failed: ProvenanceTV/Info.plist:30
error: ProvenanceTV/Info.plist: patch does not apply
shruglins commented 7 years ago

I started working from: commit f7b9620154af7a2535a64435bd5f46fbe85defb8 Merge: 5eaf45c 67d9178 Author: James Addyman addyman@me.com Date: Fri Aug 5 08:47:56 2016 +0100

Merge pull request #380 from kcm/saves-typo

Small typo in saves instructions
msikma commented 7 years ago

I still got an error while applying the patch, for some reason. I'm not entirely sure why, since the patch looks fine. It was easy enough to fix, though.

Here's a fork with the patch applied. I haven't tried it yet, since I don't have the time at the moment.

https://github.com/msikma/Provenance/tree/psx-mednafen

JoeMatt commented 7 years ago

I've also been working on this patch. It's been discussed in the slack channel but I didn't want to post it here until it was working. I'm nearly there.

This branch is up to date with master and has been converted to to a dynamic framework as the new method for building cores.

https://github.com/JoeMatt/Provenance/tree/mednafen

I'm wondering if this was ever tested on device since the included static libraries that are requirements, libsnd etc.., are x86 only binaries.

I wouldn't get your hopes up on this one though. The ARM code isn't ARM64 so it has to default to the C methods. Also any dynamic recompilation / JIT won't work without jailbreak and Provnence doesn't aim to target jailbreaks. It's going to be too slow for PSX in all likelihood.

That being said, I had been planning on incorporating Mednafen for some time because it additionally supports other systems such as NeoGeo, Atari Lynx, TGfx16, Virtual Boy etc. This patch wasn't setup to support those systems but I'm assuming it can be done. Or at least, I'm willing to spend some time on it. These aren't exactly the most exciting systems to add but hell why not.

shruglins commented 7 years ago

@JoeMatt I wouldn't say this works if I didn't test it in an actual device (an apple tv 4th gen).

I didn't mind compiling it on arm64 since armv7 runs perfectly smooth (at least in an apple tv 4th gen as I said before). I've been playing a lot to Ridge Racer, Pro Evolution Soccer and Vagrant Story and all of them run perfectly fine.

As you say, mednafen will be able to bring more systems to Provenance, I just wanted to play some time around with it and try to make psx work, of course you'll need to do some more work to do things in a more generic way, but it is easy to do now that you have mednafen implemented.

JoeMatt commented 7 years ago

That's good to know. I'll continue work on getting it to work on current head.

edit:

It appears the conversion to a dynamic library is what's causing my issues. Xcode doesn't seem to care there are missing symbols for the static lib when I roll back those modifications. Completely surprised by that revelation. I had a similar issue converting mupen. OpenEMU also uses static libs for 3rd party dependencies. The issue comes down to iPhone support, which requires both armv7s and ARM64. Mupen's #if ARM macros for instance would break on ARM64 but you would lose optimizations if you removed them entirely for arm7s. I had to wrap entire files with ARM64's ifdef's to work around that since I wouldn't come up with a reasonable way to include only some source files, like .S arm7 source files, into only the arm7 targets.

I should have something this week to work out these kinks. I think it's not acceptable until it works as a dynamic lib as all the other cores, and also builds for 32/64bit arm plus simulator.

JoeMatt commented 7 years ago

OK, I figured it out. Core is running full speed on ATV. I overlooked where @shruglins mentioned the core speed keeps getting reset to Slow. Additionally had to fix some other issues with dynamic linking but all good now.

You can try my branch by checking out https://github.com/JoeMatt/Provenance/tree/mednafen

Setup

I would consider this very experimental at this point. It will probably effect the rendering of other cores due to some hard coded OpenGL changes that need to be changed to be core specific still. You can install 2 versions of Provenance by choosing a new Bundle Identifier in the General settings of the build target in Xcode. Don't forget to change the TopShelf bundle id to match.


Since it's nearly XMAS and many will be eager to get away from their families to enjoy some classic gaming, I'll most likely fix the remaining issues and made a PR based on. Then I'll continue to add in the additional systems that Mednafen supports that Provenance doesn't. (Atari Lynx, PC-FX, TurboGrafix 16/CD, Virtual Boy, Wonderswan.) Yeah, nothing too amazing but it would promote Provenance perhaps to show a growing list of systems both common and non.

It supports NeoGeo but for some reason OpenEMU used NoePop for that system, but I'll look into that too since there was already a request for it.

There's also a slightly updated version of Mednafen. Maybe it's worth looking into as it mentions some PSX tweaks for ARM, though if it's ARM assembly then it's most likely not ARM64 and not going to add any benefit since for some reason it appears you can't mix ARM7 assembly in an ARM64 build (though the CPU still supports those instructions. Maybe this is a technical limitation or just Xcode being Xcode.)

appletv4 commented 7 years ago

@JoeMatt I couldn't get psx working the app kept crashing when I try to open a game

Here's what I did

From your github link I put it in Xcode and choose mednafen (was I suppose to select master?)

I created the bios folder and second folder inside bios , I put the 3 bios bin files in there

I have a couple of psx games both in bin/cue and .IMG

i put the bin/cue game in to a zip together , i wasn't sure if I should put them in roms folder or .com.provenance .psx folder ?

I put them on both just to be sure , neither appears on the library , I then tried to put the bin/cue game without zip in psx folder but that didn't work either

The one game that did show up was an .IMG and the app crashes when I try to open the game

JoeMatt commented 7 years ago

Yes, use the mednafen branch.

As far as the games, If they're zipped, they go in ROMS folder. I actually haven't tested if the conflict manager works though and you'll most likely need to run that after import.

Instead in the meantime, you can just put the bin(s) and cue together (not zipped) in the com.provenance.psx folder and do a rescan. It's likely crashing because the .img isn't known and there's an assert() there that will later be replaced with an error message.


Since I'm posting anyway, I'll update.

  1. Wonder Swan, Virtual Boy and Atari Lynx have been added.
  2. Fixed an issue with crashing on return to library.

Outstanding:

  1. Cores starting in Slow mode
  2. Button mappings are lined up but wrong with MFi in some cases
  3. On screen controls haven't even been done on anything
  4. Rendering dimensions of new systems is off due to OpenGL changes in PSX patch
  5. Add NEC PC-* systems
leolelego commented 7 years ago

I tried it today with few games, THPS, Crash Bandicoot, Tekken 3, Ridge Racer, Ape Escape (fail), and that's works great, I passed a nice Christmas with my bro with this ^^ But it look like Joystick not works on Nimbus controller, it reproduce the cross direction action. The only games I know which needs separate command from Joystick is Ape Escape, so perhaps it could be a nice "test game" for you.

MonkeyInitiatives commented 7 years ago

So, I tried this today and it works really great. Couple of things I encountered that I thought I'd share for anyone trying things.

1: After importing a zip of bin/cue files, it crashes. Load it back up, and it will prompt the conflict manager. Select the PSX option, and it might crash again, or might not. Load it up again and the game will be in the library and work. I only tried this with one game, and it was a zipped file in iCloud that I copied into Provenance using the share sheet "Open in App...". Maybe this issue isn't there when you use the server or file browser on a computer.

2: Fast speed doesn't work. It gets wonky and goes super slow. Games do start in slow motion, but putting them in Normal after launch works well enough. I do experience some slowdown at times that I don't in RetroArch. And, I tried on a whim to change the Slow method to run at 1.0 speed, and that didn't do anything, so the slowdown is coming from somewhere else.

3: Controller mapping seems fine. You can use the analogue sticks on an MFI controller to simulate the d-pad if you rather use sticks. I'm not sure, but I think start/select are mapped to triggers. I also don't know how things work in games that use analogue controls like Ape Escape. EDIT: SELECT IS NOT MAPPED. I got to a block in FFIX because I had to press select and no buttons worked. Looks like Start is L2 but Select is not mapped. I was able to add a line in the mednafengamecore.mm file that mapped Select to R2, so I got passed that part. That said, if we're going to map Start/Select to triggers, might as well swap them since Start is on the right and Select is on the left. Using the analogue stick for movement does seem to bug out at times and go in the opposite direction or take sharp turns. It's not really an ideal solution.

4: I haven't played with things enough, but I'm not sure how switching between discs will work for some games (like Final Fantasy VII or Metal Gear Solid). If you use PCSXR on a computer, you can use your old MCR saves so long as you rename them.

4a: I don't know if you can import mcr files. I doubt it. That would mean you would need to use a computer to copy file names and get things working on a computer first. MCR files in Provenance have appended numbers attached to them.

5: You can delete and add from other apps, like iCloud or Dropbox or wherever. This means you can download on the go and delete if you fill up storage. This can't be done with RetroArch on iOS to the best of my understanding. This is amazing.

6: When I first tried to get it working, it wasn't finding the Mednafen framework. If this happens to anyone else attempting this, go to the build settings and make sure it is added in frameworks. A wrong version in the derived data was getting added by mistake and causing lots of errors.

7: This is a big issue. With the resolution now hardcoded, everything but PSX games are in the wrong aspect ratio or resolution. I've had Sega CD games, NES, SNES, and others all display in the wrong aspect ratio where the left side of the screen is cropped and the right side is just garbage. PSX games display fine, but every other game in every other core is now wrong. I wonder if it would just be possible to adjust the resolution for just PSX games and leave things be in other cores? It makes playing anything other than PSX games a mess since about 5-10 percent of the game on the left side of the screen is wrong.

I'm really happy with how things work so far! It doesn't run as smooth as pcsx rearmed interpreter in RetroArch for me, and it doesn't look as good (things are more pixelated in Provenance with Mednafen). But, this is a really cool thing.

Great job! Now, once a cheat interface gets up and running, and maybe a dark interface gets added, I think I'll probably be done with RetroArch.

somejonus commented 7 years ago

Great work on this, thank you guys so much!

I have an idea regarding the button mapping to an MFi controller. Maybe it could work without occupying the R2 and L2 triggers if the buttons are soft. So when you want to press either select or start you first press the menu button and then choose the button you want by joystick or have them mapped to the 2 triggers inside menu. For example: hit Menu then R2 and voila – you are back ingame and the start-button has been pressed.

MonkeyInitiatives commented 7 years ago

So, I'm trying to resolve the resolution issue where anything but PSX games are borked. shruglins or JoeMatt, can you point me where the resolution settings are being overwritten to force the new resolutions? I want to see how things look with the original settings since they work perfectly with everything but PSX games, and I want to see how bad it is when running PSX games. And, I kind of undershot how messed up non PSX games look right now. It's closer to 20% of the screen being shifted to the left, which makes a lot of games unplayable where the left side of the screen is offscreen and the right side is garbage.

JoeMatt commented 7 years ago

In

  • (void)glkView:(GLKView *)view drawInRect:(CGRect)rect PVGLViewController.m

Really easy to change, wasn't really being held back by this bug. I'm still looking at why the speed values get messed up on init.