Closed kcpants closed 1 year ago
I triggered this bug by launching a gba game using mgba and then exiting. I'm not sure if it is reproducible.
Can't reproduce this.
I have also not been able to reproduce it since it occurred. I think this is one of those bugs that would need to be solved by code inspection. If someone was motivated, a good way to start would probably be to figure out where wiiflow writes GBA.INPUT.DRCU
etc to a file and work backward to find the file descriptor its writing to then try to find ways that file descriptor may not be pointing to the correct file.
I think this is one of those bugs that would need to be solved by code inspection.
I agree with you there. However, as far as I can see in the source code, it is not WFL that writes these values.
FYI Config::load
and Config::close
do close the file stream.
as far as I can see in the source code, it is not WFL that writes these values.
Interesting! I wonder how mGBA decides which file / path to write this input configuration to (assuming the input configuration is written by mGBA). If the location of the inputs file is passed as an argument when mGBA is launched I suppose it's possible that wiiflow passed the path to source_menu.ini
by mistake.
The other strange part about this is that the first block of the overwritten file (first 5 lines [copied below]) are formatted like a valid source_menu.ini
file so it's as if whichever process overwrote the rest of the file seek'ed to line 6 before writing.
[BUTTON_0]
hidden=no
source=
title=button_0
If the location of the inputs file is passed as an argument when mGBA is launched I suppose it's possible that wiiflow passed the path to source_menu.ini by mistake.
Please edit sd:/apps/wiiflow/wiiflow_lite.ini
and set sd_write_log
to yes
. Repeat your tests. Check sd:/wiiflow.log
.
The other strange part about this is that the first block of the overwritten file...
The only explanation that spontaneously comes to mind would be a corrupt file system. Could you please check this.
Luckily, I already had sd_write_log
set to yes
from when I was debugging an earlier issue. My wiiflow.log
file is fairly long since logging has been enabled for some time (it would be helpful to add timestamps to the log output in the future) but I believe this is the output that corresponds to the run when the source_menu.ini
file was overwritten:
Welcome to WiiFlow WFL 5.5.3!
This is the debug output.
Real Wii
AHBPROT disabled = yes
IOS58 v6176
Found WiiFlow Save
Loading IOS Settings from wiiflow save
Using Port Settings from wiiflow save
AHBPROT disabled after IOS Reload: yes
Now using D2X IOS249[57] v10
FAT Partition at sd: mounted.
Changing USB port to port 0....
* * * * * * * * * * * *
* HDD Information
* Sectors: 31116287
* Size [Sector Size]: 14 GB [512]
* * * * * * * * * * * *
FAT Partition at usb1: mounted.
Wiiflow boot.dol Location: sd:/apps/wiiflow
Data Directory: sd:/wiiflow
Setting Wii games partition to: 0
Wii Games Directory: %s:/wbfs
GameCube Games Directory: %s:/games
Nintendont found
emunand = usb1:/nands/pl_us
savesnand = sd:/nands/saves
Running sound thread
Loading cIOS map
Found d2x base 57 in slot 249
Found d2x base 56 in slot 250
Found d2x base 38 in slot 251
Bootup completed!
Creating Gamelist
Adding plugins list
Games found: 347
Displaying covers
Launching game PLUGIN
launching plugin app
Cleanup Coverflow
Stopping sound thread
Stopped sound thread
MEM1_freesize(): 8278000
MEM2_freesize(): 40989440
app argument: sd:/roms/gba/Broken Sword - The Shadow of the Templars (USA).gba
Welcome to WiiFlow WFL 5.5.3!
This is the debug output.
Real Wii
AHBPROT disabled = yes
IOS58 v6176
Found WiiFlow Save
Loading IOS Settings from wiiflow save
Using Port Settings from wiiflow save
AHBPROT disabled after IOS Reload: yes
Now using D2X IOS249[57] v10
FAT Partition at sd: mounted.
Changing USB port to port 0....
* * * * * * * * * * * *
* HDD Information
* Sectors: 31116287
* Size [Sector Size]: 14 GB [512]
* * * * * * * * * * * *
FAT Partition at usb1: mounted.
Wiiflow boot.dol Location: sd:/apps/wiiflow
Data Directory: sd:/wiiflow
Setting Wii games partition to: 0
Wii Games Directory: %s:/wbfs
GameCube Games Directory: %s:/games
Nintendont found
emunand = usb1:/nands/pl_us
savesnand = sd:/nands/saves
Running sound thread
Loading cIOS map
Found d2x base 57 in slot 249
Found d2x base 56 in slot 250
Found d2x base 38 in slot 251
Bootup completed!
Creating Gamelist
Adding plugins list
Games found: 347
Displaying covers
Displaying covers
Cleanup Coverflow
Stopping sound thread
Stopped sound thread
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
After the mGBA plugin is launched and exited, a series of NULL bytes appears at the end of the log output corresponding to the next wiiflow run. In my text editor it looks like this:
To check for filesystem corruption, I ran chkdsk
on both my SD card and my USB drive. The SD card was clean (free of errors) but the USB drive (which I use for emunand) did have some errors. However, it's not clear whether they are the cause of this issue or not since the source_menu.ini
file resides on the SD card. I've attached chkdsk
screenshots for reference.
Based on the data in this page, the cross-linked savedata.bin
file in the 4a414445
directory corresponds to title "JADE".
Just wanted to reiterate that I don't need a fix for this and mainly filed the issue in order to document the contents of the overwritten source_menu.ini
file so I would have a starting point for debugging the problem in case it happens again.
My
wiiflow.log
file is fairly long
Does it contain where mGBA is called and what arguments are logged?
Does it contain where mGBA is called and what arguments are logged?
Yes. My original comment did not include the correct section of the log. I've updated the comment to fix the error. Based on the new log output, it looks like mGBA only received the path of the game ROM to launch as an argument which rules out wiiflow passing the path to the source_menu.ini
file by mistake.
At this point I'm happy with the diagnostic info gathered and documented in this issue and don't plan to continue investigating unless my source_menu.ini
is overwritten again. If the problem does happen again I'll post more info here.
Describe the bug After launching and closing a gba game the wiiflow source menu vanished. I plugged my sd card into my pc and opened up the
source_menu.ini
file and found that its contents had been overwritten with what appears to be text from an input file. I've included the new contents of the file below for reference:To Reproduce I triggered this bug by launching a gba game using mgba and then exiting. I'm not sure if it is reproducible.
What version of WiiFlow Lite v5.5.3
On Wii or Wii U vWii This occurred on my Wii (not on Wii U)
I have a backup of
source_menu.ini
so I don't need a fix for this (assuming it doesn't reoccur regularly). Based on the symptoms, it looks like wiiflow is writing data to the wrong file descriptor (perhaps the file descriptor pointing to thesource_menu.ini
file is not being closed properly).