• Steam recently changed the default privacy settings for all users. This may impact tracking. Ensure your profile has the correct settings by following the guide on our forums.

PSP-Filer Suggestions

palyons

New Member
Well this is honestly a surprise :/. None of the apps I found at dl.qj.net have provided the source code, yet they do claim to flash themes on a 3.XX/4.XX kernel. If I am able to find the source code of any 3.XX/4.XX kernel apps that do the job, I will let you know. But there is one thing I do remember reading about...

If I recall correctly jas0nuk's pandora elf menu can access the psp's flash0 - flash3 via USB Access with the usage of the Sony Updater prxs. This is known to work on 3.80 and up so far. But is said to not work on the fat psp. However I could test that out some time on both my old Fat as well as my newer Slim. I do however know that it does work on my Slim, as I have done that in the past before. Still works with 4.01 M33-2 also. Here is a link to the thread with information as to how to do that if this helps at all:
http://lan.st/showthread.php?t=1603

There is only one problem though, even though it does enable access on flash0 for pandora, the elf menu is still technically a 1.50 app.
 

dennis96411

Member
How about making a rar/zip file? And marking folders/files in rar/zip files. And an option to extract all the files in a rar/zip file to a specific location, just like WinRAR. I know this sounds too much, but what about EBOOT editor (You can edit the name it will display in the Game menu, the background, and icon, and maybe even sound.
 

ne0h

Dev
mediumgauge, I've find a solution for the write permission in the Slims ( I've used it in Xplora ), you have to set the flag at 0x800 and build an external kernel mode prx and import the assign function! ;)
 

mediumgauge

Developer
Thank you for suggestion, I will test it.

mediumgauge, I've find a solution for the write permission in the Slims ( I've used it in Xplora ), you have to set the flag at 0x800 and build an external kernel mode prx and import the assign function! ;)
 

LocutusEstBorg

Active Member
flash0 write access in kernel 3

supporting to write flash0 on kernel3 is not easy, I tried a lot but not succeed.
calculating folder size, I will bind the feature in the next (4.5) release.

I've been hoping to see flash0 write support in 3.XX Kernel for a long time.
I don't know what problems you're facing but this is how I am writing the config file in Lockdown v3.

Here is the code I'm using.
The only thing you have to do is reassign flash0 in write mode like this.
This can only be done inside a VSH mode module (0x800 mode).

My whole program is VSH mode so I am performing the reassign and file writing in the same place.

But if Filer has to run in kernel mode, then all you have to do is just create another VSH mode PRX which contains the code just to reassign flash0. Once you load and start that PRX, you can write to flash0 from the main Filer code.

Code:
#include <pspkernel.h>
#include <pspthreadman.h>

int __psp_free_heap(void);

PSP_MODULE_INFO("Password", 0x800, 3, 0);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_VSH);
PSP_HEAP_SIZE_KB(2048);

int main_thread(SceSize args, void *argp)
{
	Config cfg;
	int result;
	result = sceIoUnassign("flash0:");
	
	if(result < 0)
	{
		printf("\nError in unassign flash0.");
	}
	else
	{
		result = sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0);
		if(result < 0)
		{
			printf("\nError in assigning flash0 for write.");
		}
		else
		{
			SceUID fp;
			fp = sceIoOpen("flash0:/buttons.ini", PSP_O_WRONLY|PSP_O_TRUNC|PSP_O_CREAT, 0777);
			
			if(fp < 0)
			{
				printf("\nError writing flash0:/buttons.ini.");
			}
			else
			{
				sceIoWrite(fp, &cfg, sizeof(cfg));
				sceIoClose(fp);
				printf("\nPassword written successfully.");
			}
		}
	}

}

int module_start(SceSize args, void *argp)
{
	SceUID th;
	th = sceKernelCreateThread("main_thread", main_thread, 0x11, 0x1000, 0, NULL);

	if (th >= 0)
	{
		sceKernelStartThread(th, args, argp);
	}

	return 0;
}

int module_stop(SceSize args, void *argp)
{
	__psp_free_heap();
	return 0;
}

The makefile for the VSH module does not need the kernel LIBC and kernel LIBS.

Code:
TARGET = flash0
OBJS = main.o

INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

BUILD_PRX = 1
PRX_EXPORTS = exports.exp

#USE_KERNEL_LIBC=1
#USE_KERNEL_LIBS=1

PSP_FW_VERSION = 390
PSP_LARGE_MEMORY = 0

LIBDIR =
LIBS =
LDFLAGS =

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build_prx.mak

Hoping to flash0 writing in v5.6 8)
 

LocutusEstBorg

Active Member
I've noticed another bug though. When viewing flash0, it doesn't show the files in some folders properly. Some files are completely missing etc. Files that are supposed to be in one folder, are shown inside another folder. E.G. a few PRXs from the VSH/MODULE folder show up in some other folder.
 

mediumgauge

Developer
Thank you writing in detail, I will test it.

I've been hoping to see flash0 write support in 3.XX Kernel for a long time.
I don't know what problems you're facing but this is how I am writing the config file in Lockdown v3.

Here is the code I'm using.
The only thing you have to do is reassign flash0 in write mode like this.
This can only be done inside a VSH mode module (0x800 mode).

My whole program is VSH mode so I am performing the reassign and file writing in the same place.

But if Filer has to run in kernel mode, then all you have to do is just create another VSH mode PRX which contains the code just to reassign flash0. Once you load and start that PRX, you can write to flash0 from the main Filer code.

Code:
#include <pspkernel.h>
#include <pspthreadman.h>

int __psp_free_heap(void);

PSP_MODULE_INFO("Password", 0x800, 3, 0);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_VSH);
PSP_HEAP_SIZE_KB(2048);

int main_thread(SceSize args, void *argp)
{
	Config cfg;
	int result;
	result = sceIoUnassign("flash0:");
	
	if(result < 0)
	{
		printf("\nError in unassign flash0.");
	}
	else
	{
		result = sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0);
		if(result < 0)
		{
			printf("\nError in assigning flash0 for write.");
		}
		else
		{
			SceUID fp;
			fp = sceIoOpen("flash0:/buttons.ini", PSP_O_WRONLY|PSP_O_TRUNC|PSP_O_CREAT, 0777);
			
			if(fp < 0)
			{
				printf("\nError writing flash0:/buttons.ini.");
			}
			else
			{
				sceIoWrite(fp, &cfg, sizeof(cfg));
				sceIoClose(fp);
				printf("\nPassword written successfully.");
			}
		}
	}

}

int module_start(SceSize args, void *argp)
{
	SceUID th;
	th = sceKernelCreateThread("main_thread", main_thread, 0x11, 0x1000, 0, NULL);

	if (th >= 0)
	{
		sceKernelStartThread(th, args, argp);
	}

	return 0;
}

int module_stop(SceSize args, void *argp)
{
	__psp_free_heap();
	return 0;
}

The makefile for the VSH module does not need the kernel LIBC and kernel LIBS.

Code:
TARGET = flash0
OBJS = main.o

INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

BUILD_PRX = 1
PRX_EXPORTS = exports.exp

#USE_KERNEL_LIBC=1
#USE_KERNEL_LIBS=1

PSP_FW_VERSION = 390
PSP_LARGE_MEMORY = 0

LIBDIR =
LIBS =
LDFLAGS =

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build_prx.mak

Hoping to flash0 writing in v5.6 8)
 

mediumgauge

Developer
I made "f0mount.prx" and tried to write flash0 but failed.
Here is the source code of prx:

Code:
#include <pspkernel.h>
#include <stdio.h>

PSP_MODULE_INFO("F0MOUNT", 0x800, 1, 0); 
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_VSH); 

int main(void)
{
	sceKernelSleepThread();
	return 0;
}

int f0mount(int mode)
{
	int	result;
	FILE	*fp;
	fp = fopen("ms0:/log.txt", "a");
	fprintf(fp, "writing start!\n");
	fclose(fp);
	result = sceIoUnassign("flash0:");
	fp = fopen("ms0:/log.txt", "a");
	fprintf(fp, "result2:%x\n", result);
	fclose(fp);
	result = sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", mode ? IOASSIGN_RDWR : IOASSIGN_RDONLY, NULL, 0);
	fp = fopen("ms0:/log.txt", "a");
	fprintf(fp, "result3:%x\n", result);
	fclose(fp);
	return 0;
}

And here is the result:
Code:
writing start!
result2:8001000d
result3:80020326

I don't know what "8001000d" mean, but "80020326" means "SCE_KERNEL_ERROR_ALIAS_USED", probably it means "this alias is already used since you failed to unassign flash0".
Any idea to solve this?
 

LocutusEstBorg

Active Member
I don't know what "8001000d" mean, but "80020326" means "SCE_KERNEL_ERROR_ALIAS_USED", probably it means "this alias is already used since you failed to unassign flash0".
Any idea to solve this?

8001000d means you are not in the correct mode and don't have rights to unassign. That is normal when executed from the context of a User mode EBOOT.

I assume that Filer for 3.xx is in User mode. Instead of making a separate PRX, you can just change the main Filer code to VSH mode.

Here is a sample project which compiles to EBOOT in VSH mode, and writes a text file to flash0.

http://ifile.it/9y2rnqf/flash0.zip
 

LocutusEstBorg

Active Member
If you want to build a separate f0mount.prx to load and start then your make file must be like this:
Code:
BUILD_PRX = 1
PRX_EXPORTS = exports.exp
....
....
....
[B]include $(PSPSDK)/lib/build_prx.mak[/B]

You cannot generate an EBOOT from this.
It should have the functions module_start, module_stop, and a main_thread like the code I posted in the beginning.
You have to create the exports.exp file and define the functions there as well as your custom functions such as f0mount. (There is no need for a separate function in your case. Just ressign flash0 in the main_thread itself. You just need to start the PRX in the beginning itself and forget about it. It doesn't matter if you leave it in write mode.) You can immediately unload the PRX to free memory, it will remain in write mode.



But there is no need for a separate PRX, just make Filer as VSH mode and do it like the sample code I linked in the last post.
 

mediumgauge

Developer
Torch, thank you for details.
I don't want to separate Filer.
I succeeded to compile & run Filer, by upgrading PSPSDK, but there is a problem that in "BUILD_PRX" mode malloc() returns NULL only allocating 100kbytes (100,812bytes).
Filer cannot run in such few space. I have to solve it to make kernel3 to access flash0.
 

mediumgauge

Developer
I found the reason of few memory - shamefully easy reason.
Adding one line "PSP_HEAP_SIZE_KB(1024*20); //20MB" in source code, it works.
Torch, thank you a lot. I can release flash0-accessable kernel3 Filer in next time.
 

LocutusEstBorg

Active Member
I found the reason of few memory - shamefully easy reason.
Adding one line "PSP_HEAP_SIZE_KB(1024*20); //20MB" in source code, it works.
Torch, thank you a lot. I can release flash0-accessable kernel3 Filer in next time.

If you use PSP_HEAP_SIZE_MAX(); you'll get the full user memory.
If you include PSP_LARGE_MEMORY = 1 in the makefile you'll get another 32MB on a Slim PSP. Might be useful for loading large JPEGs on Slim.

Another problem with using the heap is, suppse you declare a 23MB heap, there is only 1 MB free. When you call malloc even for 2MB, it will allocate the full 23MB from the OS. In a single module application its no problem because you application will further allocate pointers only within that 23MB block. But suppose you load another PRX, that PRX will only have 1MB free for its allocation, as the remaining space would have been eaten by your application, even if you have allocated only 2 MB.

When using sceKernelAllocPartitionMemory, the entire space will remain free for any application to use, and only the exact amount you allocate will be used.

Torch, thank you for details.
I don't want to separate Filer.
I succeeded to compile & run Filer, by upgrading PSPSDK, but there is a problem that in "BUILD_PRX" mode malloc() returns NULL only allocating 100kbytes (100,812bytes).
Filer cannot run in such few space. I have to solve it to make kernel3 to access flash0.

Do not use include $(PSPSDK)/lib/build_prx.mak for EBOOT. Thats only for creating standalone PRX to be loaded by other applications.
When you use include $(PSPSDK)/lib/build_prx.mak it also gives a default of 64KB for the heap. So if you want to use malloc in the PRX, you need to declare a bigger heap, or just use the sceKernel alloc commands instead.
 
Top