libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.31k stars 1.84k forks source link

(Menu) History list entries messes up #6913

Closed andres-asm closed 2 years ago

andres-asm commented 6 years ago

First and foremost consider this:

Description

Sometimes history entries get messed up, I think it may be when you load the same game with many cores, for testing, then it all gets screwy. For example my current history list:

/storage/emulated/0/RetroArch/downloads/Commander Keen 5 -  The Armageddon Machine (1991)/CKeen5/KEEN5E.EXE

/data/data/com.retroarch/cores/dosbox_libretro_android.so
DOSBox

/storage/emulated/0/RetroArch/downloads/Legend of Zelda, The - Link's Awakening DX (USA, Europe) (SGB Enhanced) (GB Compatible).zip#Legend of Zelda, The - Link's Awakening DX (USA, Europe) (SGB Enhanced) (GB Compatible).gbc

/data/data/com.retroarch/cores/sameboy_libretro_android.so
SameBoy

/storage/emulated/0/RetroArch/downloads/Donkey Kong Country (USA).zip#Donkey Kong Country (USA).sfc

/data/data/com.retroarch/cores/snes9x_libretro_android.so
Snes9x

/storage/emulated/0/RetroArch/downloads/Advance Wars (USA) (Wii U Virtual Console).zip#Advance Wars (USA) (Wii U Virtual Console).gba

/data/data/com.retroarch/cores/mgba_libretro_android.so
mGBA

/storage/emulated/0/RetroArch/downloads/Mario & Luigi - Superstar Saga (USA, Australia).zip#Mario & Luigi - Superstar Saga (USA, Australia).gba
Mega Man Zero (USA, Europe)
/data/data/com.retroarch/cores/mgba_libretro_android.so
mGBA

/storage/emulated/0/RetroArch/downloads/Kirby Super Star (USA).zip#Kirby Super Star (USA).sfc
Mega Man Zero (USA, Europe)
/data/data/com.retroarch/cores/snes9x_libretro_android.so
Snes9x

/storage/emulated/0/RetroArch/downloads/Super Mario RPG - Legend of the Seven Stars (USA).zip#Super Mario RPG - Legend of the Seven Stars (USA).sfc
Mega Man Zero (USA, Europe)
/data/data/com.retroarch/cores/snes9x_libretro_android.so
Snes9x

/storage/emulated/0/RetroArch/downloads/Mega Man X (USA) (Rev 1).zip#Mega Man X (USA) (Rev 1).sfc
Mega Man X (USA) (Rev 1)
/data/data/com.retroarch/cores/snes9x_libretro_android.so
Snes9x

/storage/emulated/0/RetroArch/downloads/Mega Man Zero 2 (USA).zip#Mega Man Zero 2 (USA).gba
Mega Man Zero (USA, Europe)
/data/data/com.retroarch/cores/mgba_libretro_android.so
mGBA

/storage/emulated/0/RetroArch/downloads/Mega Man Zero 2 (USA).zip#Mega Man Zero 2 (USA).gba
Mega Man Zero (USA, Europe)
/data/data/com.retroarch/cores/vbam_libretro_android.so
VBA-M

/storage/emulated/0/RetroArch/downloads/Mega Man X2 (USA).zip#Mega Man X2 (USA).sfc
Mega Man Zero (USA, Europe)
/data/data/com.retroarch/cores/snes9x_libretro_android.so
Snes9x

/storage/emulated/0/RetroArch/downloads/Mario Paint (Japan, USA).zip#Mario Paint (Japan, USA).sfc

/data/data/com.retroarch/cores/snes9x_libretro_android.so
Snes9x

/storage/emulated/0/RetroArch/downloads/Super Scope 6 (USA).zip#Super Scope 6 (USA).sfc

/data/data/com.retroarch/cores/snes9x_libretro_android.so
Snes9x

/storage/emulated/0/RetroArch/downloads/Chrono Trigger (USA) (En,Fr).zip#Chrono Trigger (USA) (En,Fr).nds

/data/data/com.retroarch/cores/desmume_libretro_android.so
DeSmuME

/storage/emulated/0/RetroArch/downloads/Top Gear 3000 (USA).zip#Top Gear 3000 (USA).sfc
Mega Man Zero (USA, Europe)
/data/data/com.retroarch/cores/snes9x_libretro_android.so
Snes9x

/storage/emulated/0/RetroArch/downloads/Lost Vikings 2 (USA).zip#Lost Vikings 2 (USA).sfc
Mega Man Zero (USA, Europe)
/data/data/com.retroarch/cores/snes9x_libretro_android.so
Snes9x

/storage/emulated/0/RetroArch/downloads/Ridge Racer (USA) (En,Fr,De,Es,It).cso

/data/data/com.retroarch/cores/ppsspp_libretro_android.so
PPSSPP

/storage/emulated/0/RetroArch/downloads/Lumines II (USA).cso

/data/data/com.retroarch/cores/ppsspp_libretro_android.so
PPSSPP

/storage/emulated/0/RetroArch/downloads/FIFA Street 2 (USA) (v1.01).cso

/data/data/com.retroarch/cores/ppsspp_libretro_android.so
PPSSPP

/storage/emulated/0/RetroArch/downloads/Crisis Core - Final Fantasy VII (USA).cso
Super Mario World (USA)
/data/data/com.retroarch/cores/ppsspp_libretro_android.so
PPSSPP

/storage/emulated/0/RetroArch/downloads/Mega Man Zero (USA, Europe).zip#Mega Man Zero (USA, Europe).gba

/data/data/com.retroarch/cores/vbam_libretro_android.so
VBA-M

/storage/emulated/0/RetroArch/downloads/Super Mario Advance 4 - Super Mario Bros. 3 (USA) (Wii U Virtual Console).zip#Super Mario Advance 4 - Super Mario Bros. 3 (USA) (Wii U Virtual Console).gba
Mega Man Zero (USA, Europe)
/data/data/com.retroarch/cores/mgba_libretro_android.so
mGBA

/storage/emulated/0/RetroArch/downloads/Mega Man Zero 3 (USA).zip#Mega Man Zero 3 (USA).gba
Mega Man Zero (USA, Europe)
/data/data/com.retroarch/cores/mgba_libretro_android.so
mGBA

/storage/emulated/0/RetroArch/downloads/Metal Gear Solid - Peace Walker (USA) (En,Fr,Es) (v1.01).cso

/data/data/com.retroarch/cores/ppsspp_libretro_android.so
PPSSPP

/storage/emulated/0/RetroArch/downloads/sfa3.zip

/data/data/com.retroarch/cores/fbalpha_libretro_android.so
FB Alpha

/storage/emulated/0/RetroArch/downloads/Contra (USA).zip#Contra (USA).nes
Super Mario Bros. (World)
/data/data/com.retroarch/cores/fceumm_libretro_android.so
FCEUmm

/storage/emulated/0/RetroArch/downloads/Super Mario Bros. (World).zip#Super Mario Bros. (World).nes
Super Mario Bros. (World)
/data/data/com.retroarch/cores/fceumm_libretro_android.so
FCEUmm

/storage/emulated/0/Download/Pokemon - HeartGold Version (USA).zip#Pokemon - HeartGold Version (USA).nds

/data/data/com.retroarch/cores/desmume_libretro_android.so
DeSmuME

/storage/emulated/0/Download/Pokemon - HeartGold Version (USA).zip#Pokemon - HeartGold Version (USA).nds

/data/data/com.retroarch/cores/melonds_libretro_android.so
melonDS

/storage/emulated/0/Download/Super Mario 64 DS (USA) (Rev 1).zip

/data/data/com.retroarch/cores/desmume_libretro_android.so
DeSmuME

/storage/emulated/0/RetroArch/downloads/Super Mario World (USA).zip#Super Mario World (USA).sfc
Super Mario World (USA)
/data/data/com.retroarch/cores/snes9x_libretro_android.so
Snes9x

/storage/emulated/0/RetroArch/downloads/Super Mario Land 2 - 6 Golden Coins (USA, Europe).zip#Super Mario Land 2 - 6 Golden Coins (USA, Europe).gb
Super Mario Land 2 - 6 Golden Coins (USA, Europe)
/data/data/com.retroarch/cores/gambatte_libretro_android.so
Gambatte

/storage/emulated/0/RetroArch/downloads/Legend of Zelda, The - Link's Awakening DX (USA, Europe) (SGB Enhanced) (GB Compatible).zip#Legend of Zelda, The - Link's Awakening DX (USA, Europe) (SGB Enhanced) (GB Compatible).gbc
Legend of Zelda, The - Link's Awakening DX (USA, Europe) (SGB Enhanced) (GB Compatible)
/data/data/com.retroarch/cores/gambatte_libretro_android.so
Gambatte

/storage/emulated/0/RetroArch/downloads/Mario vs. Donkey Kong (USA, Australia).zip#Mario vs. Donkey Kong (USA, Australia).gba
Mario vs. Donkey Kong (USA, Australia)
/data/data/com.retroarch/cores/mgba_libretro_android.so
mGBA

/storage/emulated/0/RetroArch/downloads/Cave Story/Doukutsu.exe
Cave Story (En)
/data/data/com.retroarch/cores/nxengine_libretro_android.so
NXEngine

/storage/emulated/0/RetroArch/downloads/Super Mario All-Stars (USA).zip#Super Mario All-Stars (USA).sfc
Super Mario All-Stars (USA)
/data/data/com.retroarch/cores/snes9x_libretro_android.so
Snes9x

In a nutshell:

/storage/emulated/0/RetroArch/downloads/Top Gear 3000 (USA).zip#Top Gear 3000 (USA).sfc
Mega Man Zero (USA, Europe)
/data/data/com.retroarch/cores/snes9x_libretro_android.so
Snes9x

/storage/emulated/0/RetroArch/downloads/Lost Vikings 2 (USA).zip#Lost Vikings 2 (USA).sfc
Mega Man Zero (USA, Europe)
/data/data/com.retroarch/cores/snes9x_libretro_android.so
Snes9x

As you can see, plenty of entries are messed up as in, they read megaman zero but the rom is not the one indicated

Steps to reproduce the bug

Beats me, no idea, it's hard to tell what triggers it, @bparker06 noticed this too

Bisect Results

[Try to bisect and tell us when this started happening]

Version/Commit

You can find this information under Information/System Information

Environment information

andres-asm commented 6 years ago

@bparker06 mentioned it happened to him when he loaded DKC2 and DKC3, I thought maybe it would be a string_is_equal_fast somewhere not accounting for length but doesn't look like it.

Maybe some memcmp? strstr?

i30817 commented 6 years ago

Something very similar to the scanner too, see https://github.com/libretro/RetroArch/issues/6699 and my speculation of a possible program cause there. Though it makes less sense for the history list.

In short my idea of the scanner SNAFU is that there is a loop where a variable isn't being zero'ed at the start of the loop, something fails but the variable is being treated as if it succeeded because it 'exists' from a previous loop iteration. In the scanner case, the playlist is apparently being built by appending to the start of a list (or similar) because the 'missing' (mismatching) games that appear as DD Crew have the name of a 'later' game on the playlist, which means that later game was processed first.

Rant ensuing if you don't want to read:

fixing these would be unpleasant anyway for me because the games are missing from the database but they're valid (they're the newest split sets, which libretro-database decided not to bother with for some reason in spite of that being the most compact way to organize the mame rom set). I understand that split sets are not complete games but imo retroarch has to stop thinking it needs to verify all the things... just because there are more required files doesn't mean that the scanner can't verify the existence of the 'main' archive files of each game and just not include the bios and devices... In fact if it wasn't for hacks, achievements and netplay (which need crcs), i'd be all over a libretro database that just verified 'dump names' as primary key to metadata. Those have much less false positives and false negatives and are much much faster. Verification is clrmamepro job.

bootsector commented 6 years ago

Having this issue as well. Ubuntu 18.04, RA 1.7.3 built from master.

ghost commented 5 years ago

i found an easy way to recreate this (at least for me)

  1. load any content from history list (fceumm games for me)
  2. let it run for awhile.
  3. close content.
  4. load another game (another NES game for me) using Load Content.
  5. history will now show list for the current loaded content but is taking the name of the last loaded name from history list

Example: open SamuraiShowdown from history. close content. then open StreetFighter using load content... the history will show SamuraiShowdown but this opens StreetFighter

12-30-2018: @fr500 @twinaphex i just recreated the history messed issue. 100% this time even on an empty history list. the game has to be scanned so it is added to playlist. load this game so it adds to the history. exit RA and launch again. launch that game. then launch something else using Load content and load rom that is not on history

inactive123 commented 5 years ago

I can reproduce the issue that @retro-wertz describes here.

I will try to fix this before releasing version 1.7.6.

orbea commented 5 years ago

I think the underlying issue is connected to issue https://github.com/libretro/RetroArch/issues/7997 too. That is where RetroArch doesn't keep track of both the current core and the next loaded core which results in various problems. See comment https://github.com/libretro/RetroArch/issues/7997#issuecomment-453866999 for more discussion.

ghost commented 5 years ago

request to reopen:

Apparently, as of latest commit 5e5c9e4, this can still happen, at least for cd-based titles

requirement:

  1. load a game from playlist (this should make it appear there), then exit retroarch
  2. run RA. run the game from the history list
  3. run another game using load content without closing content first. game MUST be the same system/console, its necessary for this bug to appear that the core to be used must be the same and the core should not be closed.

files tested were .chd and .cue files using mdfn_psx, pcsx (for psx games), supergrafx (for pce-cd games)

i can replicate it 100% using cd-based games hence the example. dunno if this can or cant happen in other combination of steps/cores/files yet.

orbea commented 5 years ago

@bparker06 Maybe this needs to be fixed a little more?

hizzlekizzle commented 5 years ago

Yeah, this seems to have returned...