add Functions to Launch GOD xbox 1
In ContentList.Cpp Replace
CODE
void ContentList::ScanXBLAPath(int type, wstring path)
{
WIN32_FIND_DATA findFileData;
memset(&findFileData,0,sizeof(WIN32_FIND_DATA));
wstring searchcmd = path + L"\\0000000000000000\\*.*";
searchcmd = str_replaceall(searchcmd,L"\\\\",L"\\");
HANDLE hFind = FindFirstFile(wstrtostr(searchcmd).c_str(), &findFileData);
if (hFind == INVALID_HANDLE_VALUE)
return;
int SubDirCount = 0;
do {
SubDirCount++;
} while (FindNextFile(hFind, &findFileData));
FindClose(hFind);
hFind = FindFirstFile(wstrtostr(searchcmd).c_str(), &findFileData);
sub2ProgMax = SubDirCount;
sub2ProgCur = 0;
do {
SetSub2(strtowstr(findFileData.cFileName));
map::iterator itr;
wstring thispath = make_lowercase(strtowstr(findFileData.cFileName));
itr = PathLookup.find(thispath);
if (itr != PathLookup.end())
{
//DebugMsg("Skipping XBLA path %s (%s\\0000000000000000\\%s)",findFileData.cFileName,path.c_str(),findFileData.cFileName);
(*itr).second->Exist = true;
} else {
//DebugMsg("Scanning XBLA path %s (%s\\0000000000000000\\%s)",findFileData.cFileName,path.c_str(),findFileData.cFileName);
ScanXBLAGame(0,path,strtowstr(findFileData.cFileName));
ScanGODGame(5,path,strtowstr(findFileData.cFileName));
ScanXBOXGame(5,path,strtowstr(findFileData.cFileName));
}
sub2ProgCur++;
} while (FindNextFile(hFind, &findFileData));
FindClose(hFind);
}
In ContentList.CPP Replace
CODE
void ContentList::LaunchGame(ContentItem * item)
{
LastRecent++;
item->recent = LastRecent;
SortMaxRecents();
DoSaveSettings();
//Reset LED to factory if in Temp Mode
if(LedType == 1)
{
SetLedState(0);
}
wstring filetorun = make_lowercase(item->path);
wstring ext = FileExt(filetorun);
if (ext == L"xex")
{
//DebugMsg("Launching XEX %s",item->path.c_str());
XLaunchNewImage(wstrtostr(item->path).c_str(), NULL);
} else if (ext == L"xbe")
{
//DebugMsg("Launching XBE %s",item->path.c_str());
XLaunchNewImage(wstrtostr(item->path).c_str(), NULL);
} else {
//DebugMsg("Launching XBLA %s",item->path.c_str());
string drive = wstrtostr(item->path.substr(0,item->path.find(L":")+1));
string folder = wstrtostr(item->path.substr(item->path.find(L":")+2));
u32 ret;
//DebugMsg("XBLA : drive : \"%s\"",drive.c_str());
//DebugMsg("XBLA : folder : \"%s\"",folder.c_str());
char mntpth[] = "dice";
char drive_s[256];
strcpy_s(drive_s, 256, drive.c_str());
char folder_s[1024];
strcpy_s(folder_s, 1024, folder.c_str());
ret = mountCon(mntpth, drive_s, folder_s);
//DebugMsg("Mount XBLA returns %d",ret);
FILE* fp = NULL;
fp = fopen( "dice:\\default.xex", "rb" );
if( fp != NULL )
{
fclose( fp );
XLaunchNewImage("dice:\\default.xex", 0);
}
XLaunchNewImage("dice:\\default.xbe", 0);
}
}
In ContentList.CPP Add
CODE
void ContentList::ScanXBOXGame(int type, wstring path, wstring id)
{
WIN32_FIND_DATA findFileData;
memset(&findFileData,0,sizeof(WIN32_FIND_DATA));
wstring searchcmd = path + L"\\0000000000000000\\" + id + L"\\00005000\\*";
searchcmd = str_replaceall(searchcmd,L"\\\\",L"\\");
HANDLE hFind = FindFirstFile(wstrtostr(searchcmd).c_str(), &findFileData);
if (hFind == INVALID_HANDLE_VALUE)
return;
do {
if (findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
} else {
wstring s = strtowstr(findFileData.cFileName);
ContentItem * item = new ContentItem();
item->path = sprintfa(L"%s0000000000000000\\%s\\00005000\\%s",path.c_str(),id.c_str(),s.c_str());
//DebugMsg("Adding XBLX %s",item->path.c_str());
item->type = type;
item->c_type = type;
item->id = id;
item->Exist = true;
item->source = 3;
item->imagefolder = id;
MakeShortPath(item);
AnyChanged = true;
XBOXParse(item);
Content.push_back(item);
}
} while (FindNextFile(hFind, &findFileData));
FindClose(hFind);
}
In ContentList.CPP Add
CODE
void ContentList::XBOXParse(ContentItem * item)
{
//DebugMsg("Parsing XBLA %s",item->path.c_str());
FILE * fp = NULL;
_wfopen_s(&fp,item->path.c_str(),L"rb");
if (!fp)
{
DebugMsg("Unable to open %S",item->path.c_str());
return;
}
byte k[4];
fseek(fp,0x344,SEEK_SET);
fread((void*)(&k),4,1,fp);
item->packagetype = sprintfa(L"%02x%02x%02x%02x",k[0],k[1],k[2],k[3]);
if (item->packagetype != L"00050000")
{
DebugMsg("Not Arcade game -> %S",item->packagetype.c_str());
fclose(fp);
return;
}
fseek(fp,0x360,SEEK_SET);
fread((void*)(&k),4,1,fp);
// item->id = sprintfa(L"%02x%02x%02x%02x",k[0],k[1],k[2],k[3]);
WCHAR title[0x400];
memset(title,0,0x400);
fseek(fp,0x411,SEEK_SET);
fread((void*)(&title),2,0xFF,fp);
item->title = title;
item->title = str_replaceall(item->title,L"\"",L"");
fclose(fp);
if (!FileExists(datapath + L"artwork"))
_wmkdir(wstring(datapath + L"artwork").c_str());
if (!FileExists(datapath + L"artwork\\" + item->imagefolder))
_wmkdir(wstring(datapath + L"artwork\\" + item->imagefolder).c_str());
wstring outfile = datapath + L"artwork\\" + item->imagefolder + L"\\icon.png";
if (!FileExists(outfile))
{
if (ExtractLiveImage(outfile,item->path,0))
{
item->i_Icon = true;
}
} else {
item->i_Icon = true;
}
}
In ContentList.h add
CODE
void ScanXBOXGame(int type, wstring path, wstring id);
void XBOXParse(ContentItem * item);
This post has been edited by max2010: Mar 12 2010, 05:43 PM