libretro / TempGBA-libretro

Libretro port of TempGBA. PSP only for now.
GNU General Public License v2.0
6 stars 6 forks source link

Core needs to be updated #3

Open ItachiSan opened 6 years ago

ItachiSan commented 6 years ago

As in title. The core misses two main components:

I would like to test something, but I have no idea of which tools I need for building a PSP binary and how to dump the debug messages from a PSP.

bmaupin commented 4 years ago

The code should be updated to respect the official one, which I suppose it is this one

If I understand correctly, this core is based on TempGBA4PSP-26731013, which was released on 2013-10-13. TempGBA4PSP itself is based on the original TempGBA you linked to, which is actually an emulator for Nintendo DS. It looks like the original TempGBA does have a few changes since 2013-10-13, although I wonder with it not being a PSP emulator if any of the changes could actually negatively impact performance or compatibility on the PSP. But it would definitely be worth looking into.

It would also be interesting to see if there are any changes from TempGBA4PSP-mod (which is itself based on TempGBA4PSP-26731020) that would be useful. Although that would probably be more difficult because it doesn't have a clean commit history and so it's hard to tell what changes were made and why. Maybe it would be best just to cherry pick changes from the original TempGBA...

The core should support the game_config.txt file as the original emulator, that is highly used for better compatibility with games.

That would be a cool feature. Do you know of any specific games that could be used for testing this? In my testing so far the only differences I noticed as compared to TempGBA4PSP seem to be caused by the lack of frame skipping in this core. But I've only tested a very small number of games.

I would like to test something, but I have no idea of which tools I need for building a PSP binary and how to dump the debug messages from a PSP.

I'm working on updating the README in this core with better instructions on building it that might be helpful. I hope to make a PR soon.

ItachiSan commented 4 years ago

TempGBA4PSP itself is based on the original TempGBA you linked to, which is actually an emulator for Nintendo DS. It looks like the original TempGBA does have a few changes since 2013-10-13, although I wonder with it not being a PSP emulator if any of the changes could actually negatively impact performance or compatibility on the PSP. But it would definitely be worth looking into.

I believe it should be clear the origin of this core so that cherry-picking and bug fixing can be done successfully. I was struggling a bit when checking the Git histories for finding out nice commits when I had no clue of which is the real base emulator.

It would also be interesting to see if there are any changes from TempGBA4PSP-mod (which is itself based on TempGBA4PSP-26731020) that would be useful. Although that would probably be more difficult because it doesn't have a clean commit history and so it's hard to tell what changes were made and why. Maybe it would be best just to cherry pick changes from the original TempGBA...

Both sound as a plan; I can do some hacking if/when I have free time 😄

The core should support the game_config.txt file as the original emulator, that is highly used for better compatibility with games.

That would be a cool feature. Do you know of any specific games that could be used for testing this? In my testing so far the only differences I noticed as compared to TempGBA4PSP seem to be caused by the lack of frame skipping in this core. But I've only tested a very small number of games.

I am fairly sure it solved some problems with some Kirby games in the original TempGBA emulator. I can re-test this in 2 weeks when back home (on a business trip now).

I would like to test something, but I have no idea of which tools I need for building a PSP binary and how to dump the debug messages from a PSP.

I'm working on updating the README in this core with better instructions on building it that might be helpful. I hope to make a PR soon.

Sounds great! Would like to figure out why some games freeze and if/how the original devs solved such issues.

bmaupin commented 4 years ago

I believe it should be clear the origin of this core so that cherry-picking and bug fixing can be done successfully. I was struggling a bit when checking the Git histories for finding out nice commits when I had no clue of which is the real base emulator.

Totally agreed. I struggled too. Thankfully as I mentioned, this repo at least says it's based on TempGBA4PSP-26731013. And I know TempGBA4PSP is based on the original TempGBA, but because TempGBA4PSP is only available as downloadable zip files, I'm not sure which version of TempGBA it's based on.

Thankfully there are several releases available, so it might be possible to compare one of the earliest versions with TempGBA to determine at what point it was forked. Here's a list of TempGBA4PSP releases (mixed in with a few other things):

http://www2.axfc.net/u/search.pl?search_str=TempGBA4PSP

Based solely on those dates, I'm guessing the first version is either from 2013-06-08 or 2013-05-18. Given that the original TempGBA was updated until 2014-05-24, there could be a good amount of changes to merge back into this core.

Both sound as a plan; I can do some hacking if/when I have free time smile

One more good source I almost forgot is TempGBA4PSP itself. This core is based off TempGBA4PSP-26731013, but there was actually one more release that could have some useful changes: TempGBA4PSP-26731020

I am fairly sure it solved some problems with some Kirby games in the original TempGBA emulator. I can re-test this in 2 weeks when back home (on a business trip now).

I also forgot to mention that I'm going to try to work on adding back the frame skipping that was a part of TempGBA4PSP. It sounds like your problems are more more related to game_config.txt, but if I'm able to get the frame skipping added back I'll let you know in case it helps.

Sounds great! Would like to figure out why some games freeze and if/how the original devs solved such issues.

Just for building the core, I was able to get it working using Docker and the libretro-super repo that I think is what the libretro buildbot actually uses for building:

git clone https://github.com/libretro/libretro-super.git
cd libretro-super
# Use gcc 4.6.4 to work around https://github.com/pspdev/psptoolchain/issues/98
docker run --rm -v "$PWD:/build" -e SINGLE_CORE=tempgba -e FORCE=YES -e NOCLEAN=1 -e EXIT_ON_ERROR=1 bmaupin/pspdev:gcc-4.6.4 ./libretro-buildbot-recipe.sh recipes/playstation/psp

Then the built core will be in libretro-super/retroarch/pkg/psp1/cores/tempgba_libretro.PBP

If you have the PSP dev tools installed locally you can run replace that last line with something like:

SINGLE_CORE=tempgba FORCE=YES NOCLEAN=1 EXIT_ON_ERROR=1 ./libretro-buildbot-recipe.sh recipes/playstation/psp

Also, as part of the build it will automatically do a git clone of this repo. You can point libretro-super to a different repo/branch by modifying recipes/playstation/psp.

Alternatively, you could just copy this repo into libretro-tempgba into the libretro-super directory and comment out the lines that do the clone in the libretro-buildbot-recipe.sh script:

        if [ "$URL" != "$OLDURL" ]; then
            # rm -rf -- "$DIR"
            echo "cloning repo $URL..."
            # git clone --depth=1 -b "$GIT_BRANCH" "$URL" "$DIR"

The build script does a lot of stuff so I found that easier than trying to figure out every single step it did. But I could probably do that too if you want.

I have to admit I haven't actually done any real debugging yet. But this might be helpful: https://github.com/pspdev/psplinkusb

Hope that helps!

bmaupin commented 4 years ago

One of the things I've considered is whether this core is worth working on, or whether my time would be better spent working on getting one of the other cores working better on PSP.

Right now the PSP build of RetroArch comes with mGBA. But so far even with a dumped BIOS, it seems too slow to be usable. I might tinker with it a little more in case there are some settings I missed. This would probably be the best option since as far as I can tell it's widely considered to be the "best" GBA emulator these days and it's still actively developed.

Then there's the original gpSP, which was originally developed for the PSP but ironically isn't included in the RetroArch PSP archive. I might see if I can build it and see how well it does. It's not as actively developed as mGBA but it's still more actively developed than this core (which isn't saying much haha).

bmaupin commented 4 years ago

I guess this answers the question about mGBA :)

Seeing as it doesn't even run full speed on the Vita, this isn't happening any time soon. It would be cool, but it's not feasible without big changes.

https://github.com/mgba-emu/mgba/issues/1373#issuecomment-497461831

bmaupin commented 4 years ago

@ItachiSan I'm not sure if this is something you're still interested in, but I spent some time getting the QuickNES core working on the PSP again. I had to get the PSP debugger working to figure it out, so I documented it here:

https://bmaupin.github.io/wiki/other/psp/psp-debugging.html

I ran it using docker but you should be able to run it without docker too, it'll just mean you'll have to install all the PSP dev tools on your workstation which I was too lazy to do :P

Also, out of curiosity I did some testing with the original gpSP to see how it compared with some of the later variants, and I was shocked that in almost every test I did, it actually ran better than any of the forks. No wonder the original author (exophase) was so upset that people were forking it instead of working with him.

Based on that, I think any effort on GBA emulation on the PSP would probably be better spent on the libretro gpSP core to get it working on the PSP again.

In particular, I think you'll find it helpful to know that the gpSP core already has game_config.txt support and I think the file is baked into the core (https://github.com/libretro/gpsp/blob/master/game_config.txt).

I'm going to take a look at the gpSP core myself and see how much progress I can make in getting it working on the PSP again.

ItachiSan commented 4 years ago

@bmaupin hi, thanks for keeping in touch!

Looks really interesting! Will give it a try! Did you build the Docker image yourself? Can I have the Dockerfile or the image name for pulling it?

Thanks again for the feedback about the cores testing! I didn't have time/desires to do code (outside working hours) until this week, so I might give it a show if I have some spare time this week :smile:

bmaupin commented 4 years ago

@ItachiSan

Did you build the Docker image yourself?

Yes, but it's from a fork. I just updated it because this core requires a particular version of gcc due to a bug in the SDK for later versions.

Can I have the Dockerfile or the image name for pulling it?

Sure, the image is here: https://hub.docker.com/r/bmaupin/pspdev

And the source is here: https://github.com/bmaupin/pspdev-docker

Hope that helps!

bmaupin commented 4 years ago

@ItachiSan I wrote another document for compiling RetroArch for PSP in case that helps: https://bmaupin.github.io/wiki/other/psp/compiling-retroarch-for-psp.html

I've also got the gpSP core working again on PSP (the PR has already been merged) and I got dynarec working again (waiting for PR to be merged). Next I'll probably tackle frame skipping to bring that core up to par with this one.

At this point from my perspective the gpSP core seems like a better investment since it seems to perform better than this core and it will get more attention since it's cross-platform. As I already mentioned it also already supports game_config.txt.

ItachiSan commented 4 years ago

Hey @bmaupin, sounds as lots of really good progress! 😄 I got a bit busy with life thus hacking time was close to none 😛

Will try to check the PR in next days; should I try to compile and test the core on a few games? Would be happy to help somehow!

bmaupin commented 4 years ago

@ItachiSan I can understand that!

The dynarec PR was merged, so it's a lot more playable now but a lot of games will probably have audio stuttering since I don't think the PSP can run most of them at full speed.

I'm working on adding frameskip for PSP now; I've compiled the core with it included in case you want to play with it.

gpsp_libretro.PBP.zip

Saramagrean commented 3 years ago

gpsp_libretro.PBP.zip

@bmaupin Impressive! It working on PPSSPP too. 🤣

Screenshot_20210705-225013510

ItachiSan commented 3 years ago

Well, on original HW gpsp still won't work 😓

Saramagrean commented 3 years ago

Try latest git build? http://buildbot.libretro.com/nightly/playstation/psp/

ItachiSan commented 3 years ago

I installed the latest release on my PSP, no luck. RA feels snappier but no dice emulating stuff.

bmaupin commented 2 years ago

gpSP was working on my PSP the last I tried, but it's been a couple years because I switched to a 3DS for my primary emulation device.

If it's not working now, I would strongly recommend creating an issue on the repo: https://github.com/libretro/gpsp/issues

I say that because @davidgfnet is currently doing a ton of improvements to gpSP: https://github.com/libretro/gpsp/commits/master

He can probably fix it if it's still not working.

At this point, I'm not sure there's any reason to use the TempGBA core any more. Last time I tested gpSP seemed faster and there was only one game where gpSP had a bug that TempGBA didn't: https://gist.github.com/bmaupin/dac967cd0c527cab028a3bb5c2c11762

If you need another reason to stop using TempGBA, it was removed from the RetroArch build a year ago: https://github.com/libretro/libretro-super/commit/eb0b498f465410b6a3b71922fca48cd84793071d#diff-2a6edd011b36246a13a916ff411397d482e9796f872e74d9615f7462c1d54a95

I don't think it makes much sense to support the TempGBA core any more. It was only ever working for the PSP anyway.