N64 Error Loading PNG for Save State

Issue #31 resolved
snucker created an issue

LOG:

[6/20/2023 3:55:48 PM] The process cannot access the file 'C:\Users\snucker\Downloads\CaVE\1.5 beta\CaVE-v1.5-Alpha1\cache\N-4631_e-suspendpoint1.png' because it is being used by another process.

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
at NSO.Interface.a(StateInfo A_0)

Comments (4)

  1. Dark Akuma

    I have to wonder if you had the latest version for that test. Because… I specifically added code in yesterdays build, just to prevent such a thing. In fact… redundant code to do so in the very function involved. The cache image is loaded into memory, and the memory copy is whats displayed in the UI so the file is released. Further, I have the code do what it can to unload the displayed image copy from the UI before trying to load another. I had this issue while testing and developing last night, which is why I fixed it to that degree.

    So I am completely clueless how it could be happening otherwise.

  2. Dark Akuma

    I literally can’t figure out why this would happen with my code. This is the relevant code.

    private ImageSource GetImage(string key)
    {
        if (States.ContainsKey(key) && !string.IsNullOrEmpty(States[key].CachedImagePath))
        {
            return BitmapFrame.Create(
                new Uri(States[key].CachedImagePath),
                BitmapCreateOptions.None,
                BitmapCacheOption.OnLoad); // <-- This right here ensures that the image is loaded without access issues.
        }
        else
            return new ImageSourceConverter().ConvertFromString("pack://application:,,,/Assets/EmptySaveSlot.png") as ImageSource;
    }
    

    All I can think of beyond the test accidentally being preformed with a earlier version of the CaVE.exe that did not have this change… is that you had something else entirely open that was locking access to the image. Like MSPaint or some image viewer program.

  3. Log in to comment