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
11.45k stars 2.19k forks source link

Final Fantasy Type-0 issues (texture scaling, MT crash) #6268

Closed hrydgard closed 8 years ago

hrydgard commented 10 years ago

We've gotten an influx of new users thanks to the release of the translation patch and looking at various forum threads they're hitting the following pain points:

Other bugs:

I think we need to change how we expose texture scaling in the interface. The slowdowns aren't as extreme anymore when texture scaling as I've added a hauristic that prevents more than a certain number of texels per frame to be scaled.

LunaMoo commented 10 years ago

There are 2 moments early in the game which even without texture upscalling makes the game vram usage rise from ~190mb to ~500-600mb, it causes like 2 second drop to 2xfps on my hd5670(gddr5 1gb), easily avoided completely by auto frameskip set to 1 however people with less dedicated vram can likely experience a drop to like 1fps, it might even crash on mobiles(?), anyway it happens when this tutorial boss shows up and the second time when he disappears: npjh50443_00006 I guess it's the smoke effects that hide the model, since in this scene that boss is just a mysterious "?????" and you're not able to see much other than darkness. That's very early in the game like a minute if you skip all the tutorial messages and videos, before even first savepoint. It was known issue from pretty long ago, but people in current hype doesn't really search for solutions and playing with texture upscalling during that moment can be really bad even on higher end systems.

I played only for a few hours from yesterday, but didn't really noticed any other heavy scene like that. Texture upscalling was always a problem for lower end gpu's whenever alot of new textures have to be processed, not really sure how you can avoid that, but good luck:).

BTW buildbot seems to be dead again, so probably most people who play the game are stuck on v0.9.8-1088-ga31194a.

unknownbrackets commented 10 years ago

Buildbot seems unable to connect to github...

Multithreading also crashes Tactics Ogre. It happens afaict because the game goes on to muck with the uploaded displaylist data that's probably already cached by the GE (or not written immediately by the CPU...) Blocking prevents this. But I'm not 100% sure. Anyway, it may be the same here.

-[Unknown]

GamerzHell9137 commented 10 years ago

Have seen couple of issues in the game so i made some pics and a video to show them

https://www.youtube.com/watch?v=Ux-VMYgEGT8

Flickering Textures occur only in Chocobo Farm Blue Line only in Chocobo Farm Flickering Shadows only on the right side of Terrace Place; Left side is fine White Backgroud occurs while changing Day/NIght time or weather changes(I'm not 100% sure if that's the reason)

Blurred Background and Flickering during scenes http://puu.sh/9lPyc/ef3ef26803.jpg Haven't caught it on video, gonna update once i get it

Multithread breaks the game(PPSSPP crashes)

PPSSPP Revision: v0.9.8-1088-ga31194a

hrydgard commented 10 years ago

Thanks, savestates would be useful to debug specific graphical issues.

hrydgard commented 10 years ago

Blue line on chocobo farm seems likely to be related to #4617

unknownbrackets commented 10 years ago

Note that FF3 has a similarish problem (#2921) that afaik is not related to coordinate accuracy.

Blade Dancer also has these weird flickering things, but they flicker only as you move (that I've seen.)

-[Unknown]

hrydgard commented 10 years ago

The weird flickering things, and the flickering shadows, look like Z-fighting. Could either be broken geometry or differences in coordinate accuracy, causing two draws that were just far enough apart to not fight to do so (or lack of support for Z-bias, I don't remember if PSP has that).

trickmealz commented 10 years ago

Hi. I've been attempting to play the patched game on the latest build for -Android- Tegra 4 chip.

My limited time (up to breaking the engine or whatever) with the game at buffered rendering, various frameskips, simulated block on/off, multi-thread on/off reveals the following issues:

-White shadows akin to the old Windows builds, or square shadows if non-buffered (which also produces the smoothest FPS btw) -Artifacts on characters, or making the models look freaky with overlapping/messed up textures -No FMV playing, but being asked to skip if I want to -I assume after defeating an enemy/group of enemies there is a victory graphic(?) that makes the screen black out also present on Windows -I don't know if it's a game bug or related to emulator, but after defeating an enemy before breaking the engine of the ship there was an enemy on a platform hilariously merged with the wall, frozen

I'd also like note, again on Android, Nvidia Shield with Tegra 4 chip, the scene with the soldiers getting sucked up into the giant ???? boss runs perfectly if frame skip is enabled with auto checked.

LunaMoo commented 10 years ago

I'm using v0.9.8-1101-gd388798 win x64 and didn't experienced any of those issues. At least from what I'm checking right now I didn't saw any blue line, there is no texture flicker on chocobo farm either shadow on the terrace are fine as well.

Here's from chocobo farm, tried walking around that place and nothing happened: npjh50443_00009

hrydgard commented 10 years ago

Software vs hardware transform may affect the blue line, can you check?

LunaMoo commented 10 years ago

Hardware transform on/off no difference on my side(except lag without;p).

hrydgard commented 10 years ago

@GamerzHell9137 , can you see if hw/sw transform matters for you on chocobo farm (blue line + flicker)?

GamerzHell9137 commented 10 years ago

@hrydgard Disabling Hardware Transforms fixes the Chocobo Farm issues. The thing is that we lost lot of speed cause of it.

hrydgard commented 10 years ago

Alright. That likely means that OpenGL implementations (GPU drivers) are not consistent in how they treat low-precision (8-bit and 16-bit) coordinates, and we should expand them to float in the vertex decoder manually instead of handing them off as-is to the GPU. Wonder if there will be much of a speed impact doing that...

GamerzHell9137 commented 10 years ago

For some reason the panel here gets blurred too http://puu.sh/9lXRC/66cbfa8e5e.jpg Savestate for that is NPJH50443_1.01_0

White background issue is NPJH50443_1.01_1 Get into battle during the white background to experience it in battle.

Chocobo Farm Blue Line and Flickering Issues is NPJH50443_1.01_2

Link to Savestates: http://www34.zippyshare.com/v/41392042/file.html (Download it as fast as possible, don't know how long is it gonna be on zippyshare)

Ohh and the 60 FPS code

_S NPJH-50443 _G Final Fantasy Type 0(Disc1) _C1 60 FPS _L 0x20008868 0x00000000

During battles when effects happen like bursts of fire and effects when the battle starts and ends the frames drop from 60>40 and the sounds distorted and the game lags, not sure if its cause of the code or PPSSPP issue. (Btw the cheat doesn't seem to work in 60FPS, could it be cause the game is merged(Disc1 and 2 are merged in 1) ?

hrydgard commented 10 years ago

The 60fps code doesn't actually work, the game still animates at 30fps just renders each frame twice. So I would recommend not to use it.

hrydgard commented 10 years ago

@GamerzHell9137 , just curious, what GPU do you have?

GamerzHell9137 commented 10 years ago

@hrydgard Nvidia Palit GT630 2 GB

hrydgard commented 10 years ago

@trickmealz , that change should help out a bit, of course may not fix all your issues but the shadows should be right now, at least.

GamerzHell9137 commented 10 years ago

@hrydgard Disabling hardware transformed fixes the shadowsin Terrace Area too but it heavily slows down the game.

LunaMoo commented 10 years ago

I checked two more @GamerzHell9137 problems. Blurr during cutscenes is applied on everything which is not in focus/close to the camera and participate in the dialogue, lots of people might hate any kind of blurr, but to me that looks like a working game feature, not a bug: npjh50443_00012 It's kind of like 2D characters in oldschool rpg's which shows up in the front and rest of the screen is often darkened or blurred, except that it's in 3D here. Didn't had any flickering in any cutscenes I had so I assume that was also hardware transform with nvidia/drivers.

White/foggy screen does happen to me as well after checking those savestates, but it seems completely random, it's enought to walk on the world map between two different locations sometimes it'll show up, sometimes it doesn't even if nothing else changes. Battles are affected only, but always when walking around the map is affected.

solarmystic commented 10 years ago

I think the foggy scenes are intentional, and a part of the battle/world conditions, unless they never appear ingame on the actual PSP, in which case it is most definitely a bug.

I've encountered sunny, rainy and foggy conditions so far in the world map. They look rather normal to me.

GamerzHell9137 commented 10 years ago

@solarmystic The foggy effect is too much applied you can't even seen the battle field cause of it. Doubt that it looks like that on real PSP, i can check it thou with some friends.

And in software rendering the foggy conditions are lot less.

LunaMoo commented 10 years ago

I'll check that white/foggy screen again when I get to that point myself, used savestate from here to check this one, since I don't really want to speedrun this game and talk pretty much with every npc until his dialogue starts repeating;p.

It looks strange mainly because of the circles inside which looks kind of like stretched lens flare or something, but not much of a fog effect: npjh50443_00018 . @solarmystic through maybe you're right that this is just normal fog, in GE debugger this is applied to every texture, like changed by some parameter, it might just looks weird for me, since I never saw a fog in this game on psp:] the circle migh just be the vignette being more visible on the lighter textures.

Oh and that's how rainy day looks: npjh50443_00020 so yeah it's already a bit grayish, ok then so that first one is quite likely a fog, very simple one and ugly, but working. Thanks for pointing it out:].

GeorgeTokarenko commented 10 years ago

What about black screens with videos on Android? Just after you start the new game there`s gotta be a cutscene or something, but you get the black screen only, still you can skip it.

ghost commented 10 years ago

second ingame cutscene/fmv with crashing plane is also black on android.

hrydgard commented 10 years ago

@GeorgeTokarenko @FelixLeon already noted in the top post, I added it a little while ago.

Zukuu commented 10 years ago

Upon approaching the Codex my PPSSPP hangs up. It turns black the sound loops and nothing works - no button, no home/esc, no load save state etc. This happens every time for me.

latest dev build (from yesterday)

unknownbrackets commented 10 years ago

Does 1x/2x affect the white fog? Does opening the pause menu affect it?

-[Unknown]

hrydgard commented 10 years ago

@unknownbrackets no to both questions. BTW if you have the unpatched game you can just load his Gamerzhells' savestate on top of it.

LunaMoo commented 10 years ago

I found something by accident ~ if anyone will come with a transparent background during some cutscenes mixed with background from previous cutscene, just tell him to enable "simulate block transfer" I turned it off while trying to reproduce some issues and forgot to check again:3.

solarmystic commented 10 years ago

@LunaMoo Yeah, I learnt the hard way that "simulate block transfer + function replacements" is pretty much needed for more games than I thought. Which is why they're enabled by default now.

The Read Framebuffers modes can almost be buried now. Almost. To think that the one game that started the ball rolling for those modes (Danganronpa) can now be handled entirely using just Buffered Rendering is amazing stuff.

hrydgard commented 10 years ago

@GamerzHell9137 , just to confirm, you're running with updated drivers right?

unknownbrackets commented 10 years ago

Do the black screen videos happen with both iso and cso?

Maybe we need to explicitly use ftello64/fseeko64 on Android and possibly other systems.

See also: https://code.google.com/p/android/issues/detail?id=64613 http://lists.infradead.org/pipermail/linux-mtd/2012-September/043917.html

-[Unknown]

solarmystic commented 10 years ago

@unknownbrackets Didn't you already resolve this particular issue (videos not playing back on an enlarged ISO file for FFType 0) that I brought to your attention some months ago for Windows?

Iirc it had something to do with the sizes pushed beyond the 2 GB barrier and something else.

hrydgard commented 10 years ago

Ah yes, that seems like a likely explanation.

I found out something about the slowdown at the tutorial boss. The game calls sceKernelDcacheWritebackInvalidateAll() a preposterous number of times per frame (from 100-1000) causing us not just to spend a considerable amount of CPU time in TextureCache::InvalidateAll, but also for some reason to create a ridiculous number of textures (is it modifying palettes too?).

The number of textures shoot up from 110 to 5000 in about 2 seconds, and if you have texture scaling enabled, well, we pretty much grind to a halt. This can't be good for our VRAM usage either, heh.

hrydgard commented 10 years ago

@solarmystic it was solved for most platforms, but the Android NDK has kinda-broken 64-bit file support, it seems.

unknownbrackets commented 10 years ago

Hmm, sceKernelDcacheWritebackInvalidateAll() does already eat cycles per some tests. Some ideas:

-[Unknown]

hrydgard commented 10 years ago

There, that takes care of the missing videos.

I'll look in to the texture cache problems tomorrow or later this week. Thanks for the pointers.

Enabling the secondary texture cache does not seem to help very much ..

unknownbrackets commented 10 years ago

No, it would only hurt because it would keep around even more textures probably.

-[Unknown]

some1new2 commented 10 years ago

For me it constantly crashing after the bridge (a third scene?) http://imgur.com/59BzqHa that's when I use a newer builds from buildbot, gold from play store - no crashes. Update: that's weird after I've successfully loaded scene with gold and made savestate I'm able to load this savestate with a newer revision build, where it always crashed.. http://imgur.com/kdsbjBq

GamerzHell9137 commented 10 years ago

@hrydgard 335.23, the new drivers don't add any new stuff ( other than Shadow Play fixes ) but i'll update it now

@unknownbrackets Looks same on 1x 2x resolution and cause the game is still active even on the start menu i guess we couldn't see it in game. But why is the fog effect much bigger in Buffered Rendering than in Software Rendering mode? And in Non Buffered Rendering its even more.

GamerzHell9137 commented 10 years ago

Ahhh, it seems the fog is real. Whao, it looks... really bad tbh..

https://www.youtube.com/watch?v=C5eXI0ePIAk 4:43

unknownbrackets commented 10 years ago

Hmm, it looks super strong in that gameplay video. Would you say it matches softgpu or buffered rendering better? It seems like it matches your video decently.

-[Unknown]

solarmystic commented 10 years ago

As I suspected, the fog is used as a gameplay mechanic to make enemy battlefield encounters on the world map a lot more challenging. I notice that the target lock on range is also reduced with poor visibility.

So if we're emulating it correctly as the original PSP does, I'd say there is nothing to be fixed there. Removing it would be a "cheat" and not being faithful to the original game.

trickmealz commented 10 years ago

Playing this on the latest Windows 64bit build, I have noticed random crashes when a screen transitions to another. Like two FMVs will play in a row (i believe the chapter 2 part about the ultima bomb), but then a transition to an in-game gameplay part/cut scene and the emulator freaks out and crashes. Skipping the various scenes the emulator crashed on allows me to proceed further, but then crashes anyway. I'm using a GTX 770 with latest drivers. I know the emulator is going to crash hard when my fans ramp up to full speed. I'm using default settings but with frameskip set to 1 and auto, rendering resolution 2x.

GamerzHell9137 commented 10 years ago

@solarmystic I don't see it as a cheat if it were removed. For me it doesn't make it Challenge-y, its just annoying to not to see the enemies in battle/map.

@unknownbrackets I would rather the fog of Software Rendering, its less and its still there and its possible to see the battleground during gameplay.

daniel229 commented 10 years ago

Starocean crashes with MT when screen transition either. 01

lawsongrey commented 10 years ago

@Zukuu experiencing same issue.

Playing on windows 7, latest build, when I click on the codex the screen goes dark and the music speeds up as if Turbo was activated, and then it just hangs with the music sped up. I have to close out of ppsspp and go back in to continue playing a previous point.

GamerzHell9137 commented 10 years ago

@lawsongrey Is Codex that book in the library? I've been using the latest revision too and it works fine for me. Windows 7 64 bit

image