Skip to content

Commit

Permalink
VMC over SMB seems to get corrupted by some games. Reverting the shif…
Browse files Browse the repository at this point in the history
…ting of smb_Disconnect() from DeviceDeinit() to DeviceUnmount() seems to prevent this.

It may be also related to the IOP reboot, since this function is called from the _exit() function, which is called when the module is unloaded (before IOP reboots etc).
Related to commit 8dbaaae.
  • Loading branch information
sp193 committed Nov 1, 2019
1 parent 81a94ed commit 850b6da
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion modules/iopcore/cdvdman/device-smb.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ void DeviceInit(void)
}

void DeviceDeinit(void)
{
{ // Close all files and disconnect before IOP reboots. Note that this seems to help prevent VMC corruption in some games.
DeviceUnmount();
}

void DeviceFSInit(void)
Expand Down
15 changes: 11 additions & 4 deletions modules/iopcore/cdvdman/smb.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static server_specs_t server_specs;
#define NTLM_AUTH 1

static u16 UID, TID;
static int main_socket;
static int main_socket = -1;

static struct {
//Direct transport packet header. This is also a NetBIOS session header.
Expand Down Expand Up @@ -794,17 +794,24 @@ int smb_ReadCD(unsigned int lsn, unsigned int nsectors, void *buf, int part_num)

void smb_CloseAll(void)
{
int i;
int i, fd;

for (i = 0; i < cdvdman_settings.common.NumParts; i++) {
smb_Close(cdvdman_settings.FIDs[i]);
fd = cdvdman_settings.FIDs[i];
if (fd >= 0) {
smb_Close(fd);
cdvdman_settings.FIDs[i] = -1;
}
}
}

//-------------------------------------------------------------------------
int smb_Disconnect(void)
{
plwip_close(main_socket);
if (main_socket >= 0) {
plwip_close(main_socket);
main_socket = -1;
}

return 1;
}

0 comments on commit 850b6da

Please sign in to comment.