Skip to content

Commit

Permalink
umd fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseAaronLopezGarcia committed Jul 6, 2023
1 parent 93211d6 commit 7fa9a0a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
11 changes: 10 additions & 1 deletion core/systemctrl/src/gameinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ struct LbaParams {
int byte_size_last; // 28
};

static const char* HOME_ID = "HOME00000";

int readGameIdFromDisc(char* gameid){
static char game_id[10] = {0};

Expand Down Expand Up @@ -57,6 +59,13 @@ int readGameIdFromDisc(char* gameid){
}

int getGameId(char* gameid){

int apitype = sceKernelInitApitype();
if (apitype == 0x141 || apitype == 0x152 || apitype >= 0x200){
strcpy(gameid, HOME_ID);
return;
}

// Find Function
void * (* SysMemForKernel_EF29061C)(void) = (void *)sctrlHENFindFunction("sceSystemMemoryManager", "SysMemForKernel", 0xEF29061C);

Expand All @@ -70,7 +79,7 @@ int getGameId(char* gameid){
if(gameinfo == NULL) return 0;
memcpy(gameid, gameinfo+0x44, 9);

if (gameid[0] == 0 || strncmp(gameid, "HOME00000", 9) == 0){
if (gameid[0] == 0 || strncmp(gameid, HOME_ID, 9) == 0){
return readGameIdFromDisc(gameid);
}

Expand Down
2 changes: 1 addition & 1 deletion core/systemctrl/src/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static int matchingRunlevel(char * runlevel)

if (stricmp(runlevel, "all") == 0 || stricmp(runlevel, "always") == 0) return 1; // always on
else if (stricmp(runlevel, "vsh") == 0 || stricmp(runlevel, "xmb") == 0) // VSH only
return (apitype == 0x200 || apitype == 0x210 || apitype == 0x220 || apitype == 0x300);
return (apitype >= 0x200);
else if (stricmp(runlevel, "pops") == 0 || stricmp(runlevel, "ps1") == 0 || stricmp(runlevel, "psx") == 0) // PS1 games only
return (apitype == 0x144 || apitype == 0x155);
else if (stricmp(runlevel, "umd") == 0 || stricmp(runlevel, "psp") == 0 || stricmp(runlevel, "umdemu") == 0) // Retail games only
Expand Down
2 changes: 1 addition & 1 deletion extras/menus/arkMenu/src/gamemgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ int GameManager::loadIcons(SceSize _args, void *_argp){
std::vector<Entry*>* game_entries = self->categories[GAME]->getVector();
bool has_umd = UMD::isUMD();
bool umd_loaded = game_entries->size() > 0 && string("UMD") == game_entries->at(0)->getType();
if (has_umd && !umd_loaded){ // UMD inserted but not loaded
if (has_umd && !umd_loaded && self->selectedCategory >= 0){ // UMD inserted but not loaded
SystemMgr::pauseDraw();
game_entries->insert(game_entries->begin(), new UMD());
SystemMgr::resumeDraw();
Expand Down
3 changes: 2 additions & 1 deletion extras/menus/arkMenu/src/umd.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "umd.h"

extern "C" int sctrlKernelLoadExecVSHDisc(const char*, struct SceKernelLoadExecVSHParam*);

UMD::UMD(){
this->name = "UMD Drive";
Expand Down Expand Up @@ -115,7 +116,7 @@ void UMD::doExecute(){
sctrlSESetBootConfFileIndex(MODE_UMD);
sctrlSESetUmdFile("");

sctrlKernelLoadExecVSHWithApitype(UMD_APITYPE, UMD_EBOOT_BIN, &param);
sctrlKernelLoadExecVSHDisc(UMD_EBOOT_BIN, &param);
}

char* UMD::getType(){
Expand Down

0 comments on commit 7fa9a0a

Please sign in to comment.