| View previous topic :: View next topic |
| Author |
Message |
Cpasjuste
Joined: 29 May 2005 Posts: 214
|
Posted: Mon Sep 24, 2007 9:00 am Post subject: |
|
|
Yep its really cool :)
The main problem now is to rewrite all the code of most of my homebrews :/ I still can't understand some strange things while coding for the 3.71, sometime a function work, i remove a printf then nothing work anymore. I have a lot of strange things like this. |
|
| Back to top |
|
 |
mypspdev
Joined: 11 Jul 2007 Posts: 178
|
|
| Back to top |
|
 |
moonlight
Joined: 26 Oct 2005 Posts: 567
|
Posted: Thu Oct 04, 2007 9:57 pm Post subject: |
|
|
And they shouldn't call "kernel partition" to the volatile one too :p
User modules can be loaded there while kernel ones can't, so it is not definitely an appropiate name. |
|
| Back to top |
|
 |
mypspdev
Joined: 11 Jul 2007 Posts: 178
|
Posted: Wed Oct 17, 2007 1:29 am Post subject: |
|
|
I'm trying to investigate on, just as an exercise:
| Code: | void check_RAM()
{
int i;
PspSysmemPartitionInfo pinfo;
for(i = 0; i < 6; i++)
{
memset(&pinfo, 0, sizeof(pinfo));
pinfo.size = sizeof(pinfo);
sceKernelQueryMemoryPartitionInfo(i + 1, &pinfo);
printf( "%u 0x%08x 0x%08x 0x%08x 0x%08x 0x%x", i + 1, pinfo.memsize, pinfo.startaddr, sceKernelPartitionTotalFreeMemSize (i + 1), sceKernelPartitionMaxFreeMemSize (i + 1), pinfo.attr);
}
} |
But it doesn't work properly.
Could please anyone check whet's wrong? thanks in advance |
|
| Back to top |
|
 |
mypspdev
Joined: 11 Jul 2007 Posts: 178
|
Posted: Wed Oct 17, 2007 6:52 am Post subject: |
|
|
Solved:
#step 1 Create a prx under 1.50 kernel
| Code: | #include <pspsdk.h>
#include <pspkernel.h>
#include <pspctrl.h>
#include <string.h>
#include <pspsysmem_kernel.h>
PSP_MODULE_INFO("MyRAMPRX", 0x1006, 1, 1);
PSP_MAIN_THREAD_ATTR(0);
int PTotFreeMemSize(int i)
{
u32 k1;
k1 = pspSdkSetK1(0);
int pttfms=sceKernelPartitionTotalFreeMemSize(i);
pspSdkSetK1(k1);
return pttfms;
}
int PMaxFreeMemSize(int i)
{
u32 k1;
k1 = pspSdkSetK1(0);
int ptmfms=sceKernelPartitionMaxFreeMemSize(i);
pspSdkSetK1(k1);
return ptmfms;
}
PspSysmemPartitionInfo RAMpinfo(int i)
{
u32 k1;
k1 = pspSdkSetK1(0);
PspSysmemPartitionInfo pinfo;
memset(&pinfo, 0, sizeof(pinfo));
pinfo.size = sizeof(pinfo);
sceKernelQueryMemoryPartitionInfo(i, &pinfo);
pspSdkSetK1(k1);
return pinfo;
}
int module_start(SceSize args, void *argp)
{
return 0;
}
int module_stop()
{
return 0;
} |
#step 2: create a main program 3.xx calling RAMprx:
| Code: | #include <pspsdk.h>
#include <pspkernel.h>
#include <pspctrl.h>
#include <string.h>
#include <pspsysmem_kernel.h>
PSP_MODULE_INFO("MyRAMPRXLoader", 0, 1, 0);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);
PSP_HEAP_SIZE_KB(2500);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Functions imported from prx:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int PMaxFreeMemSize(int i);
int PTotFreeMemSize(int i);
PspSysmemPartitionInfo RAMpinfo(int i);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Globals:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Main:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main(){
SceUID modid;
pspDebugScreenInit();
pspDebugScreenPrintf("Eboot test\n");
modid = pspSdkLoadStartModule("MyRAMPRX.prx", PSP_MEMORY_PARTITION_KERNEL);
if (modid < 0){
pspDebugScreenPrintf("Error 0x%08X loading/starting MyRAMPRX.prx.\n", modid);
sceKernelDelayThread(5*1000*1000);
return -1;
}
pspDebugScreenPrintf("Module ID %08X\n", modid);
int i=0;
for (i=1;i<7;i++)
{
int k=PTotFreeMemSize(i);
pspDebugScreenPrintf("Total Free Mem Size - Partition %u 0x%08x ", i, k);
pspDebugScreenPrintf(" \n");
int pmfms=PMaxFreeMemSize(i);
pspDebugScreenPrintf("Max Free Mem Size - Partition %u 0x%08x ",i , pmfms);
pspDebugScreenPrintf(" \n");
PspSysmemPartitionInfo pinfo;
pinfo=RAMpinfo(i);
pspDebugScreenPrintf( "Partition %u - memsize: 0x%08x start addr: 0x%08x attr: 0x%x", i, pinfo.memsize, pinfo.startaddr, pinfo.attr);
pspDebugScreenPrintf(" \n");
}
pspDebugScreenPrintf("Press X to quit\n");
SceCtrlData pad;
while(1){
sceCtrlReadBufferPositive(&pad, 1);
if (pad.Buttons & PSP_CTRL_CROSS){
break;
}
}
sceKernelExitGame();
return 0;
} |
|
|
| Back to top |
|
 |
cloudhunter
Joined: 17 Aug 2006 Posts: 86
|
Posted: Wed Oct 17, 2007 8:16 am Post subject: |
|
|
| Quote: | | #step 1 Create a prx under 1.50 kernel |
I'm no expert, but that is incorrect. I believe you actually make a kernel mode prx.
Cloudy _________________ :) |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Wed Oct 17, 2007 10:37 am Post subject: |
|
|
| cloudhunter wrote: | | Quote: | | #step 1 Create a prx under 1.50 kernel |
I'm no expert, but that is incorrect. I believe you actually make a kernel mode prx.
Cloudy |
Yes. Running in kernel mode does not necessarily mean 1.50 firmware. :) |
|
| Back to top |
|
 |
mypspdev
Joined: 11 Jul 2007 Posts: 178
|
Posted: Wed Oct 17, 2007 4:52 pm Post subject: |
|
|
I apologize for used terminology, but finally it works fine: I have RAM Partition info from Fat and S&L.
It was impossible to do it within 3.xx I needed the prx to be called.
If anybody wants zip file, it's available. |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Wed Oct 17, 2007 4:55 pm Post subject: |
|
|
| Well, it stands to reason that those functions would need to be called from kernel mode seeing as how they return info about kernel mode partitions. They aren't about to give you that info in user mode. :) |
|
| Back to top |
|
 |
|