diff --git a/extras/menus/arkMenu/imports.S b/extras/menus/arkMenu/imports.S index 92152b114..ca50adb37 100644 --- a/extras/menus/arkMenu/imports.S +++ b/extras/menus/arkMenu/imports.S @@ -6,4 +6,8 @@ STUB_START "scePower", 0x40010000, 0x00030005 STUB_FUNC 0x2B7C7CF4, scePowerRequestStandby STUB_FUNC 0x0442D852, scePowerRequestColdReset STUB_FUNC 0xAC32C9CC, scePowerRequestSuspend +STUB_END + +STUB_START "SysMemUserForUser", 0x40000011, 0x00030005 +STUB_FUNC 0x7591C7DB, sceKernelSetCompiledSdkVersion STUB_END \ No newline at end of file diff --git a/extras/menus/arkMenu/include/browser.h b/extras/menus/arkMenu/include/browser.h index 69596316b..45f8f17ac 100644 --- a/extras/menus/arkMenu/include/browser.h +++ b/extras/menus/arkMenu/include/browser.h @@ -26,12 +26,6 @@ enum{ UMD_DIR, }; -typedef struct _pspMsPrivateDirent { - SceSize size; - char s_name[16]; - char l_name[1024]; -} pspMsPrivateDirent; - class BrowserDriver{ public: virtual bool connect() = 0; diff --git a/extras/menus/arkMenu/include/browser_entries.h b/extras/menus/arkMenu/include/browser_entries.h index 8b0493e86..5f9e452cd 100644 --- a/extras/menus/arkMenu/include/browser_entries.h +++ b/extras/menus/arkMenu/include/browser_entries.h @@ -9,19 +9,16 @@ class BrowserFile : public Entry{ bool selected; string fileSize; int filetype; - string shortname; string parent; virtual unsigned getFileSize(); - void setShortName(string shortname); - public: BrowserFile(); - BrowserFile(string path, string shortname); - BrowserFile(string parent, string name, string shortname); + BrowserFile(string path); + BrowserFile(string parent, string name); ~BrowserFile(); @@ -58,8 +55,8 @@ class BrowserFile : public Entry{ class BrowserFolder : public BrowserFile{ public: - BrowserFolder(string path, string shortname); - BrowserFolder(string parent, string name, string shortname); + BrowserFolder(string path); + BrowserFolder(string parent, string name); ~BrowserFolder(); diff --git a/extras/menus/arkMenu/main.cpp b/extras/menus/arkMenu/main.cpp index 81bb4a391..3ba6f8f70 100644 --- a/extras/menus/arkMenu/main.cpp +++ b/extras/menus/arkMenu/main.cpp @@ -30,18 +30,17 @@ using namespace std; static SystemEntry* entries[MAX_ENTRIES]; extern "C" void my_malloc_init(); +extern "C" int sceKernelSetCompiledSdkVersion(int version); int main(int argc, char** argv){ + sceKernelSetCompiledSdkVersion(FW_660); + // make malloc/free threadsafe my_malloc_init(); srand(time(NULL)); - int encoding = 5; - sceIoDevctl("fatms0:", 0x02425856, &encoding, 4, NULL, 0); - //sceIoDevctl("fatef0:", 0x02425856, &encoding, 4, NULL, 0); - intraFontInit(); ya2d_init(); diff --git a/extras/menus/arkMenu/src/browser.cpp b/extras/menus/arkMenu/src/browser.cpp index 7bfa1770c..b72e8f180 100644 --- a/extras/menus/arkMenu/src/browser.cpp +++ b/extras/menus/arkMenu/src/browser.cpp @@ -523,13 +523,8 @@ void Browser::refreshDirs(const char* retry){ vector files; // scan directory - pspMsPrivateDirent *pri_dirent = (pspMsPrivateDirent*)malloc(sizeof(pspMsPrivateDirent)); - memset(pri_dirent, 0, sizeof(pspMsPrivateDirent)); - pri_dirent->size = sizeof(pspMsPrivateDirent); - dit.d_private = (void*)pri_dirent; - while ((sceIoDread(dir, &dit)) > 0){ - printf("got entry: %s -> %s\n", dit.d_name, pri_dirent); + printf("got entry: %s\n", dit.d_name); if (dit.d_name[0] == '.' && strcmp(dit.d_name, ".") != 0 && strcmp(dit.d_name, "..") != 0 && !common::getConf()->show_hidden){ continue; @@ -537,18 +532,16 @@ void Browser::refreshDirs(const char* retry){ if (common::isFolder(&dit)){ printf("is dir\n"); - folders.push_back(new Folder(cwd, dit.d_name, string((const char*)pri_dirent))); + folders.push_back(new Folder(cwd, dit.d_name)); } else{ printf("is file\n"); - files.push_back(new File(cwd, dit.d_name, string((const char*)pri_dirent))); + files.push_back(new File(cwd, dit.d_name)); } } printf("closing and cleaning\n"); sceIoDclose(dir); - free(pri_dirent); - // handle special folders Entry* dot = NULL; Entry* dotdot = NULL; @@ -565,7 +558,7 @@ void Browser::refreshDirs(const char* retry){ } if (cwd == GO_ROOT){ - eh0 = new Folder(cwd, "", ""); + eh0 = new Folder(cwd, ""); } // sort entries if needed @@ -577,9 +570,9 @@ void Browser::refreshDirs(const char* retry){ // insert special folders if (eh0) folders.insert(folders.begin(), eh0); - if (!dotdot && !isRootDir(this->cwd)) dotdot = new Folder(cwd, "..", ""); + if (!dotdot && !isRootDir(this->cwd)) dotdot = new Folder(cwd, ".."); if (dotdot) folders.insert(folders.begin(), dotdot); - if (!dot && !isRootDir(this->cwd)) dot = new Folder(cwd, ".", ""); + if (!dot && !isRootDir(this->cwd)) dot = new Folder(cwd, "."); if (dot) folders.insert(folders.begin(), dot); // folders first, files last @@ -590,7 +583,7 @@ void Browser::refreshDirs(const char* retry){ for (int i=0; ipush_back(files.at(i)); if (this->entries->size() == 0) - this->entries->push_back(new Folder(cwd, ".", "")); + this->entries->push_back(new Folder(cwd, ".")); SystemMgr::resumeDraw(); printf("done\n"); @@ -908,11 +901,6 @@ void Browser::recursiveFolderDelete(string path){ { SceIoDirent entry; memset(&entry, 0, sizeof(SceIoDirent)); - - pspMsPrivateDirent *pri_dirent = (pspMsPrivateDirent*)malloc(sizeof(pspMsPrivateDirent)); - memset(pri_dirent, 0, sizeof(pspMsPrivateDirent)); - pri_dirent->size = sizeof(pspMsPrivateDirent); - entry.d_private = (void*)pri_dirent; //allocate memory to store the full file paths string new_path; @@ -932,17 +920,9 @@ void Browser::recursiveFolderDelete(string path){ if (common::isFolder(&entry)){ new_path = new_path + "/"; - if (!common::folderExists(new_path)){ - new_path = path + string((const char*)pri_dirent); - printf("%d: %s\n", (int)common::folderExists(new_path), new_path.c_str()); - } recursiveFolderDelete(new_path); } else{ - if (!common::fileExists(new_path)){ - new_path = path + string((const char*)pri_dirent); - printf("%d: %s\n", (int)common::fileExists(new_path), new_path.c_str()); - } self->deleteFile(new_path); } @@ -950,7 +930,6 @@ void Browser::recursiveFolderDelete(string path){ sceIoDclose(d); //close directory sceIoRmdir(path.substr(0, path.length()-1).c_str()); //delete empty folder - free(pri_dirent); }; } @@ -963,11 +942,6 @@ long Browser::recursiveSize(string path){ { SceIoDirent entry; memset(&entry, 0, sizeof(SceIoDirent)); - - pspMsPrivateDirent *pri_dirent = (pspMsPrivateDirent*)malloc(sizeof(pspMsPrivateDirent)); - memset(pri_dirent, 0, sizeof(pspMsPrivateDirent)); - pri_dirent->size = sizeof(pspMsPrivateDirent); - entry.d_private = (void*)pri_dirent; //allocate memory to store the full file paths string new_path; @@ -987,17 +961,9 @@ long Browser::recursiveSize(string path){ if (common::isFolder(&entry)){ new_path = new_path + "/"; - if (!common::folderExists(new_path)){ - new_path = path + string((const char*)pri_dirent); - printf("%d: %s\n", (int)common::folderExists(new_path), new_path.c_str()); - } total_size += recursiveSize(new_path); } else{ - if (!common::fileExists(new_path)){ - new_path = path + string((const char*)pri_dirent); - printf("%d: %s\n", (int)common::fileExists(new_path), new_path.c_str()); - } total_size += common::fileSize(new_path); } @@ -1005,7 +971,6 @@ long Browser::recursiveSize(string path){ sceIoDclose(d); //close directory sceIoRmdir(path.substr(0, path.length()-1).c_str()); //delete empty folder - free(pri_dirent); } else if ((d=sceIoOpen(path.c_str(), PSP_O_RDONLY, 0777)) >= 0){ total_size = sceIoLseek(d, 0, SEEK_END); @@ -1155,10 +1120,6 @@ int Browser::copy_folder_recursive(const char * source, const char * destination { SceIoDirent entry; memset(&entry, 0, sizeof(SceIoDirent)); - - pspMsPrivateDirent* pri_dirent = (pspMsPrivateDirent*)malloc(sizeof(pspMsPrivateDirent)); - pri_dirent->size = sizeof(pspMsPrivateDirent); - entry.d_private = (void*)pri_dirent; //start reading directory entries while(sceIoDread(dir, &entry) > 0) @@ -1172,23 +1133,10 @@ int Browser::copy_folder_recursive(const char * source, const char * destination string src = new_source + entry.d_name; if (common::isFolder(&entry)){ - string dst; - if (!common::folderExists(src)){ - string sname = string((const char*)pri_dirent); - src = new_source + sname; - dst = new_destination + sname; - printf("%d: %s\n", (int)common::folderExists(src), src.c_str()); - } - else{ - dst = new_destination + entry.d_name; - } + string dst = new_destination + entry.d_name; copy_folder_recursive(src.c_str(), dst.c_str()); } else{ - if (!common::fileExists(src)){ - src = new_source + string((const char*)pri_dirent); - printf("%d: %s\n", (int)common::fileExists(src), src.c_str()); - } if (pasteMode == COPY || (pasteMode == CUT && pspIoMove(src, new_destination) < 0)) copyFile(src, new_destination); //copy file } @@ -1196,7 +1144,6 @@ int Browser::copy_folder_recursive(const char * source, const char * destination }; //close folder sceIoDclose(dir); - free(pri_dirent); }; } diff --git a/extras/menus/arkMenu/src/browser_entries.cpp b/extras/menus/arkMenu/src/browser_entries.cpp index 062d0f726..869cdc379 100644 --- a/extras/menus/arkMenu/src/browser_entries.cpp +++ b/extras/menus/arkMenu/src/browser_entries.cpp @@ -34,7 +34,7 @@ int fileTypeByExtension(string path){ BrowserFile::BrowserFile(){ } -BrowserFile::BrowserFile(string path, string shortname){ +BrowserFile::BrowserFile(string path){ size_t lastSlash = path.rfind('/', string::npos); this->path = path; this->name = path.substr(lastSlash+1, string::npos); @@ -42,18 +42,16 @@ BrowserFile::BrowserFile(string path, string shortname){ this->icon0 = NULL; this->selected = false; this->filetype = FOLDER; - this->setShortName(shortname); this->calcSize(); this->filetype = fileTypeByExtension(getPath()); } -BrowserFile::BrowserFile(string parent, string name, string shortname){ +BrowserFile::BrowserFile(string parent, string name){ this->icon0 = NULL; this->path = parent + name; this->parent = parent; this->name = name; this->selected = false; - this->setShortName(shortname); this->calcSize(); this->filetype = fileTypeByExtension(getPath()); } @@ -61,19 +59,6 @@ BrowserFile::BrowserFile(string parent, string name, string shortname){ BrowserFile::~BrowserFile(){ } -void BrowserFile::setShortName(string shortname){ - this->shortname = ""; - if (shortname.size() > 0 && shortname[0] != 0x14){ - if (this->name.size() < shortname.size()){ - this->path = this->parent + shortname; - this->name = shortname; - } - else { - this->shortname = shortname; - } - } -} - unsigned BrowserFile::getFileSize(){ return common::fileSize(getPath()); } @@ -150,7 +135,7 @@ void BrowserFile::loadAVMedia(){ void BrowserFile::doExecute(){ } -BrowserFolder::BrowserFolder(string path, string shortname){ +BrowserFolder::BrowserFolder(string path){ size_t lastSlash = path.rfind('/', path.length()-2); this->path = path; this->name = path.substr(lastSlash+1, string::npos); @@ -159,11 +144,9 @@ BrowserFolder::BrowserFolder(string path, string shortname){ this->selected = false; this->fileSize = "Folder"; this->filetype = FOLDER; - if (shortname.size() > 0) shortname; - this->setShortName(shortname); } -BrowserFolder::BrowserFolder(string parent, string name, string shortname){ +BrowserFolder::BrowserFolder(string parent, string name){ this->icon0 = NULL; this->path = parent + name + '/'; this->name = name; @@ -171,8 +154,6 @@ BrowserFolder::BrowserFolder(string parent, string name, string shortname){ this->selected = false; this->fileSize = "Folder"; this->filetype = FOLDER; - if (shortname.size() > 0) shortname; - this->setShortName(shortname); } BrowserFolder::~BrowserFolder(){ diff --git a/extras/menus/arkMenu/src/ftp/ftp_driver.cpp b/extras/menus/arkMenu/src/ftp/ftp_driver.cpp index 4f4362465..4a0d40b39 100644 --- a/extras/menus/arkMenu/src/ftp/ftp_driver.cpp +++ b/extras/menus/arkMenu/src/ftp/ftp_driver.cpp @@ -163,7 +163,7 @@ vector FTPDriver::listDirectory(string path){ string file_name(dir->files[i].d_name); file_name = file_name.substr(file_name.find(' ')+1); if (FIO_SO_ISDIR(dir->files[i].st_attr)) { - BrowserFolder* folder = new BrowserFolder(path, file_name, ""); + BrowserFolder* folder = new BrowserFolder(path, file_name); printf("adding folder: %s -> %s\n", file_name.c_str(), folder->getName().c_str()); folders.push_back(folder); } else if (FIO_SO_ISREG(dir->files[i].st_attr)) { @@ -195,8 +195,8 @@ vector FTPDriver::listDirectory(string path){ if (dot) folders.insert(folders.begin(), dot); } - ret.push_back(new BrowserFolder("ftp:/", "", "")); - ret.push_back(new BrowserFolder("ftp:/", "", "")); + ret.push_back(new BrowserFolder("ftp:/", "")); + ret.push_back(new BrowserFolder("ftp:/", "")); printf("FTP::Folders -> %d\n", folders.size()); for (int i=0; isize = sizeof(pspMsPrivateDirent); - entry.d_private = (void*)pri_dirent; - if (dir < 0) return; @@ -247,7 +243,6 @@ void GameManager::findISOs(const char* path){ if (dit->d_name[0] == '.' && !common::getConf()->show_hidden) continue; string fullpath = string(path)+string(dit->d_name); - string shortpath = string(path) + string((const char*)pri_dirent); if (FIO_SO_ISDIR(dit->d_stat.st_attr)){ if (common::getConf()->scan_cat && string(dit->d_name) != string("VIDEO")){ @@ -256,10 +251,8 @@ void GameManager::findISOs(const char* path){ continue; } if (Iso::isISO(fullpath.c_str())) this->categories[GAME]->addEntry(new Iso(fullpath)); - else if (Iso::isISO(shortpath.c_str())) this->categories[GAME]->addEntry(new Iso(shortpath)); } sceIoDclose(dir); - free(pri_dirent); } void GameManager::findSaveEntries(const char* path){