Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sifcmd.c #164

Merged
merged 1 commit into from
Jan 22, 2021
Merged

Update sifcmd.c #164

merged 1 commit into from
Jan 22, 2021

Conversation

psxdev
Copy link
Member

@psxdev psxdev commented Jan 22, 2021

Fixed support for user land ee sifcmd registering , it was lost i don't know why.

Fixed support for user land ee sifcmd registering , it was lost i don't know why.
@fjtrujy fjtrujy merged commit e8e9edb into ps2dev:master Jan 22, 2021
@sp193
Copy link
Member

sp193 commented Jan 23, 2021

You were supposed to call SifSetCmdBuffer(SifCmdHandlerData_t) first.

@rickgaiser
Copy link
Member

Cross referencing usr_cmd_handlers or nr_usr_handlers would have been enough to see these values already get used, and shows how a user application can/should use them:

SifCmdHandlerData_t *SifSetCmdBuffer(SifCmdHandlerData_t *db, int size)
{
SifCmdHandlerData_t *old;
old = _sif_cmd_data.usr_cmd_handlers;
_sif_cmd_data.usr_cmd_handlers = db;
_sif_cmd_data.nr_usr_handlers = size;
return old;
}

Please leave changes like these open a little longer next time so others can comment before they are committed. 1 or 2 days would be enough I think.

I think we should revert this commit.

@fjtrujy
Copy link
Member

fjtrujy commented Jan 23, 2021

Ok @psxdev can you try the solution proposed over here, if this is working, I will revert the change.

Thanks & sorry

@sp193
Copy link
Member

sp193 commented Jan 23, 2021

If I remember right, we originally had a static buffer of a fixed number of entries, hence the OP's question. I probably changed it to fit the official behaviour because it was undocumented; since the handler buffer size is fixed, one could only use SIFCMD IDs up to the last index, but yet this number is not documented. It was neither possible to reduce its size nor to increase it.

@psxdev
Copy link
Member Author

psxdev commented Jan 23, 2021

you can revert the change however if SifAddCmdHandler is called before set the user buffer it will crash without message

@sp193
Copy link
Member

sp193 commented Jan 30, 2021

That's because the documentation wasn't followed. At least it's possible to get the exception trapped. If we want to make this idiot-proof in the sense that it won't crash, then SifAddCmdHandler should probably be made to do nothing - but then it'll become a silent fail. If we printed an error, then this becomes coupled with some library.

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.

None yet

4 participants