hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
10.88k stars 2.14k forks source link

Updated PPSSPP through Retropie, Burnout Legends now goes crazy? #14456

Open bbilford83 opened 3 years ago

bbilford83 commented 3 years ago

What happens?

When I play burnout legends, everything works until the race starts, then the graphics go bonkers and the car repeatedly and immediately "crashes." See this video.

What should happen?

It should play normally :).

What are you using?

Standalone PPSSPP emulator for Retropie.

What hardware / device and operating system?

RPi 4 (overclocked) running emulationstation.

What PPSSPP version (standalone/official), and did it work before?

Standalone, worked perfectly, even at 2x resolution and no frameskip.

Which game or games?

Just Burnout Legends.

Checklist

I deleted the Burnout Legends profile and created a new one, tried at 1x resolution and with frameskip, all had the same results. I tried uninstalling and reinstalling PPSSPP, both from binary and from source, and even tried deleting and replacing the rom.

Help?

Edit: I checked and the same crazy issues are happening in Burnout Dominator too.

Panderner commented 3 years ago

@bbilford83 are you using latest version of PPSSPP?

anr2me commented 3 years ago

May be related to the changes on VFPU? https://github.com/hrydgard/ppsspp/pull/14406 Not sure how to test this, unless you know how to build it your self.

bbilford83 commented 3 years ago

May be related to the changes on VFPU? #14406 Not sure how to test this, unless you know how to build it your self.

Alas I am very much new to this, and even after clicking that link don't really understand it. Though I think you're saying it may be the update itself causing the problem - that is, others would be experiencing it too?

I know it's just a band-aid, but I'd be happy to revert to the pre-updated version if I could figure out how. Both to be able to play it and for testing purposes...

bbilford83 commented 3 years ago

Also, I've been testing a bunch of random games to see if any others were affected, and so far none were. But I just checked Dungeon Siege and my character has turned into some sort of moving picasso painting! See here.

bbilford83 commented 3 years ago

One more brief update. I tried deleting everything in \retropie\configs\psp\PSP\SYSTEM (though I probably only needed to delete ppsspp.ini) so that it would reset all the settings from scratch. It did, created a new ini file, but the problems are all the same.

unknownbrackets commented 3 years ago

I don't know a ton about Retropie, but if you can try compiling a version at or getting an old version at v1.11.2-550-gdbe665880, that might help confirm if the issue is caused by that change.

v1.11.2-550-gdbe665880 does not include the change. v1.11.2-558-g0ccc63b43 includes the change.

The only Linux-specific difference that might affect Raspberry Pi specifically is that it uses sin()/cos()/sincos() now instead of the float versions. If the libm on this system simply has completely wrong implementations of these functions, maybe that might cause this wacky behavior.

-[Unknown]

bbilford83 commented 3 years ago

I don't know a ton about Retropie, but if you can try compiling a version at or getting an old version at v1.11.2-550-gdbe665880, that might help confirm if the issue is caused by that change.

v1.11.2-550-gdbe665880 does not include the change. v1.11.2-558-g0ccc63b43 includes the change.

The only Linux-specific difference that might affect Raspberry Pi specifically is that it uses sin()/cos()/sincos() now instead of the float versions. If the libm on this system simply has completely wrong implementations of these functions, maybe that might cause this wacky behavior.

-[Unknown]

Thanks very much for the tip. I would love to try to compile that, and I do know how to SSH in so I end up at a Linux command prompt. Any chance you might be able to handhold me on what to type in there to replace the new version with the old one?

bbilford83 commented 3 years ago

One more brief update. The issue above was on my pi4 I have set up on my living room. Just to test, I updated to the most recent PPSSPP on my PiBoy (same guts, rpi4 4gb running retropie) and it did the same thing, breaking the same games. So I think it's safe to say it's a consequence of the most recent update? I'm surprised I'm the first to notice/post here, if so, but would still welcome any solutions (including a way to revert). Thanks much!

bbilford83 commented 3 years ago

Apologies for all the updates, but I don't know what is or isn't relevant: I just checked and the same games are broken in lr-ppsspp too.

bbilford83 commented 3 years ago

Hi all,

I've noticed there have been several updates in the past ~12 days since I posted this and have updated each time a new one popped up. Alas, no changes in the games that are broken. Wondering if/hoping someone could let me know whether this is now a known problem across users or if I'm doing something wrong specific to me - it seems like it might actually be a fair percentage of the PSP library that's not working anymore.

If this is being worked on and I'm just being annoying, feel free to say so too. I just wanted to know if I need to be looking for an individualized solution or just waiting patiently :).

Cheers!

unknownbrackets commented 3 years ago

I'm not sure if this is somehow libretro specific. None of the recent changes have specifically targeted this.

I unfortunately have no idea how to compile retropie to walk you through it. I could tell you have to compile PPSSPP standalone. My only guess is that the libm that retropie ends up compiling against might have completely broken sin/cos math functions, but without even being able to narrow down when it broke for sure that's itself a pretty wild guess.

-[Unknown]

bbilford83 commented 3 years ago

I'm not sure if this is somehow libretro specific. None of the recent changes have specifically targeted this.

I unfortunately have no idea how to compile retropie to walk you through it. I could tell you have to compile PPSSPP standalone. My only guess is that the libm that retropie ends up compiling against might have completely broken sin/cos math functions, but without even being able to narrow down when it broke for sure that's itself a pretty wild guess.

-[Unknown]

Thanks for the offer. I am actually talking about the standalone PPSSPP emulator in retropie... not the lr-ppsspp retroarch core. The games seem to be broken there too, but I'm using standalone because it's much faster than the retroarch core.

If that means you might have advice, I'm all ears! Thanks either way.

unknownbrackets commented 3 years ago

In that case, these are the compile instructions: https://github.com/hrydgard/ppsspp/wiki/Build-instructions#download-the-source-code https://github.com/hrydgard/ppsspp/wiki/Build-instructions#building-for-raspberry-pi-os-64-bit

So basically you run these commands:

git clone --recurse-submodules https://github.com/hrydgard/ppsspp.git
cd ppsspp

sudo apt install clang cmake libgl1-mesa-dev libsdl2-dev libvulkan-dev

sudo update-alternatives --config cc
(select clang)

sudo update-alternatives --config c++
(select clang)

./b.sh --rpi64

It will likely take a bit of time (at least 20 minutes.) Once the build is complete, you should be able to run it by executing:

./build/PPSSPPSDL

If it fails to build, it'll say error at the end and the above command won't work. In that case, paste as much of the output as possible here.

Assuming it does build, most likely it'll have the same issue. The good news is, we're done with the time consuming part. Now we need to try changing a file.

We'll be modifying these lines: https://github.com/hrydgard/ppsspp/blob/a84df2536af929cc29188d217edef77ab7433130/Core/MIPS/MIPSVFPUUtils.cpp#L1042-L1047

To the following:

        sincosf(angle, &d_sine, &d_cosine);
        i_sine.f = (float)d_sine;
        i_cosine.f = (float)d_cosine;
#else
        i_sine.f = (float)sinf(angle);
        i_cosine.f = (float)cosf(angle);

The change is just adding "f" to the end of "sincos", "sin" and "cos". Normally, this should just reduce their precision.

To do this, run the following command:

nano Core/MIPS/MIPSVFPUUtils.cpp

From there, press page down or the down key until you get near the end of the file, and go up to those lines with the up key. Press left and right to navigate to the ( after the three words we're adding f after, and just press f. Probably seems pretty obvious after explaining, but I assume you've never seen nano before.

Next hold Ctrl and press the O key, which should save the file. Then Ctrl and X to exit.

Next, instead of running ./b.sh again, run the following:

pushd build
make
popd

This will just update with your changes, so it'll go much quicker. Once this is done, you can type that PPSSPPSDL command again to run it:

./build/PPSSPPSDL

If this fixes it, it confirms my theory that rpi has a broken libm sin/cos implementation. If it doesn't, the next step would be to bisect. That's covered here:

https://github.com/hrydgard/ppsspp/wiki/How-to-bisect-to-find-what-broke-a-game

Before that, first run git checkout Core/MIPS/MIPSVFPUUtils.cpp. This will undo the changes you made so you can start clean. You can run the same make from above between each step to try it and see if it is "bad" or "good". Git will automatically pick the mathematically least number of tries in this case.

-[Unknown]

bbilford83 commented 3 years ago

Thanks so much for this insanely detailed advice - I really appreciate it. Only curveball I should've mentioned is that at least as of now I don't have a keyboard and have been doing stuff like this via SSH through my laptop. I got through the compile via SSH (and it did take about 20 mins), but this command doesn't do anything: "./build/PPSSPPSDL"

A screengrab is attached below. Forgive me if this is a dumb question, but can I just run PPSSPP via retropie now to test it?

image

If I can just testing it by running it through retropie, I have one other question. I can follow the instructions that you gave to edit the "MIPSVFPUUtils.cpp" file, is it OK for me to just edit it directly through WinSCP, then reboot, then test again? Not trying to avoid the extra steps, but that's a bit more in my wheelhouse/understanding as I have little linux experience.

Again, thanks so much for your time/patience.

unknownbrackets commented 3 years ago

The screenshot seems to only show a clone, I don't see any build having happened. Try running the first set of commands starting from cd ppsspp. The clone can be a bit slow if your internet connection is slow, since there's a good bit of code to download.

You can edit MIPSVFPUUtils.cpp using anything, so WinSCP is fine as long as you recompile afterward.

-[Unknown]

bbilford83 commented 3 years ago

Well that was dumb of me - I was multi-tasking and clearly jumped from your very first step to trying to build it. It seems to be working now... lots of green text preceded by a percentage done. Thank you and I'll likely post again shortly, one way or the other :).

bbilford83 commented 3 years ago

OK, I did get further before hitting a wall. Can't seem to copy/paste, but here are two screengrabs that show what that command got me:

image

image

unknownbrackets commented 3 years ago

Hm, is anything running on the pi? It seems like it couldn't get EGL running. This could be because something else is already using the screen, but I'm not sure. I don't have a pi4, though I've seen it work to run PPSSPP through SSH on older ones.

-[Unknown]

bbilford83 commented 3 years ago

I was going to write back saying "no," because I stupidly think of emulationstation as like the OS. Then I realized I should exit that, and it worked like a charm. As you expected, the game does the same stuff, so I am trying to edit the file as you suggest now.

bbilford83 commented 3 years ago

Alrighty, I am pretty sure I did everything right this time, changed the file appropriately, but it didn't fix the issue. I looked at the link about how to bisect and for better or worse it seems well beyond my capacity. I really appreciate the handholding and I guess maybe it is at least useful info that the changes to that file didn't fix it?? Sigh...

unknownbrackets commented 3 years ago

It's definitely useful to know that didn't fix it, although I'm now not sure what could be the cause.

-[Unknown]

bbilford83 commented 3 years ago

[Unknown] et al, I have one other request/issue. I tried going back to the binary-installed version just to see if it would make a difference (knowing that was unlikely). It didn't, and when I went back to install the version from source, it now says "Could not successfully build ppsspp... /home/pi/RetroPie-Setup/tmp/build/ppsspp/ppsspp/PPSSPPSDL not found." I know this has nothing to do with solving my actual problem, but any advice on how to get my system back to square one so that I can at least update via source if a solution arises in the future? I assume this error has to do with my tinkering from before? TIA!

bbilford83 commented 3 years ago

Or, better yet, although I know it doesn't solve the greater problem for anyone, if anybody could give me advice on how to revert to an older version before the recent update, I'd really appreciate it. I found this closed issue, but wasn't successful - I still have a pi4 running the old version on my handheld (the PiBoy) but when I tried to follow what was done there, games instantly exited to menu upon loading. Sorry to pester, but it looks like a lot of games aren't working right anymore, and in particular my five-year-old is bummed we can't "crash the bad guys" in pursuit mode in Burnout Legends :).

anr2me commented 3 years ago

I'm not really familiar with git command, since i'm using SourceTree UI

I think it's something like this: (base on previous commands)

git clone --recurse-submodules https://github.com/hrydgard/ppsspp.git
cd ppsspp

sudo apt install clang cmake libgl1-mesa-dev libsdl2-dev libvulkan-dev

sudo update-alternatives --config cc
(select clang)

sudo update-alternatives --config c++
(select clang)

git checkout <commit_sha> //<commit_sha> is the commit hash code you wanted to go to
git submodule update --init --recursive

./b.sh --rpi64

For example: git checkout8d0ca1e4f1a0b56750d92e126d447e4bb3cbbd48

You can do checkout anytime to try each commits you wanted to test, followed by submodule update to make sure the submodule matched with that commit, and then build it(./b.sh) to test it, if it didn't work, do another checkout on a different commit and repeat. To go to the latest commit on master branch you can do git checkout master, and followed by submodule update of course.

PS: You can find this from Revision links at https://buildbot.orphis.net/ppsspp/index.php?m=fulllist

bbilford83 commented 3 years ago

THIS WORKED!!! Thank you so much ANR2ME (and unknownbrackets). I compiled a version from 5/1 and the games aren't broken on that one. Only thing is, I can't figure out how to make my rpi4 (via emulationstation) run the old version I compiled... the version of ppsspp it runs is the one I had installed through retropie_setup (now it is installed via the "binary") that is current. Obviously that is still broken, though. If either of you (or anyone) have any idea how to make it run the old version I just compiled per ANR2ME's instructions, please let me know. It runs via SSH when I am at the command prompt and type "./build/PPSSPPSDL," but that's obviously not ideal (and full of stutter anyway). TIA, and again, really appreciate all the help.

unknownbrackets commented 3 years ago

Based on that, the likely range of commits is:

https://github.com/hrydgard/ppsspp/compare/8c72cc119ee2f1a65d5524276eadd4dbdd838dbb...89ea9625a5cbe9e42cf4db327b085ec98787eae8

If you have a chance to test this version, knowing whether it works or not would cut the possible causes down by half: b89a27d587c32e12207ed729367236a49b322fce

If there are issues with that version, a close second would be: b1a53d493e11a8d84ec8ba3d9ef739a4b7426b88

The VFPU changes are indeed not in this range. It's mostly changes to path handling.

-[Unknown]

bbilford83 commented 3 years ago

Based on that, the likely range of commits is:

8c72cc1...89ea962

If you have a chance to test this version, knowing whether it works or not would cut the possible causes down by half: b89a27d587c32e12207ed729367236a49b322fce

If there are issues with that version, a close second would be: b1a53d493e11a8d84ec8ba3d9ef739a4b7426b88

The VFPU changes are indeed not in this range. It's mostly changes to path handling.

-[Unknown]

I'm happy to give this a shot and will as soon as I'm in front of my TV again. I'll let you know the results as soon as I've tested.

On my selfish end, I tried earlier this afternoon to figure out how to make the working emulator run in retropie and failed. I'm stumbling around very ignorant here but here's what I tried:

I found a folder now located at home\pi\ppsspp, which by the timestamp I figured was the newly-compiled old/working version that I was able to launch via SSH. I copied that folder (renamed as ppsspp-old) to opt\retropie\emulators\, which is where my current (broken) standalone ppsspp emulator is located in the ppsspp folder. Per the link I gave above, I then edited my \retropie\configs\psp\emulators.cfg file to use the "ppsspp-old" emulator as the default, so that it wouldn't get updated by the system. I tested the games then, but no dice - the loading screen comes on and then it just kicks back to the retropie menu. I then checked and saw that the contents of my ppsspp and my ppsspp-old folders look nothing alike - the latter has way more files, and is missing the "PPSSPPSDL" file that appears to be what actually launches the emulator. Reading the instructions above I realize now that that file is located in a subfolder called "build." Knowing it probably wouldn't help I copied that file to the root ppsspp-old folder. It did not help.

So now I know I have a working PPSSPP standalone emulator on my pi, I just don't know how to use it :). Any help would be much appreciated, and I'll get back to you on the other builds to see if they work.

unknownbrackets commented 3 years ago

It looks like you may need to run cd ppsspp first.

As for retropie, I'm not exactly sure how it works or where it expects ppsspp. Based on this script: https://github.com/RetroPie/RetroPie-Setup/blob/master/scriptmodules/emulators/ppsspp.sh#L115 https://github.com/RetroPie/RetroPie-Setup/blob/master/scriptmodules/emulators/ppsspp.sh#L161

It seems like there should be an "install dir" (which might be under /usr or /opt/) where PPSSPPSDL should go. Maybe look for assets? You can search via ssh using:

find /opt/ -name 'PPSSPPSDL'
find /opt/ -name 'assets'

-[Unknown]

bbilford83 commented 3 years ago

It looks like you may need to run cd ppsspp first.

-[Unknown]

Yep, this was another dumb mistake on my part, I deleted my post but not quickly enough :). I am trying it now again.

As to the rest, there is definitely a /opt/retropie/emulators/ppsspp folder, and I am sure that is where the version I currently have installed is. But the folder has almost nothing in it, just the PPSSPPSDL file, a retropie.pkg file, and the "assets" subfolder that appears to be identical to the assets subfolder in the home/pi/ppsspp folder that I think was created via the cloning process. Screenshots again, the following is in my opt/retropie/emulators/ppsspp folder... (right half of screen)

image

And this is the folder in home/pi/ppsspp

image

So obviously there's a ton more stuff in that folder. My thought from that other post I linked was to just copy the working folder (second image) into the same emulators parent folder and tell retropie to run that one as the default psp emulator, but no dice. Any ideas?

unknownbrackets commented 3 years ago

Well, I would do this:

mv /opt/retropie/emulators/ppsspp/PPSSPPSDL /opt/retropie/emulators/ppsspp/PPSSPPSDL_old
cp /home/pi/ppsspp/build/PPSSPPSDL /opt/retropie/emulators/ppsspp/PPSSPPSDL

It may give an error. If it does, try:

sudo mv /opt/retropie/emulators/ppsspp/PPSSPPSDL /opt/retropie/emulators/ppsspp/PPSSPPSDL_old
sudo cp /home/pi/ppsspp/build/PPSSPPSDL /opt/retropie/emulators/ppsspp/PPSSPPSDL

These commands may or may not prompt for a password, depending on how pi configured sudo - but I know it should have sudo.

-[Unknown]

bbilford83 commented 3 years ago

Thanks again. I'm gonna get myself into trouble trying to do too many things at once, so once I finish testing the version you asked me to check out I will give this solution a try.

bbilford83 commented 3 years ago

While I'm waiting for it to compile, I might as well share though that I discovered another ppsspp folder. This one is in root/root/ppsspp, and looks to have all the stuff the clone has except for the PPSSPPSDL and retropie.pkg file. See attached screenshot.

image

I don't know if that changes your advice but I thought I'd share... it's almost like the pi splits up the folder into different places?

unknownbrackets commented 3 years ago

That doesn't change it. Maybe that's where retropie built PPSSPP before.

-[Unknown]

bbilford83 commented 3 years ago

OK, I can now confirm that the currently-broken games are running fine on the version at b89a27d587c32e12207ed729367236a49b322fce too. Hope that helps.

Not sure if this is relevant, or if I screwed something up, but this time when I tested it it didn't automatically know where my games where - I had to navigate to the right folder - and it didn't have my saved profile on Burnout Legends. With all the other stuff I've tested so far it did - hopefully I didn't delete something important.

Now I'm going to try your advice on how to get it working in retropie, unknownbrackets. Thanks again.

bbilford83 commented 3 years ago

Actually, I'll ask one more piece of advice first before I screw something up, if you'll indulge me. I actually deleted the ppsspp-old folder after it wasn't working, so now my opt/retropie/emulators folder looks like this, as it did before I started tinkering. In that ppsspp folder is the build-from-binary version that is current and broken.

image

Having tested out the version you asked me to, this is what I have now in my home/pi folder

image

Do you still recommend the same commands you did before, or should I be creating a ppsspp-old folder first and copying stuff into it?

P.S. Comment #35, sheesh... thank you again for your patience.

unknownbrackets commented 3 years ago

Should be the same. I suppose you can skip the old part.

I don't know if that'll work though or if there's more to what retropie needs.

Also, great, if that commit is good it means the range is: https://github.com/hrydgard/ppsspp/compare/b89a27d587c32e12207ed729367236a49b322fce...89ea9625a5cbe9e42cf4db327b085ec98787eae8

Which is basically only the Path changes. I wonder if we're somehow reading things wrong in cpudetect...

-[Unknown]

bbilford83 commented 3 years ago

That worked!! Am I understanding the commands right that all I did was copy the PPSSPPSDL file from the old commit over the new one?

One very weird (super minor) quirk, though. In Burnout Legends there is an odd graphical glitch where a black box appears over the sun. I've seen this glitch when I played the game on my playstation classic, but it was never present before on my pi. I guess it could just be a coincidence, but I'm 100% sure it's new.

bbilford83 commented 3 years ago

Last follow-up. Just because I really was hoping to have a "back-to-normal" setup, I tried going back to the 5/1 build, and the sun glitch isn't present on that version. I'm not closing this because I assume you devs wouldn't consider the issue "closed" since I just worked around it, but I'm happy to help to the extent I can going forward, and thanks again for all your help.

Edit: I spoke too soon, the sun glitch is present on and off. Also, I think it might be struggling a bit now in ways it wasn't before... just got some frameskip warnings where I never used to in the game.

anr2me commented 3 years ago

It would be nice if you can do bisect, so that we know the exact commit causing the issue https://github.com/hrydgard/ppsspp/wiki/How-to-bisect-to-find-what-broke-a-game It will automatically checkout commits halfway between the last working commit and the broken one (ie. the latest commit) until it found the problematic commit (you'll need to confirm whether each checkout is good/bad by building and testing it)

bbilford83 commented 3 years ago

It looked pretty intimidating before but I'm happy to give it a shot, possibly not until Tuesday though as I am on solo duty with my kid for the weekend. Thanks again.

unknownbrackets commented 2 years ago

There have been some fixes to those path changes. Is this any different now?

-[Unknown]

bbilford83 commented 2 years ago

First off, I'm so sorry I went MIA - I completely forgot about this. Second, I just tested by updating lr-ppsspp from source and it is still doing the same problem. Earlier I noticed that when I try to update standalone PPSSPP through RetroPie-Setup there are errors now and it won't update - I assume something to do with how I replaced it with the older build - so I can't check there. But I would think the path changes would have been updated on the libretro core too?

anr2me commented 2 years ago

Is this error when you update ppsspp source related to assets? i remembered to have issue related to assets when pulling the latest commits recently, because it's no longer part of sub-module.

bbilford83 commented 2 years ago

Um... how do I say "I have no understanding of anything you just said" without sounding like an idiot? Apologies, but I'm coming from a very non-technical, brand-new-to-Linux background here...

dmrlawson commented 2 years ago

I did a quick test of this on Lakka 3.3 rpi4.aarch64.

I started a race with random cars/tracks and it started and played fine. I found I had to use the gl driver. vulkan just crashed and glcore gave a grey screen (though it sounded like the game might be running in the background).

voicenoise commented 2 years ago

Hello i got some errors by installing from source and this from retropie and manual compile /usr/bin/ld: ../ffmpeg/linux/aarch64/lib/libavformat.a: error adding symbols: file format not recognized clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [CMakeFiles/PPSSPPSDL.dir/build.make:586: PPSSPPSDL] Fehler 1 make[1]: *** [CMakeFiles/Makefile2:604: CMakeFiles/PPSSPPSDL.dir/all] Fehler 2 make: *** [Makefile:141: all] Fehler 2

gouchi commented 1 month ago

Hi,

Is it still an issue using latest update ?

Thank you.