Fix LBN bug

This commit is contained in:
Henrik Rydgard 2012-11-09 12:32:35 +01:00
parent d671afdef4
commit ee1f0022ff
2 changed files with 18 additions and 4 deletions

View File

@ -23,13 +23,16 @@
const int sectorSize = 2048;
static void parseLBN(std::string filename, u32 *sectorStart, u32 *readSize)
static bool parseLBN(std::string filename, u32 *sectorStart, u32 *readSize)
{
if (filename.substr(0, 8) != "/sce_lbn")
return false;
std::string yo = filename;
filename.erase(0,10);
filename.erase(0, 10);
sscanf(filename.c_str(), "%08x", sectorStart);
filename.erase(0,filename.find('_') + 5);
filename.erase(0, filename.find("_size") + 7);
sscanf(filename.c_str(), "%08x", readSize);
return true;
}
#pragma pack(push)
@ -273,6 +276,16 @@ ISOFileSystem::TreeEntry *ISOFileSystem::GetFromPath(std::string path)
u32 ISOFileSystem::OpenFile(std::string filename, FileAccess access)
{
// LBN unittest
/*
u32 a, b;
if (parseLBN("/sce_lbn0x307aa_size0xefffe000", &a, &b)) {
ERROR_LOG(FILESYS, "lbn: %08x %08x", a, b);
} else {
ERROR_LOG(FILESYS, "faillbn: %08x %08x", a, b);
}*/
OpenFileEntry entry;
if (filename.compare(0,8,"/sce_lbn") == 0)
{

View File

@ -51,7 +51,6 @@ tests_next = [
"threads/vpl/vpl",
"threads/vtimers/vtimers",
"threads/wakeup/wakeup",
"umd/umd",
"umd/callbacks/umd",
"umd/io/umd_io",
"umd/raw_access/raw_access",
@ -64,6 +63,8 @@ tests_next = [
tests_ignored = [
"kirk/kirk",
"me/me",
"umd/umd", # mostly fixed but output seems broken? (first retval of unregister...)
]