The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (Linux)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Some words about /Core/PSPLoaders.cpp
01-30-2013, 02:59 PM
Post: #1
Some words about /Core/PSPLoaders.cpp
Code:
bool Load_PSP_ISO(const char *filename, std::string *error_string)
{
    ISOFileSystem *umd2 = new ISOFileSystem(&pspFileSystem, constructBlockDevice(filename));

    // Parse PARAM.SFO

    //pspFileSystem.Mount("host0:",umd2);
    pspFileSystem.Mount("umd0:", umd2);
    pspFileSystem.Mount("umd1:", umd2);
    pspFileSystem.Mount("disc0:", umd2);
    pspFileSystem.Mount("umd:", umd2);

    std::string sfoPath("disc0:/PSP_GAME/PARAM.SFO");
    PSPFileInfo fileInfo = pspFileSystem.GetFileInfo(sfoPath.c_str());
    if (fileInfo.exists)
    {
        u8 *paramsfo = new u8[(size_t)fileInfo.size];
        u32 fd = pspFileSystem.OpenFile(sfoPath, FILEACCESS_READ);
        pspFileSystem.ReadFile(fd, paramsfo, fileInfo.size);
        pspFileSystem.CloseFile(fd);
        if (g_paramSFO.ReadSFO(paramsfo, (size_t)fileInfo.size))
        {
            char title[1024];
            sprintf(title, "%s : %s", g_paramSFO.GetValueString("DISC_ID").c_str(), g_paramSFO.GetValueString("TITLE").c_str());
            INFO_LOG(LOADER, "%s", title);
            host->SetWindowTitle(title);
        }
        delete [] paramsfo;
    }


    std::string bootpath("disc0:/PSP_GAME/SYSDIR/EBOOT.BIN");
    // bypass patchers
    if (pspFileSystem.GetFileInfo("disc0:/PSP_GAME/SYSDIR/EBOOT.OLD").exists) {
        bootpath = "disc0:/PSP_GAME/SYSDIR/EBOOT.OLD";
    }
    bool hasEncrypted = false;
    u32 fd;
    if ((fd = pspFileSystem.OpenFile(bootpath, FILEACCESS_READ)) != 0)
    {
        u8 head[4];
        pspFileSystem.ReadFile(fd, head, 4);
        if (memcmp(head, "~PSP", 4) == 0 || memcmp(head, "\x7F""ELF", 4) == 0) {
            hasEncrypted = true;
        }
        pspFileSystem.CloseFile(fd);
    }
    if (!hasEncrypted)
    {
        // try unencrypted BOOT.BIN
        bootpath = "disc0:/PSP_GAME/SYSDIR/BOOT.BIN";
    }

    INFO_LOG(LOADER,"Loading %s...", bootpath.c_str());
    return __KernelLoadExec(bootpath.c_str(), 0, error_string);
}
Most of games has an empty BOOT.BIN file. I think that BOOT.BIN must me checked for zero header (0x00000000) before loading.
P.S. Interesting thing - size of BOOT.BIN is equal with decrypted EBOOT.BIN =)


Attached File(s) Thumbnail(s)
               
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Some words about /Core/PSPLoaders.cpp - RealYoti - 01-30-2013 02:59 PM

Forum Jump: