Cores opening irrelevant files on loading

Kernel, Main, Utilities & Applications, Miscellaneous Devices.
NegentropicMan
Posts: 5
Joined: Sat May 30, 2020 12:01 pm
Has thanked: 2 times

Cores opening irrelevant files on loading

Unread post by NegentropicMan »

EDIT: Has been solved, the behavior is caused by "recents" enabled.

Hi everyone,
sorry for using the linux board for this, I am not sure whether this is some issue on the core or on the linux side. @Mods, if this does not belong here, please push it to the correct board.

I'd like to know a few things:
  • Is the behavior described known?
  • Is the behavior described intended (or some "Don't care" side effect which is not worth fixing)
  • Shall I write a bug report and, if yes, against which core or against the Linux image?
Currently I am playing around using inotifywait to watch for OPEN/ACCESS events on roms in order to get from the linux side which rom was loaded by a core (would be helpful e.g. for this thread here: https://misterfpga.org/viewtopic.php?f=29&t=2011).

I expected to see one OPEN event and one (or multiple) ACCESS events as well as one CLOSE_* event on loading a rom in a core.

When I tried this, I got multiple OPEN/ACCESS/CLOSE events for the rom file I tried to load, but also a set of accesses to other roms for the same core. I can handle this in a shell script and filter for the correct file, but I am not sure whether I stumbled about a bug in loading roms.

Example: On opening the rom "Adventure Island II.zip" (my roms are mostly inside zip files, but the same happens on unzipped files) and in parallel monitoring the NES games directory, I get the following output (from a freshly rebooted menu) (annotations after # inside code, interesting stuff begins at "@@@"):

Code: Select all

/root# inotifywait -m /media/fat/games/NES/
Setting up watches.
Watches established.
/media/fat/games/NES/ OPEN boot0.rom # Loading the BIOS
/media/fat/games/NES/ ACCESS boot0.rom # same
/media/fat/games/NES/ CLOSE_NOWRITE,CLOSE boot0.rom # same
/media/fat/games/NES/ OPEN,ISDIR # On opening the "load" menu, directory listing
/media/fat/games/NES/ ACCESS,ISDIR # same
/media/fat/games/NES/ ACCESS,ISDIR # same (why twice?)
/media/fat/games/NES/ CLOSE_NOWRITE,CLOSE,ISDIR # same, directory listing finished
/media/fat/games/NES/ OPEN Adventure Island II.zip # rom/zip was chosen
/media/fat/games/NES/ ACCESS Adventure Island II.zip # same
/media/fat/games/NES/ CLOSE_NOWRITE,CLOSE Adventure Island II.zip # same
/media/fat/games/NES/ OPEN Adventure Island II.zip # The first cycle is for navigating inside the zip file
/media/fat/games/NES/ ACCESS Adventure Island II.zip # ...
/media/fat/games/NES/ CLOSE_NOWRITE,CLOSE Adventure Island II.zip # Inside the zip now in the menu
/media/fat/games/NES/ OPEN Adventure Island II.zip # Chosen the actual rom file in the zip. Seems to be one OPEN/ACCESS/CLOSE cycle for every square filling. Has optimization potential?
/media/fat/games/NES/ ACCESS Adventure Island II.zip # ...
/media/fat/games/NES/ CLOSE_NOWRITE,CLOSE Adventure Island II.zip # ...
/media/fat/games/NES/ OPEN Adventure Island II.zip # ...
/media/fat/games/NES/ ACCESS Adventure Island II.zip # ...
/media/fat/games/NES/ CLOSE_NOWRITE,CLOSE Adventure Island II.zip # ...
/media/fat/games/NES/ OPEN Adventure Island II.zip # ...
/media/fat/games/NES/ ACCESS Adventure Island II.zip # ...
/media/fat/games/NES/ CLOSE_NOWRITE,CLOSE Adventure Island II.zip # ...
/media/fat/games/NES/ OPEN Astyanax.zip # @@@ Why is it accessing another rom now? The chosen rom loaded successfully?!
/media/fat/games/NES/ ACCESS Astyanax.zip # ...
/media/fat/games/NES/ CLOSE_NOWRITE,CLOSE Astyanax.zip
/media/fat/games/NES/ OPEN Adventure Island.zip
/media/fat/games/NES/ ACCESS Adventure Island.zip
/media/fat/games/NES/ CLOSE_NOWRITE,CLOSE Adventure Island.zip
/media/fat/games/NES/ OPEN dpadhero2.zip
/media/fat/games/NES/ ACCESS dpadhero2.zip
/media/fat/games/NES/ CLOSE_NOWRITE,CLOSE dpadhero2.zip
/media/fat/games/NES/ OPEN dpadhero.zip
/media/fat/games/NES/ ACCESS dpadhero.zip
/media/fat/games/NES/ CLOSE_NOWRITE,CLOSE dpadhero.zip
/media/fat/games/NES/ OPEN Trolls in Crazyland, The.zip
/media/fat/games/NES/ ACCESS Trolls in Crazyland, The.zip
/media/fat/games/NES/ CLOSE_NOWRITE,CLOSE Trolls in Crazyland, The.zip
/media/fat/games/NES/ OPEN Vice - Project Doom.zip
/media/fat/games/NES/ ACCESS Vice - Project Doom.zip
/media/fat/games/NES/ CLOSE_NOWRITE,CLOSE Vice - Project Doom.zip
/media/fat/games/NES/ OPEN Wacky Races.zip
/media/fat/games/NES/ ACCESS Wacky Races.zip
/media/fat/games/NES/ CLOSE_NOWRITE,CLOSE Wacky Races.zip
/media/fat/games/NES/ OPEN Werewolf - The Last Warrior.zip
/media/fat/games/NES/ ACCESS Werewolf - The Last Warrior.zip
/media/fat/games/NES/ CLOSE_NOWRITE,CLOSE Werewolf - The Last Warrior.zip
/media/fat/games/NES/ OPEN Where in Time Is Carmen Sandiego.zip
/media/fat/games/NES/ ACCESS Where in Time Is Carmen Sandiego.zip
/media/fat/games/NES/ CLOSE_NOWRITE,CLOSE Where in Time Is Carmen Sandiego.zip
/media/fat/games/NES/ OPEN Wizards & Warriors III - Kuros. Visions of Power.zip
/media/fat/games/NES/ ACCESS Wizards & Warriors III - Kuros. Visions of Power.zip
/media/fat/games/NES/ CLOSE_NOWRITE,CLOSE Wizards & Warriors III - Kuros. Visions of Power.zip
/media/fat/games/NES/ OPEN Wrecking Crew.zip
/media/fat/games/NES/ ACCESS Wrecking Crew.zip
/media/fat/games/NES/ CLOSE_NOWRITE,CLOSE Wrecking Crew.zip
/media/fat/games/NES/ OPEN Wurm - Journey to the Center of the Earth!.zip
/media/fat/games/NES/ ACCESS Wurm - Journey to the Center of the Earth!.zip
/media/fat/games/NES/ CLOSE_NOWRITE,CLOSE Wurm - Journey to the Center of the Earth!.zip
/media/fat/games/NES/ OPEN Xexyz.zip
/media/fat/games/NES/ ACCESS Xexyz.zip
/media/fat/games/NES/ CLOSE_NOWRITE,CLOSE Xexyz.zip
/media/fat/games/NES/ OPEN Yoshi.zip
/media/fat/games/NES/ ACCESS Yoshi.zip
/media/fat/games/NES/ CLOSE_NOWRITE,CLOSE Yoshi.zip
As you can see, after successfully loading the rom I chose, other rom files were accessed. The files accessed are not all files in the directory and I cannot determine why they were accessed and why exactly these were accessed. I tried to search for the code loading files, but am lost in which repositry the linux binaries reside.

Some additional information:
  • I tried this with the NES, the SNES and the Mega Drive/Genesis core, same behaviour for all.
  • The randomly accessed files are always roms which are either in the same directory as the loaded rom or in a sub-directory.
  • The files are always a subset of all files.
  • I use a separate folder structure under /media/fat/games for my roms.
  • NES core used is version 20210114.
  • SNES core used is version 20210121.
  • Genesis core used is version 20210105.
I would appreciate any answer here.

As a last thing, I want to say thanks for the awesome piece of computing machinery called MiSTer. It helps me to get to play all the consoles my family was not able to afford when I was a little kid.

Regards, NegentropicMan

Steps to reproduce:
  • Have a core with multiple roms
  • # inotifywait -m /media/fat/games/ -r
  • Load the core
  • Load a rom
  • Read the output and scratch your head (Ok, not strictly necessary)
ExCyber
Posts: 232
Joined: Sun May 24, 2020 3:33 pm
Has thanked: 12 times
Been thanked: 77 times

Re: Cores opening irrelevant files on loading

Unread post by ExCyber »

I don't see this behavior in my setup. Do you have the "recents" feature enabled? That code seems to check whether files still exist whenever updating the list, and if the file in question is within a zip file, checking for the file's existence requires at least reading the zip index, not just a stat().
NegentropicMan
Posts: 5
Joined: Sat May 30, 2020 12:01 pm
Has thanked: 2 times

Re: Cores opening irrelevant files on loading

Unread post by NegentropicMan »

Yes, thanks, I have recents enabled. That explains it.
Post Reply