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

IMP sceKernelFindModuleByUID and sceKernelFindModuleByName. #13592

Merged
merged 3 commits into from
Oct 28, 2020

Conversation

shenweip
Copy link
Contributor

This should help some patched games like #13205, #13204. I think @sum2012 would be interested in this.

@sum2012 sum2012 added the HLE/Kernel Kernel, memory manager, other HLE issues label Oct 27, 2020
pnm += 0x30;
ptemp += 0x30;
memcpy(pnm, ptemp, 0xC0 - 0x2C);
}
Do(p, memoryBlockAddr);
Copy link
Contributor

@aliaspider aliaspider Oct 27, 2020

Choose a reason for hiding this comment

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

why not just put modid last in NativeModule to keep the struct backwards compatible and avoid this hack ? or is NativeModule something the real PSP OS uses and it just had wrong offsets before ?

Copy link
Contributor Author

@shenweip shenweip Oct 27, 2020

Choose a reason for hiding this comment

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

NativeModule is a native struct of PSP, its members have fixed order(offset).

Copy link
Contributor

Choose a reason for hiding this comment

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

ok I see.
why are you increasing both pnmand ptemp by 0x30 though ? shouldn't ptempbe increased by 0x2C instead ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, thanks.

Copy link
Owner

Choose a reason for hiding this comment

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

Turns out the math was wrong - have to cast the pointers to bytes first :)

Fixed in 2f4dfed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops again, thanks:p

@sum2012 sum2012 added this to the v1.11.0 milestone Oct 27, 2020
@sum2012
Copy link
Collaborator

sum2012 commented Oct 27, 2020

Well done @shenweip
jpcsp use 3 tables to make conversion
https://github.com/jpcsp/jpcsp/blob/master/src/jpcsp/HLE/kernel/managers/ModuleManager.java
But we have another method

@sum2012
Copy link
Collaborator

sum2012 commented Oct 27, 2020

Well done @shenweip Fixed #13205 #13204

I just want a small change
INFO_LOG(SCEMODULE, "sceKernelFindModuleByUID(%d)", uid); change to
INFO_LOG(SCEMODULE, "%d = sceKernelFindModuleByUID(%d)", module->modulePtr, uid);

@hrydgard hrydgard merged commit f4b2811 into hrydgard:master Oct 28, 2020
hrydgard added a commit that referenced this pull request Oct 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HLE/Kernel Kernel, memory manager, other HLE issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants