Skip to content

Conversation

@israpps
Copy link
Contributor

@israpps israpps commented Oct 2, 2025

Before this change, every time mcdetectcard was called from libmc over an unformatted card, the mcsync return value was -2

It should have been -2 if a new unformatted card was inserted since las call, and 0 if the same card remains plugged

fixes #785

Only tested on emulator so far...

For refence, here you have other instances of this code:

Soulcalibur2 DONGLEMAN.IRX:

int mcman_probePS2Card(int param_1,int param_2)

{
  undefined4 uVar1;
  int r;
  int iVar2;
  
  WaitSema(sema_hakama);
  mcman_55_retval = 0xff;
  r = mcman_cardchanged(param_1,param_2);
  if ((r == 0) && (r = McGetFormat(param_1,param_2), r != 0)) {
    if (param_1 == 0) {
      uVar1 = mcman_getcnum(0,param_2);
      SecrAuthDongle(2,param_2,uVar1);
    }
    SignalSema(sema_hakama);
    r = 0;
  } else {
...........
  }
  return r;

SCPH-50001/N rom0:XMCMAN:

int mcman_probePS2Card(int port,int slot)
{
  int iVar1;
  int iVar2;
  undefined4 uVar3;
  
  iVar1 = mcman_cardchanged();
  if ((iVar1 == 0) && (iVar1 = McGetFormat(port,slot), iVar1 != 0)) {
    return 0;
  }
  iVar2 = mcman_resetauth(port,slot);
  iVar1 = -0xb;
  ......

@sp193
Copy link
Member

sp193 commented Oct 2, 2025

Could this be linked to this change within commit 8161284?

8161284#diff-1ec248a428f847eadfae186e29b3ecfe33fa22910461227cac5db73fc604430dL856-R866

@israpps
Copy link
Contributor Author

israpps commented Oct 2, 2025

seems to be....

@uyjulian

@sp193
Copy link
Member

sp193 commented Oct 2, 2025

So anyway. If the official code is always like what you've found, I think there's no need to comment out the code; just make the change with confidence and Git will track the changes. But perhaps you might want to restore the original behaviour that:

  1. Logged the outcome.
  2. Returned sceMcResSucceed instead of 0.

Thanks for looking into this.

Before this change, every time mcdetectcard was called from libmc over an unformatted card, the mcsync return value was -2

It should have been -2 if a new unformatted card was inserted since las call, and 0 if the same card remains plugged
Copy link
Member

@uyjulian uyjulian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@uyjulian uyjulian merged commit 6e1c57b into ps2dev:master Oct 2, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MCMAN/MCSERV]: mcGetInfo always returns -2 when accessing an unknown format card

3 participants