mirror of
https://github.com/joel16/CMFileManager-PSP.git
synced 2024-11-26 21:20:24 +00:00
app: Load kernel plugins from memory
This commit is contained in:
parent
98cc6d93b7
commit
4f10474794
12
.github/workflows/c-cpp.yml
vendored
12
.github/workflows/c-cpp.yml
vendored
@ -20,18 +20,6 @@ jobs:
|
||||
- name: Compile project
|
||||
run: make
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
path: audio_driver/audio_driver.prx
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
path: display_driver/display_driver.prx
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
path: fs_driver/fs_driver.prx
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
path: app/EBOOT.PBP
|
||||
|
28
app/Makefile
28
app/Makefile
@ -1,14 +1,15 @@
|
||||
TARGET = CMFileManager
|
||||
|
||||
SOURCES := data drivers source source/audio source/gui ../libs/libnsbmp ../libs/libnsgif
|
||||
CFILES := $(foreach dir,$(SOURCES), $(wildcard $(dir)/*.c))
|
||||
SFILES := $(foreach dir,$(SOURCES), $(wildcard $(dir)/*.S))
|
||||
CPPFILES := $(foreach dir,$(SOURCES), $(wildcard $(dir)/*.cpp))
|
||||
GFXFILES := $(foreach dir,$(SOURCES), $(wildcard $(dir)/*.png))
|
||||
FONTFILES := $(foreach dir,$(SOURCES), $(wildcard $(dir)/*.pgf))
|
||||
CFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.c))
|
||||
SFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.S))
|
||||
CPPFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.cpp))
|
||||
FONTFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.pgf))
|
||||
GFXFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.png))
|
||||
PRXFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.prx))
|
||||
|
||||
OBJS := $(addsuffix .o,$(BINFILES)) \
|
||||
$(CFILES:.c=.o) $(SFILES:.S=.o) $(CPPFILES:.cpp=.o) $(GFXFILES:.png=.o) $(FONTFILES:.pgf=.o)
|
||||
OBJS := $(addsuffix .o,$(BINFILES)) $(CFILES:.c=.o) $(SFILES:.S=.o) $(CPPFILES:.cpp=.o) \
|
||||
$(FONTFILES:.pgf=.o) $(GFXFILES:.png=.o) $(PRXFILES:.prx=.o)
|
||||
|
||||
VERSION_MAJOR := 4
|
||||
VERSION_MINOR := 1
|
||||
@ -30,15 +31,18 @@ LIBS = -lintrafont -lglib2d -lxmp -lmpg123 -lvorbisfile -lvorbis -lopusfile -
|
||||
-lpspkubridge -lpspsystemctrl_user -lpspusbdevice \
|
||||
-lpspgu -lpspvram -lpspaudio -lpsppower -lpspreg -lpspusb -lpspusbstor -lpspumd
|
||||
|
||||
EXTRA_TARGETS = EBOOT.PBP
|
||||
PSP_EBOOT_TITLE = CM File Manager PSP v$(VERSION_MAJOR).$(VERSION_MINOR)$(VERSION_MICRO)
|
||||
PSP_EBOOT_ICON = ../ICON0.PNG
|
||||
EXTRA_TARGETS = EBOOT.PBP
|
||||
PSP_EBOOT_TITLE = CM File Manager PSP v$(VERSION_MAJOR).$(VERSION_MINOR)$(VERSION_MICRO)
|
||||
PSP_EBOOT_ICON = ../ICON0.PNG
|
||||
|
||||
PSPSDK=$(shell psp-config --pspsdk-path)
|
||||
include $(PSPSDK)/lib/build.mak
|
||||
|
||||
%.o: %.pgf
|
||||
bin2o -i $< $@ $(addsuffix _pgf, $(basename $(notdir $<) ))
|
||||
|
||||
%.o: %.png
|
||||
bin2o -i $< $@ $(addsuffix _png, $(basename $(notdir $<) ))
|
||||
|
||||
%.o: %.pgf
|
||||
bin2o -i $< $@ $(addsuffix _pgf, $(basename $(notdir $<) ))
|
||||
%.o: %.prx
|
||||
bin2o -i $< $@ $(addsuffix _prx, $(basename $(notdir $<) ))
|
@ -21,6 +21,9 @@ enum PspCtrlButtons PSP_CTRL_ENTER, PSP_CTRL_CANCEL;
|
||||
BROWSE_STATE device = BROWSE_STATE_EXTERNAL;
|
||||
int g_psp_language = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH;
|
||||
|
||||
extern unsigned char audio_driver_prx_start[], display_driver_prx_start[], fs_driver_prx_start[];
|
||||
extern unsigned int audio_driver_prx_size, display_driver_prx_size, fs_driver_prx_size;
|
||||
|
||||
namespace Utils {
|
||||
constexpr unsigned int CTRL_DEADZONE_DELAY = 500000;
|
||||
constexpr unsigned int CTRL_DELAY = 100000;
|
||||
@ -34,12 +37,14 @@ namespace Utils {
|
||||
typedef struct {
|
||||
const char *path = nullptr;
|
||||
int id = 0;
|
||||
unsigned char *data = nullptr;
|
||||
unsigned int size = 0;
|
||||
} Module;
|
||||
|
||||
static std::vector<Module> kernel_modules {
|
||||
{ "audio_driver.prx", -1, },
|
||||
{ "display_driver.prx", -1, },
|
||||
{ "fs_driver.prx", -1, }
|
||||
{ "audio_driver.prx", -1, audio_driver_prx_start, audio_driver_prx_size },
|
||||
{ "display_driver.prx", -1, display_driver_prx_start, display_driver_prx_size },
|
||||
{ "fs_driver.prx", -1, fs_driver_prx_start, fs_driver_prx_size }
|
||||
};
|
||||
|
||||
static std::vector<Module> usb_modules {
|
||||
@ -110,6 +115,31 @@ namespace Utils {
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Basically removes and re-creates prx from memory -> then remove it after inital load
|
||||
static int LoadStartModuleMem(const char *path, const void *buf, SceSize size) {
|
||||
int ret = 0;
|
||||
SceUID modID = 0;
|
||||
|
||||
// Don't care if this passes or fails
|
||||
sceIoRemove(path);
|
||||
SceUID file = sceIoOpen(path, PSP_O_WRONLY | PSP_O_CREAT, 0777);
|
||||
sceIoWrite(file, buf, size);
|
||||
sceIoClose(file);
|
||||
|
||||
if (R_FAILED(ret = modID = kuKernelLoadModule(path, 0, nullptr))) {
|
||||
Log::Error("kuKernelLoadModule(%s) failed: 0x%08x\n", path, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (R_FAILED(ret = sceKernelStartModule(modID, 0, nullptr, nullptr, nullptr))) {
|
||||
Log::Error("sceKernelStartModule(%s) failed: 0x%08x\n", path, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
sceIoRemove(path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void StopUnloadModules(SceUID modID) {
|
||||
sceKernelStopModule(modID, 0, nullptr, nullptr, nullptr);
|
||||
sceKernelUnloadModule(modID);
|
||||
@ -216,7 +246,7 @@ namespace Utils {
|
||||
|
||||
void InitKernelDrivers(void) {
|
||||
for (unsigned int i = 0; i < kernel_modules.size(); ++i)
|
||||
kernel_modules[i].id = Utils::LoadStartModule(kernel_modules[i].path);
|
||||
kernel_modules[i].id = Utils::LoadStartModuleMem(kernel_modules[i].path, kernel_modules[i].data, kernel_modules[i].size);
|
||||
|
||||
Utils::InitUSB();
|
||||
}
|
||||
|
@ -24,3 +24,4 @@ include $(PSPSDK)/lib/build_prx.mak
|
||||
all:
|
||||
psp-build-exports -s $(PRX_EXPORTS)
|
||||
mv audio_driver.S "../app/drivers/"
|
||||
mv audio_driver.prx "../app/data/"
|
||||
|
@ -24,3 +24,4 @@ include $(PSPSDK)/lib/build_prx.mak
|
||||
all:
|
||||
psp-build-exports -s $(PRX_EXPORTS)
|
||||
mv display_driver.S "../app/drivers/"
|
||||
mv display_driver.prx "../app/data/"
|
||||
|
@ -24,3 +24,4 @@ include $(PSPSDK)/lib/build_prx.mak
|
||||
all:
|
||||
psp-build-exports -s $(PRX_EXPORTS)
|
||||
mv fs_driver.S "../app/drivers/"
|
||||
mv fs_driver.prx "../app/data/"
|
||||
|
Loading…
Reference in New Issue
Block a user