Skip to content

Commit

Permalink
add ef0 for ps vita
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseAaronLopezGarcia committed Jan 20, 2025
1 parent ae50eb9 commit f66ad89
Show file tree
Hide file tree
Showing 7 changed files with 521 additions and 10 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ copy-bin:
$(Q)cp loader/live/kernel/kernel_loader/ARK4.BIN dist/ARK_01234/ARK4.BIN # ARK-4 loader
$(Q)cp loader/live/kernel/psxloader/ARKX.BIN dist/ARK_01234/ARKX.BIN # ARK-X loader
$(Q)cp loader/live/kernel/psxloader/ps1cfw_enabler/ps1cfw_enabler.suprx dist/PSVita/PS1CFW/
$(Q)cp extras/modules/ef2uma/ef2uma.suprx dist/PSVita/PSPCFW/
$(Q)cp loader/live/kernel/kxploit/sceUID/K.BIN dist/ARK_01234/K.BIN # Kernel exploit for PSP 6.6X and Vita 3.60+
$(Q)cp loader/live/kernel/kxploit/sceSdGetLastIndex/K.BIN dist/ARK_Loader/K.BIN # Alternative Kernel exploit for PSP 6.6X
$(Q)cp loader/live/FinalSpeed/EBOOT.PBP dist/PSP/FinalSpeed/
Expand Down
125 changes: 121 additions & 4 deletions core/compat/vita/filesystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,15 @@ int sceIoDcloseHook(int fd);
// "ms" Driver Reference
PspIoDrv * ms_drv = NULL;
PspIoDrv * flashfat_drv = NULL;
PspIoDrvArg * ms_driver = NULL;
PspIoDrvArg * flash_driver = NULL;

PspIoDrvFuncs ms_funcs;
PspIoDrvFuncs flash_funcs;

// "ef" driver
PspIoDrv ef_drv;
PspIoDrv fatef_drv;
PspIoDrvFuncs ef_funcs;

int (* _sceIoAddDrv)(PspIoDrv *drv);
int (* _sceIoDelDrv)(const char *drv_name);

Expand Down Expand Up @@ -130,8 +133,6 @@ u32 UnprotectAddress(u32 addr){
int (* sceIoMsOpen)(PspIoDrvFileArg * arg, char * file, int flags, SceMode mode) = NULL;
int sceIoMsOpenHook(PspIoDrvFileArg * arg, char * file, int flags, SceMode mode)
{
// Update Internal "ms" Driver Reference
ms_driver = arg->drv;

// File Write Open Request
if ((flags & PSP_O_WRONLY) != 0) {
Expand All @@ -147,6 +148,98 @@ int sceIoMsOpenHook(PspIoDrvFileArg * arg, char * file, int flags, SceMode mode)
return sceIoMsOpen(arg, file, flags, mode);
}

int sceIoEfOpenHook(PspIoDrvFileArg * arg, char * file, int flags, SceMode mode)
{
char path[256];
strcpy(path, "/__ef0__");
strcat(path, file);

// Forward Call
return sceIoMsOpenHook(arg, path, flags, mode);
}

int sceIoEfRemoveHook(PspIoDrvFileArg * arg, char * file)
{
char path[256];
strcpy(path, "/__ef0__");
strcat(path, file);

// Forward Call
return ms_funcs.IoRemove(arg, path);
}

int sceIoEfMkdirHook(PspIoDrvFileArg * arg, char * file, SceMode mode)
{
char path[256];
strcpy(path, "/__ef0__");
strcat(path, file);

// Forward Call
return ms_funcs.IoMkdir(arg, path, mode);
}

int sceIoEfRmdirHook(PspIoDrvFileArg * arg, char * file)
{
char path[256];
strcpy(path, "/__ef0__");
strcat(path, file);

// Forward Call
return ms_funcs.IoRmdir(arg, path);
}

int sceIoEfDopenHook(PspIoDrvFileArg * arg, char * file)
{
char path[256];
strcpy(path, "/__ef0__");
strcat(path, file);

// Forward Call
return ms_funcs.IoDopen(arg, path);
}

int sceIoEfGetStatHook(PspIoDrvFileArg * arg, char * file, SceIoStat* stat)
{
char path[256];
strcpy(path, "/__ef0__");
strcat(path, file);

// Forward Call
return ms_funcs.IoGetstat(arg, path, stat);
}

int sceIoEfChStatHook(PspIoDrvFileArg * arg, char * file, SceIoStat* stat, int bits)
{
char path[256];
strcpy(path, "/__ef0__");
strcat(path, file);

// Forward Call
return ms_funcs.IoChstat(arg, path, stat, bits);
}

int sceIoEfRenameHook(PspIoDrvFileArg *arg, const char *oldname, const char *newname){
char oldpath[256];
strcpy(oldpath, "/__ef0__");
strcat(oldpath, oldname);

char newpath[256];
strcpy(newpath, "/__ef0__");
strcat(newpath, newname);

// Forward Call
return ms_funcs.IoRename(arg, oldname, newname);
}

int sceIoEfChdirHook(PspIoDrvFileArg *arg, const char *dir){
char path[256];
strcpy(path, "/__ef0__");
strcat(path, dir);

// Forward Call
return ms_funcs.IoChdir(arg, dir);
}

int (* sceIoMsRead_)(PspIoDrvFileArg* arg, void* data, SceSize size);
int sceIoMsReadHook(PspIoDrvFileArg* arg, void* data, SceSize size){
int ret;
Expand Down Expand Up @@ -594,6 +687,30 @@ int sceIoAddDrvHook(PspIoDrv * driver)
// Add ms driver
ms_drv->funcs = driver->funcs;
_sceIoAddDrv(ms_drv);

// Add ef driver
memcpy(&ef_funcs, driver->funcs, sizeof(PspIoDrvFuncs));
ef_funcs.IoOpen = sceIoEfOpenHook;
ef_funcs.IoRemove = sceIoEfRemoveHook;
ef_funcs.IoMkdir = sceIoEfMkdirHook;
ef_funcs.IoRmdir = sceIoEfRmdirHook;
ef_funcs.IoDopen = sceIoEfDopenHook;
ef_funcs.IoGetstat = sceIoEfGetStatHook;
ef_funcs.IoChstat = sceIoEfChStatHook;
ef_funcs.IoRename = sceIoEfRenameHook;
ef_funcs.IoChdir = sceIoEfChdirHook;

memcpy(&ef_drv, ms_drv, sizeof(PspIoDrv));
ef_drv.name = "ef";
ef_drv.name2 = "EF";
ef_drv.funcs = &ef_funcs;
_sceIoAddDrv(&ef_drv);

memcpy(&fatef_drv, driver, sizeof(PspIoDrv));
fatef_drv.name = "fatef";
fatef_drv.name2 = "FATEF";
fatef_drv.funcs = &ef_funcs;
_sceIoAddDrv(&fatef_drv);
}
else if(strcmp(driver->name, "ms") == 0) {
ms_drv = driver;
Expand Down
11 changes: 5 additions & 6 deletions extras/menus/arkMenu/src/browser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,6 @@ Browser::Browser(){
if (conf->browser_dir[0]) this->cwd = conf->browser_dir;

int psp_model = common::getPspModel();
if (psp_model != PSP_GO){
pEntries[EF0_DIR] = NULL;
}
else{
pEntries[UMD_DIR] = NULL;
}
if (psp_model == PSP_11000 || ftp_driver == NULL){
pEntries[FTP_DIR] = NULL;
}
Expand All @@ -105,6 +99,11 @@ Browser::Browser(){
pEntries[UMD_DIR] = NULL;
}

SceIoStat ef0stat;
if (sceIoGetstat("ef0:", &ef0stat) < 0){
pEntries[EF0_DIR] = NULL;
}

if (ark_config->exec_mode == PS_VITA)
pEntries[USB_DEV] = NULL;

Expand Down
52 changes: 52 additions & 0 deletions extras/modules/ef2uma/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
cmake_minimum_required(VERSION 2.8)

if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
if(DEFINED ENV{VITASDK})
set(CMAKE_TOOLCHAIN_FILE "$ENV{VITASDK}/share/vita.toolchain.cmake" CACHE PATH "toolchain file")
else()
message(FATAL_ERROR "Please define VITASDK to point to your SDK path!")
endif()
endif()

project(ef2uma)
include("${VITASDK}/share/vita.cmake" REQUIRED)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-q -Wall -O3 -std=gnu99")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti -fno-exceptions")

include_directories(
)

link_directories(
${CMAKE_CURRENT_BINARY_DIR}
)

if (NOT ${RELEASE})
add_definitions(-DENABLE_LOGGING)
endif()

add_executable(ef2uma
ef2uma.c
)

target_link_libraries(ef2uma
taihen_stub
SceLibKernel_stub
SceLibc_stub_weak
SceCompat_stub
SceKernelModulemgr_stub
SceIofilemgr_stub
SceRtc_stub
SceCtrl_stub
SceDisplay_stub
SceShellSvc_stub
SceProcessmgr_stub
)

set_target_properties(ef2uma
PROPERTIES LINK_FLAGS "-nostdlib"
)

vita_create_self(ef2uma.suprx ef2uma
CONFIG ${CMAKE_SOURCE_DIR}/ef2uma.yml
)
Loading

0 comments on commit f66ad89

Please sign in to comment.