vitor251093 / KHMelonMix

Kingdom Hearts 358/2 Days - Melon Mix (DS Emulator)
GNU General Public License v3.0
169 stars 7 forks source link

Game Random Freeze when selecting Deck and some mission. #127

Open ivolivari213 opened 1 month ago

ivolivari213 commented 1 month ago

I am experiencing an issue where the game freezes when I select panels or start a mission. This problem does not occur when I emulate the same version using Retroarch melonDS.

KHDays_FM:

https://github.com/vitor251093/KHDays_FM/assets/96542650/452d2ed7-a304-47ee-9747-772c6a94b55a

Retroarch:

https://github.com/vitor251093/KHDays_FM/assets/96542650/bcac3bef-04c4-4f09-b45a-0ce3699b14f6

vitor251093 commented 1 month ago

Are you able to reproduce this bug with this build?

https://github.com/vitor251093/KHDays_FM/actions/runs/9274179028

ivolivari213 commented 1 month ago

Still Have this issue after update the build

vitor251093 commented 1 month ago

Are you using JIT Recompiler with the Melon Mix?

ivolivari213 commented 1 month ago

I'm not using JIT Recompiler, I am able to complete missions without crash now. But apparently the freeze comes to Panels -> Deck 2.

https://github.com/vitor251093/KHDays_FM/assets/96542650/f67b618b-2696-46b5-9ca8-355313b7f4a4

vitor251093 commented 1 month ago

I still can't reproduce this issue. Could you please share a save, or save state, that can reproduce the issue?

ivolivari213 commented 1 month ago

Sure , here the save data

game.zip

vitor251093 commented 1 month ago

Managed to reproduce the bug with the save. Now I need to figure out why that's happening

vitor251093 commented 1 month ago

I've discovered something curious. If I disable the emulator error (it is a manual error, per say) that is causing the freezing, this is the result:

2024-06-03_20-19

I'm unfamiliar with that label though ("Missing some panels")

vitor251093 commented 1 month ago

@ivolivari213 does that label also appears with Retroarch's melonDS?

Ssheph95 commented 1 month ago

I would like to add to this that I am experiencing the same issue still on 0.3.0.

Melon Days.zip

Here's my save file as well. This seems isolated specifically to attempting to save a deck in slot 2, as saving to slot 1 and slot 3 both work correctly.

vitor251093 commented 1 month ago

@Ssheph95 does the bug also not happen to you with RetroArch's melonDS, or other melonDS builds?

If you use the same save, that is

Ssheph95 commented 1 month ago

I haven't used MelonDS prior to playing Days MeonMix, so wasn't able to check on another MelonDS build, but the bug does not occur when using that save (converted for compatibility of course) in DeSmuME. I'll fire up a new save and quick play to the point that panels are unlocked as I do notice we're both near the same block of missions around day 194.

I hadn't tried saving to slot 2 prior, as I had no reason to keep multiple decks. I suspect that much like myself, the "30 kills with limit break" side quest from Xigbar during these days inspired the need for multiple decks. but I want to check if the issue is persistent prior or something specific to perhaps this part of the game, or perhaps the player's rank.

ivolivari213 commented 1 month ago

Hi, this is my retroarch MelonDS image

It wont freeze.

vitor251093 commented 1 month ago

Seems to be connected to those DataAbort calls

https://github.com/melonDS-emu/melonDS/blob/a72b79a55ad2d61811af11b1b911f6af863f66c2/src/CP15.cpp#L870

I will need to analyze this further, to be sure if that's a recent melonDS bug or a Melon Mix bug, and to avoid creating new bugs trying to fix this one

Ssheph95 commented 1 month ago

I did do some footwork. This also occurs in melon core, so it's not something specific to days MelonMix

I also found you can workaround this. If you load the save file in an emulator that allows you to see deck 2, overwrite deck 2, save, and then load the new save file in melon, it allows deck 2 to be selectable again.

This issue seems to be the result of save corruption from some source or another. It appears somewhere through the game (no idea where) bad data got written to where deck 2 should be, causing the abort when trying to view said data.

It seems the "missing panels" dialogue normally occurs if you somehow saved a deck then proceeded to sell portions of what was in it. The game seems to default to this when the data in the deck doesn't result in a "valid configuration" when compared to your existing available panels. Melon takes this a step further and just aborts if the data is "unreadable".