Hello,
Figured out the other day how to load GOD games from Quicklaunch. You might see something like this for games that are not in GOD(games on demand) mode. XLaunchNewImage("xblive:\\Games\\B02\\default_mp.xex", NULL); which allows people to launch games from dashhome. Well the below code will allow you to load GOD games from dashhome as well.
const wchar_t* GetWC(const char* c) {
const size_t cSize = strlen(c) + 1;
wchar_t* wc = new wchar_t[cSize];
mbstowcs(wc, c, cSize);
return wc;
}
char vaBuffer[0x1000];
char* va(const char* fmt, ...) {
memset(vaBuffer, 0, 0x1000);
va_list ap;
va_start(ap, fmt);
RtlVsprintf(vaBuffer, fmt, ap); // RtlVsprintf
va_end(ap);
return vaBuffer;
}
std::vector<std::string> xFiles; bool NoGOD = true;
HRESULT xGetFiles(bool bNoneOption, bool USB, int CurrentGame) {
xFiles.clear();
WIN32_FIND_DATA wFile;
HANDLE hFind;
if (bNoneOption)
xFiles.push_back(std::string("No Plugin"));
/*Black ops 2*/
if (CurrentGame = 1) hFind = FindFirstFileA(USB ? "USB:\\Content\\0000000000000000\\415608C3\\00007000\\*" : "HDD:\\Content\\0000000000000000\\415608C3\\00007000\\*", &wFile);
if (INVALID_HANDLE_VALUE != hFind) {
do {
if (!strstr(wFile.cFileName, ".ini") && !strstr(wFile.cFileName, ".log") && !strstr(wFile.cFileName, ".txt") && !strstr(wFile.cFileName, ".bin") && !strstr(wFile.cFileName, ".wmv") && wFile.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY && wFile.dwFileAttributes != FILE_ATTRIBUTE_HIDDEN) {
xFiles.push_back(std::string(wFile.cFileName));
LOG_PRINT("GOD Game: %ls", GetWC(wFile.cFileName));
NoGOD = true;
}
} while (FindNextFileA(hFind, &wFile) != 0);
FindClose(hFind);
}
else {
LOG_PRINT("No GOD Game Found on %s ", USB ? "USB":"HDD");
NoGOD = false;
return S_FALSE;
}
return S_OK;
}
void B02() {
bool USB = true; bool NOption = true; int CurrentGame = 1;
/*Black OPS 2 GOD Multiplayer*/
if (SUCCEEDED(xGetFiles(NOption, USB, CurrentGame))) {
if (NoGOD) {
LOG_PRINT("Loading GOD Game %ls from USB", GetWC(xFiles.at(1).c_str()));
XContentLaunchImageFromFile((const char*)va("USB:\\Content\\0000000000000000\\415608C3\\00007000\\%ls", GetWC(xFiles.at(1).c_str())), "default_mp.xex");
}
else
{
goto start;
}
}
start:
if (SUCCEEDED(xGetFiles(NOption, USB = false, CurrentGame))) {
if (NoGOD) {
LOG_PRINT("Loading GOD Game %ls from HDD", Utils::GetWC(xFiles.at(1).c_str()));
XContentLaunchImageFromFile((const char*)va("HDD:\\Content\\0000000000000000\\415608C3\\00007000\\%ls", Utils::GetWC(xFiles.at(1).c_str())), "default_mp.xex");
}
}
else
{
LOG_PRINT("No GOD Game Found. Exiting thread..");
ExitThread(0);
}
}
VOID MakeThread(LPTHREAD_START_ROUTINE Address)
{
HANDLE Handle = 0;
ExCreateThread(&Handle, 0, 0, XapiThreadStartup, Address, 0, (EX_CREATE_FLAG_SUSPENDED | EX_CREATE_FLAG_SYSTEM | 0x18000424));
XSetThreadProcessor(Handle, 4);
SetThreadPriority(Handle, THREAD_PRIORITY_ABOVE_NORMAL);
ResumeThread(Handle);
CloseHandle(Handle);
}
//Initiate through thread
MakeThread((LPTHREAD_START_ROUTINE)B02);
thanks,
-silent
Figured out the other day how to load GOD games from Quicklaunch. You might see something like this for games that are not in GOD(games on demand) mode. XLaunchNewImage("xblive:\\Games\\B02\\default_mp.xex", NULL); which allows people to launch games from dashhome. Well the below code will allow you to load GOD games from dashhome as well.
const wchar_t* GetWC(const char* c) {
const size_t cSize = strlen(c) + 1;
wchar_t* wc = new wchar_t[cSize];
mbstowcs(wc, c, cSize);
return wc;
}
char vaBuffer[0x1000];
char* va(const char* fmt, ...) {
memset(vaBuffer, 0, 0x1000);
va_list ap;
va_start(ap, fmt);
RtlVsprintf(vaBuffer, fmt, ap); // RtlVsprintf
va_end(ap);
return vaBuffer;
}
std::vector<std::string> xFiles; bool NoGOD = true;
HRESULT xGetFiles(bool bNoneOption, bool USB, int CurrentGame) {
xFiles.clear();
WIN32_FIND_DATA wFile;
HANDLE hFind;
if (bNoneOption)
xFiles.push_back(std::string("No Plugin"));
/*Black ops 2*/
if (CurrentGame = 1) hFind = FindFirstFileA(USB ? "USB:\\Content\\0000000000000000\\415608C3\\00007000\\*" : "HDD:\\Content\\0000000000000000\\415608C3\\00007000\\*", &wFile);
if (INVALID_HANDLE_VALUE != hFind) {
do {
if (!strstr(wFile.cFileName, ".ini") && !strstr(wFile.cFileName, ".log") && !strstr(wFile.cFileName, ".txt") && !strstr(wFile.cFileName, ".bin") && !strstr(wFile.cFileName, ".wmv") && wFile.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY && wFile.dwFileAttributes != FILE_ATTRIBUTE_HIDDEN) {
xFiles.push_back(std::string(wFile.cFileName));
LOG_PRINT("GOD Game: %ls", GetWC(wFile.cFileName));
NoGOD = true;
}
} while (FindNextFileA(hFind, &wFile) != 0);
FindClose(hFind);
}
else {
LOG_PRINT("No GOD Game Found on %s ", USB ? "USB":"HDD");
NoGOD = false;
return S_FALSE;
}
return S_OK;
}
void B02() {
bool USB = true; bool NOption = true; int CurrentGame = 1;
/*Black OPS 2 GOD Multiplayer*/
if (SUCCEEDED(xGetFiles(NOption, USB, CurrentGame))) {
if (NoGOD) {
LOG_PRINT("Loading GOD Game %ls from USB", GetWC(xFiles.at(1).c_str()));
XContentLaunchImageFromFile((const char*)va("USB:\\Content\\0000000000000000\\415608C3\\00007000\\%ls", GetWC(xFiles.at(1).c_str())), "default_mp.xex");
}
else
{
goto start;
}
}
start:
if (SUCCEEDED(xGetFiles(NOption, USB = false, CurrentGame))) {
if (NoGOD) {
LOG_PRINT("Loading GOD Game %ls from HDD", Utils::GetWC(xFiles.at(1).c_str()));
XContentLaunchImageFromFile((const char*)va("HDD:\\Content\\0000000000000000\\415608C3\\00007000\\%ls", Utils::GetWC(xFiles.at(1).c_str())), "default_mp.xex");
}
}
else
{
LOG_PRINT("No GOD Game Found. Exiting thread..");
ExitThread(0);
}
}
VOID MakeThread(LPTHREAD_START_ROUTINE Address)
{
HANDLE Handle = 0;
ExCreateThread(&Handle, 0, 0, XapiThreadStartup, Address, 0, (EX_CREATE_FLAG_SUSPENDED | EX_CREATE_FLAG_SYSTEM | 0x18000424));
XSetThreadProcessor(Handle, 4);
SetThreadPriority(Handle, THREAD_PRIORITY_ABOVE_NORMAL);
ResumeThread(Handle);
CloseHandle(Handle);
}
//Initiate through thread
MakeThread((LPTHREAD_START_ROUTINE)B02);
thanks,
-silent