diff --git a/source/main.cpp b/source/main.cpp index 194f70c..17dd36a 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -21,225 +22,347 @@ typedef enum { LAUNCH_TITLE } Mode; +std::vector extensions = {"cia"}; + +bool exit = false; +bool showNetworkPrompts = true; +u64 freeSpace = 0; +MediaType destination = SD; +Mode mode = INSTALL_CIA; + +int prevProgress = -1; +std::string installInfo = ""; + +bool onProgress(u64 pos, u64 totalSize) { + u32 progress = (u32) ((pos * 100) / totalSize); + if(prevProgress != (int) progress) { + prevProgress = (int) progress; + + std::stringstream details; + details << installInfo; + details << "Press B to cancel."; + + uiDisplayProgress(TOP_SCREEN, "Installing", details.str(), true, progress); + } + + inputPoll(); + return !inputIsPressed(BUTTON_B); +} + +void networkInstall() { + while(platformIsRunning()) { + gpuClearScreens(); + + RemoteFile file = uiAcceptRemoteFile(TOP_SCREEN, [&](std::stringstream& infoStream) { + if(inputIsPressed(BUTTON_A)) { + showNetworkPrompts = !showNetworkPrompts; + } + + infoStream << "\n"; + infoStream << "Prompts: " << (showNetworkPrompts ? "Enabled" : "Disabled") << "\n"; + infoStream << "Press A to toggle prompts."; + }); + + if(file.fd == NULL) { + break; + } + + std::stringstream confirmStream; + confirmStream << "Install the received application?" << "\n"; + confirmStream << "Size: " << file.fileSize << " bytes (" << std::fixed << std::setprecision(2) << file.fileSize / 1024.0f / 1024.0f << "MB)"; + if(!showNetworkPrompts || uiPrompt(TOP_SCREEN, confirmStream.str(), true)) { + AppResult ret = appInstall(destination, file.fd, file.fileSize, &onProgress); + prevProgress = -1; + if(showNetworkPrompts || ret != APP_SUCCESS) { + std::stringstream resultMsg; + resultMsg << "Install "; + if(ret == APP_SUCCESS) { + resultMsg << "succeeded!"; + } else { + resultMsg << "failed!" << "\n"; + resultMsg << appGetResultString(ret); + } + + uiPrompt(TOP_SCREEN, resultMsg.str(), false); + } + } + + fclose(file.fd); + } +} + +void installROP() { + u32 selected = 0; + bool dirty = true; + while(platformIsRunning()) { + inputPoll(); + if(inputIsPressed(BUTTON_B)) { + break; + } + + if(inputIsPressed(BUTTON_A)) { + std::stringstream stream; + stream << "Install the selected ROP?" << "\n"; + stream << ropNames[selected]; + + if(uiPrompt(TOP_SCREEN, stream.str(), true)) { + u16 userSettingsOffset = 0; + bool result = norRead(0x20, &userSettingsOffset, 2) && norWrite(userSettingsOffset << 3, rops[selected], ROP_SIZE); + + std::stringstream resultMsg; + resultMsg << "ROP installation "; + if(result) { + resultMsg << "succeeded!"; + } else { + resultMsg << "failed!" << "\n"; + resultMsg << platformGetErrorString(platformGetError()); + } + + uiPrompt(TOP_SCREEN, resultMsg.str(), false); + } + + dirty = true; + } + + if(inputIsPressed(BUTTON_LEFT)) { + if(selected == 0) { + selected = ROP_COUNT - 1; + } else { + selected--; + } + + dirty = true; + } + + if(inputIsPressed(BUTTON_RIGHT)) { + if(selected >= ROP_COUNT - 1) { + selected = 0; + } else { + selected++; + } + + dirty = true; + } + + if(dirty) { + std::stringstream stream; + stream << "Select a ROP to install." << "\n"; + stream << "< " << ropNames[selected] << " >" << "\n"; + stream << "Press A to install, B to cancel."; + uiDisplayMessage(TOP_SCREEN, stream.str()); + } + } +} + +bool installCIA(MediaType destination, const std::string path, const std::string fileName) { + std::string name = fileName; + if(name.length() > 40) { + name.resize(40); + name += "..."; + } + + std::stringstream batchInstallStream; + batchInstallStream << name << "\n"; + installInfo = batchInstallStream.str(); + + AppResult ret = appInstallFile(destination, path, &onProgress); + prevProgress = -1; + installInfo = ""; + + if(ret != APP_SUCCESS && platformHasError()) { + Error error = platformGetError(); + if(error.module == MODULE_NN_AM && error.description == DESCRIPTION_ALREADY_EXISTS) { + std::stringstream overwriteMsg; + overwriteMsg << "Title already installed, overwrite?" << "\n"; + overwriteMsg << name; + if(uiPrompt(TOP_SCREEN, overwriteMsg.str(), true)) { + uiDisplayMessage(TOP_SCREEN, "Deleting title..."); + AppResult deleteRet = appDelete(appGetCiaInfo(path, destination)); + if(deleteRet != APP_SUCCESS) { + std::stringstream resultMsg; + resultMsg << "Delete failed!" << "\n"; + resultMsg << name << "\n"; + resultMsg << appGetResultString(deleteRet); + uiPrompt(TOP_SCREEN, resultMsg.str(), false); + + return false; + } + + ret = appInstallFile(destination, path, &onProgress); + prevProgress = -1; + installInfo = ""; + } else { + platformSetError(error); + } + } else { + platformSetError(error); + } + } + + if(ret != APP_SUCCESS) { + std::stringstream resultMsg; + resultMsg << "Install failed!" << "\n"; + resultMsg << name << "\n"; + resultMsg << appGetResultString(ret); + uiPrompt(TOP_SCREEN, resultMsg.str(), false); + + return false; + } + + return true; +} + +bool deleteCIA(const std::string path, const std::string fileName) { + std::string name = fileName; + if(name.length() > 40) { + name.resize(40); + name += "..."; + } + + std::stringstream deleteStream; + deleteStream << "Deleting CIA..." << "\n"; + deleteStream << name; + uiDisplayMessage(TOP_SCREEN, deleteStream.str()); + + if(remove(path.c_str()) != 0) { + std::stringstream resultMsg; + resultMsg << "Delete failed!" << "\n"; + resultMsg << name << "\n"; + resultMsg << strerror(errno); + uiPrompt(TOP_SCREEN, resultMsg.str(), false); + + return false; + } + + return true; +} + +bool deleteTitle(App app) { + uiDisplayMessage(TOP_SCREEN, "Deleting title..."); + AppResult ret = appDelete(app); + + if(ret != APP_SUCCESS) { + std::stringstream resultMsg; + resultMsg << "Delete failed!" << "\n"; + resultMsg << appGetResultString(ret); + uiPrompt(TOP_SCREEN, resultMsg.str(), false); + + return false; + } + + return true; +} + +bool launchTitle(App app) { + uiDisplayMessage(TOP_SCREEN, "Launching title..."); + AppResult ret = appLaunch(app); + + if(ret != APP_SUCCESS) { + std::stringstream resultMsg; + resultMsg << "Launch failed!" << "\n"; + resultMsg << appGetResultString(ret); + uiPrompt(TOP_SCREEN, resultMsg.str(), false); + + return false; + } + + return true; +} + +bool onLoop() { + bool ninjhax = platformIsNinjhax(); + if(ninjhax && inputIsPressed(BUTTON_START)) { + exit = true; + return true; + } + + bool breakLoop = false; + + if(inputIsPressed(BUTTON_L)) { + if(destination == SD) { + destination = NAND; + } else { + destination = SD; + } + + freeSpace = fsGetFreeSpace(destination); + if(mode == DELETE_TITLE || mode == LAUNCH_TITLE) { + breakLoop = true; + } + } + + if(inputIsPressed(BUTTON_R)) { + if(mode == INSTALL_CIA) { + mode = DELETE_CIA; + } else if(mode == DELETE_CIA) { + mode = DELETE_TITLE; + breakLoop = true; + } else if(mode == DELETE_TITLE) { + mode = LAUNCH_TITLE; + } else if(mode == LAUNCH_TITLE) { + mode = INSTALL_CIA; + breakLoop = true; + } + } + + if(mode == INSTALL_CIA && inputIsPressed(BUTTON_Y)) { + networkInstall(); + } + + if(inputIsPressed(BUTTON_SELECT)) { + installROP(); + } + + std::stringstream stream; + stream << "Battery: "; + if(platformIsBatteryCharging()) { + stream << "Charging"; + } else { + for(u32 i = 0; i < platformGetBatteryLevel(); i++) { + stream << "|"; + } + } + + stream << ", WiFi: "; + if(!platformIsWifiConnected()) { + stream << "Disconnected"; + } else { + for(u32 i = 0; i < platformGetWifiLevel(); i++) { + stream << "|"; + } + } + + stream << "\n"; + + stream << "Free Space: " << freeSpace << " bytes (" << std::fixed << std::setprecision(2) << freeSpace / 1024.0f / 1024.0f << "MB)" << "\n"; + stream << "Destination: " << (destination == NAND ? "NAND" : "SD") << ", Mode: " << (mode == INSTALL_CIA ? "Install CIA" : mode == DELETE_CIA ? "Delete CIA" : mode == DELETE_TITLE ? "Delete Title" : "Launch Title") << "\n"; + stream << "L - Switch Destination, R - Switch Mode" << "\n"; + if(mode == INSTALL_CIA) { + stream << "X - Install all CIAs in the current directory" << "\n"; + stream << "Y - Receive an app over the network" << "\n"; + } else if(mode == DELETE_CIA) { + stream << "X - Delete all CIAs in the current directory" << "\n"; + } + + stream << "SELECT - Install MSET ROP"; + + if(ninjhax) { + stream << "\n" << "START - Exit to launcher"; + } + + std::string str = stream.str(); + const std::string title = "FBI v1.4.3"; + gputDrawString(title, (gpuGetViewportWidth() - gputGetStringWidth(title, 16)) / 2, (gpuGetViewportHeight() - gputGetStringHeight(title, 16) + gputGetStringHeight(str, 8)) / 2, 16, 16); + gputDrawString(str, (gpuGetViewportWidth() - gputGetStringWidth(str, 8)) / 2, 4, 8, 8); + + return breakLoop; +} + int main(int argc, char **argv) { if(!platformInit()) { return 0; } - bool ninjhax = platformIsNinjhax(); - - std::vector extensions; - extensions.push_back("cia"); - - MediaType destination = SD; - Mode mode = INSTALL_CIA; - bool exit = false; - bool showNetworkPrompts = true; - u64 freeSpace = fsGetFreeSpace(destination); - - std::string batchInfo = ""; - int prevProgress = -1; - auto onProgress = [&](u64 pos, u64 totalSize) { - u32 progress = (u32) ((pos * 100) / totalSize); - if(prevProgress != (int) progress) { - prevProgress = (int) progress; - - std::stringstream details; - details << batchInfo; - details << "Press B to cancel."; - - uiDisplayProgress(TOP_SCREEN, "Installing", details.str(), true, progress); - } - - inputPoll(); - return !inputIsPressed(BUTTON_B); - }; - - auto onLoop = [&]() { - if(ninjhax && inputIsPressed(BUTTON_START)) { - exit = true; - return true; - } - - bool breakLoop = false; - - if(inputIsPressed(BUTTON_L)) { - if(destination == SD) { - destination = NAND; - } else { - destination = SD; - } - - freeSpace = fsGetFreeSpace(destination); - if(mode == DELETE_TITLE || mode == LAUNCH_TITLE) { - breakLoop = true; - } - } - - if(inputIsPressed(BUTTON_R)) { - if(mode == INSTALL_CIA) { - mode = DELETE_CIA; - } else if(mode == DELETE_CIA) { - mode = DELETE_TITLE; - breakLoop = true; - } else if(mode == DELETE_TITLE) { - mode = LAUNCH_TITLE; - } else if(mode == LAUNCH_TITLE) { - mode = INSTALL_CIA; - breakLoop = true; - } - } - - if(mode == INSTALL_CIA && inputIsPressed(BUTTON_Y)) { - while(platformIsRunning()) { - gpuClearScreens(); - - RemoteFile file = uiAcceptRemoteFile(TOP_SCREEN, [&](std::stringstream& infoStream) { - if(inputIsPressed(BUTTON_A)) { - showNetworkPrompts = !showNetworkPrompts; - } - - infoStream << "\n"; - infoStream << "Prompts: " << (showNetworkPrompts ? "Enabled" : "Disabled") << "\n"; - infoStream << "Press A to toggle prompts."; - }); - - if(file.fd == NULL) { - break; - } - - std::stringstream confirmStream; - confirmStream << "Install the received application?" << "\n"; - confirmStream << "Size: " << file.fileSize << " bytes (" << std::fixed << std::setprecision(2) << file.fileSize / 1024.0f / 1024.0f << "MB)"; - if(!showNetworkPrompts || uiPrompt(TOP_SCREEN, confirmStream.str(), true)) { - AppResult ret = appInstall(destination, file.fd, file.fileSize, onProgress); - prevProgress = -1; - if(showNetworkPrompts || ret != APP_SUCCESS) { - std::stringstream resultMsg; - resultMsg << "Install "; - if(ret == APP_SUCCESS) { - resultMsg << "succeeded!"; - } else { - resultMsg << "failed!" << "\n"; - resultMsg << appGetResultString(ret); - } - - uiPrompt(TOP_SCREEN, resultMsg.str(), false); - } - } - - fclose(file.fd); - } - } - - if(inputIsPressed(BUTTON_SELECT)) { - u32 selected = 0; - bool dirty = true; - while(platformIsRunning()) { - inputPoll(); - if(inputIsPressed(BUTTON_B)) { - break; - } - - if(inputIsPressed(BUTTON_A)) { - std::stringstream stream; - stream << "Install the selected ROP?" << "\n"; - stream << ropNames[selected]; - - if(uiPrompt(TOP_SCREEN, stream.str(), true)) { - u16 userSettingsOffset = 0; - bool result = norRead(0x20, &userSettingsOffset, 2) && norWrite(userSettingsOffset << 3, rops[selected], ROP_SIZE); - - std::stringstream resultMsg; - resultMsg << "ROP installation "; - if(result) { - resultMsg << "succeeded!"; - } else { - resultMsg << "failed!" << "\n"; - resultMsg << platformGetErrorString(platformGetError()); - } - - uiPrompt(TOP_SCREEN, resultMsg.str(), false); - } - - dirty = true; - } - - if(inputIsPressed(BUTTON_LEFT)) { - if(selected == 0) { - selected = ROP_COUNT - 1; - } else { - selected--; - } - - dirty = true; - } - - if(inputIsPressed(BUTTON_RIGHT)) { - if(selected >= ROP_COUNT - 1) { - selected = 0; - } else { - selected++; - } - - dirty = true; - } - - if(dirty) { - std::stringstream stream; - stream << "Select a ROP to install." << "\n"; - stream << "< " << ropNames[selected] << " >" << "\n"; - stream << "Press A to install, B to cancel."; - uiDisplayMessage(TOP_SCREEN, stream.str()); - } - } - } - - std::stringstream stream; - stream << "Battery: "; - if(platformIsBatteryCharging()) { - stream << "Charging"; - } else { - for(u32 i = 0; i < platformGetBatteryLevel(); i++) { - stream << "|"; - } - } - - stream << ", WiFi: "; - if(!platformIsWifiConnected()) { - stream << "Disconnected"; - } else { - for(u32 i = 0; i < platformGetWifiLevel(); i++) { - stream << "|"; - } - } - - stream << "\n"; - - stream << "Free Space: " << freeSpace << " bytes (" << std::fixed << std::setprecision(2) << freeSpace / 1024.0f / 1024.0f << "MB)" << "\n"; - stream << "Destination: " << (destination == NAND ? "NAND" : "SD") << ", Mode: " << (mode == INSTALL_CIA ? "Install CIA" : mode == DELETE_CIA ? "Delete CIA" : mode == DELETE_TITLE ? "Delete Title" : "Launch Title") << "\n"; - stream << "L - Switch Destination, R - Switch Mode" << "\n"; - if(mode == INSTALL_CIA) { - stream << "X - Install all CIAs in the current directory" << "\n"; - stream << "Y - Receive an app over the network" << "\n"; - } else if(mode == DELETE_CIA) { - stream << "X - Delete all CIAs in the current directory" << "\n"; - } - - stream << "SELECT - Install MSET ROP"; - - if(ninjhax) { - stream << "\n" << "START - Exit to launcher"; - } - - std::string str = stream.str(); - const std::string title = "FBI v1.4.2"; - gputDrawString(title, (gpuGetViewportWidth() - gputGetStringWidth(title, 16)) / 2, (gpuGetViewportHeight() - gputGetStringHeight(title, 16) + gputGetStringHeight(str, 8)) / 2, 16, 16); - gputDrawString(str, (gpuGetViewportWidth() - gputGetStringWidth(str, 8)) / 2, 4, 8, 8); - - return breakLoop; - }; - while(platformIsRunning()) { if(mode == INSTALL_CIA || mode == DELETE_CIA) { uiDisplayMessage(BOTTOM_SCREEN, "Loading file list..."); @@ -258,78 +381,24 @@ int main(int argc, char **argv) { if(uiPrompt(TOP_SCREEN, confirmMsg.str(), true)) { bool failed = false; std::vector contents = fsGetDirectoryContents(currDirectory); - u32 currItem = 0; for(std::vector::iterator it = contents.begin(); it != contents.end(); it++) { std::string path = (*it).path; - if(!fsIsDirectory(path) && fsHasExtensions(path, extensions)) { - std::string displayFileName = (*it).name; - if(displayFileName.length() > 40) { - displayFileName.resize(40); - displayFileName += "..."; - } - + std::string name = (*it).name; + if(!fsIsDirectory(name) && fsHasExtensions(name, extensions)) { if(mode == INSTALL_CIA) { - App app = appGetCiaInfo(path, destination); - if(appIsInstalled(app)) { - std::stringstream overwriteMsg; - overwriteMsg << "Title already installed, overwrite?" << "\n"; - overwriteMsg << displayFileName; - if(uiPrompt(TOP_SCREEN, overwriteMsg.str(), true)) { - uiDisplayMessage(TOP_SCREEN, "Deleting title..."); - AppResult ret = appDelete(app); - if(ret != APP_SUCCESS) { - std::stringstream resultMsg; - resultMsg << "Delete failed!" << "\n"; - resultMsg << displayFileName << "\n"; - resultMsg << appGetResultString(ret); - uiPrompt(TOP_SCREEN, resultMsg.str(), false); - - failed = true; - break; - } - } else { - continue; - } - } - - std::stringstream batchInstallStream; - batchInstallStream << displayFileName << " (" << currItem << ")" << "\n"; - - batchInfo = batchInstallStream.str(); - AppResult ret = appInstallFile(destination, path, onProgress); - prevProgress = -1; - batchInfo = ""; - if(ret != APP_SUCCESS) { - std::stringstream resultMsg; - resultMsg << "Install failed!" << "\n"; - resultMsg << displayFileName << "\n"; - resultMsg << appGetResultString(ret); - uiPrompt(TOP_SCREEN, resultMsg.str(), false); - + if(!installCIA(destination, path, name)) { failed = true; break; } } else { - std::stringstream deleteStream; - deleteStream << "Deleting CIA..." << "\n"; - deleteStream << displayFileName << " (" << currItem << ")"; - - uiDisplayMessage(TOP_SCREEN, deleteStream.str()); - if(remove(path.c_str()) != 0) { - std::stringstream resultMsg; - resultMsg << "Delete failed!" << "\n"; - resultMsg << displayFileName << "\n"; - resultMsg << strerror(errno); - uiPrompt(TOP_SCREEN, resultMsg.str(), false); + if(deleteCIA(path, name)) { + updateList = true; + } else { failed = true; break; - } else { - updateList = true; } } } - - currItem++; } if(!failed) { @@ -359,55 +428,25 @@ int main(int argc, char **argv) { confirmMsg << "the selected CIA?"; if(uiPrompt(TOP_SCREEN, confirmMsg.str(), true)) { - std::stringstream resultMsg; + bool success = false; if(mode == INSTALL_CIA) { - resultMsg << "Install "; + success = installCIA(destination, path, fsGetFileName(path)); } else { - resultMsg << "Delete "; + success = deleteCIA(path, fsGetFileName(path)); } - if(mode == INSTALL_CIA) { - App app = appGetCiaInfo(path, destination); - if(appIsInstalled(app)) { - std::stringstream overwriteMsg; - overwriteMsg << "Title already installed, overwrite?"; - if(uiPrompt(TOP_SCREEN, overwriteMsg.str(), true)) { - uiDisplayMessage(TOP_SCREEN, "Deleting title..."); - AppResult ret = appDelete(app); - if(ret != APP_SUCCESS) { - std::stringstream deleteResultMsg; - deleteResultMsg << "Delete failed!" << "\n"; - deleteResultMsg << appGetResultString(ret); - uiPrompt(TOP_SCREEN, deleteResultMsg.str(), false); - - return false; - } - } else { - return false; - } + if(success) { + std::stringstream successMsg; + if(mode == INSTALL_CIA) { + successMsg << "Install "; + } else { + successMsg << "Delete "; } - AppResult ret = appInstallFile(destination, path, onProgress); - prevProgress = -1; - if(ret == APP_SUCCESS) { - resultMsg << "succeeded!"; - } else { - resultMsg << "failed!" << "\n"; - resultMsg << appGetResultString(ret); - } - } else { - uiDisplayMessage(TOP_SCREEN, "Deleting CIA..."); - if(remove(path.c_str()) != 0) { - updateList = true; - resultMsg << "succeeded!"; - } else { - resultMsg << "failed!" << "\n"; - resultMsg << strerror(errno); - } + successMsg << "succeeded!"; + uiPrompt(TOP_SCREEN, successMsg.str(), false); } - uiPrompt(TOP_SCREEN, resultMsg.str(), false); - freeSpace = fsGetFreeSpace(destination); } @@ -422,35 +461,16 @@ int main(int argc, char **argv) { }, [&](App app, bool &updateList) { if(mode == DELETE_TITLE) { if(uiPrompt(TOP_SCREEN, "Delete the selected title?", true) && (destination != NAND || uiPrompt(TOP_SCREEN, "You are about to delete a title from the NAND.\nTHIS HAS THE POTENTIAL TO BRICK YOUR 3DS!\nAre you sure you wish to continue?", true))) { - updateList = true; - uiDisplayMessage(TOP_SCREEN, "Deleting title..."); - AppResult ret = appDelete(app); - - std::stringstream resultMsg; - resultMsg << "Delete "; - if(ret == APP_SUCCESS) { - resultMsg << "succeeded!"; - } else { - resultMsg << "failed!" << "\n"; - resultMsg << appGetResultString(ret); + if(deleteTitle(app)) { + uiPrompt(TOP_SCREEN, "Delete succeeded!", false); } - uiPrompt(TOP_SCREEN, resultMsg.str(), false); - + updateList = true; freeSpace = fsGetFreeSpace(destination); } } else if(mode == LAUNCH_TITLE) { if(uiPrompt(TOP_SCREEN, "Launch the selected title?", true)) { - updateList = true; - uiDisplayMessage(TOP_SCREEN, "Launching title..."); - AppResult ret = appLaunch(app); - - if(ret != APP_SUCCESS) { - std::stringstream resultMsg; - resultMsg << "Launch failed!" << "\n"; - resultMsg << appGetResultString(ret); - uiPrompt(TOP_SCREEN, resultMsg.str(), false); - } else { + if(launchTitle(app)) { while(true) { } } diff --git a/source/rop.h b/source/rop.h index 620c4db..d6658cb 100644 --- a/source/rop.h +++ b/source/rop.h @@ -1,51 +1,18 @@ #pragma once #define ROP_SIZE 0x200 -#define ROP_COUNT 5 +#define ROP_COUNT 6 const char* ropNames[ROP_COUNT] = { - "rxTools 4.x", "Encrypted Gateway 4.x", "Decrypted Gateway 4.x", + "N3DS Gateway 9.x", + "rxTools 4.x", "MsetForBoss 4.x", "MsetForBoss 6.x" }; unsigned char rops[ROP_COUNT][ROP_SIZE] = { - { - 0xB9, 0xF2, 0x10, 0x00, 0xAE, 0x2B, 0x27, 0x00, 0xEF, 0xBE, 0xAD, 0xDE, 0x9C, 0xF1, 0x18, 0x00, - 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, 0xB9, 0xF2, 0x10, 0x00, - 0x00, 0x90, 0x27, 0x00, 0x01, 0x00, 0x00, 0x00, 0xE1, 0x49, 0x15, 0x00, 0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 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, - 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xF1, 0x8B, - 0x05, 0x00, 0x0F, 0x05, 0x1D, 0x00, 0x72, 0x00, 0x78, 0x00, 0x54, 0x00, 0x6F, 0x00, 0x6F, 0x00, - 0x6C, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x59, 0x00, 0x53, 0x00, - 0x3A, 0x00, 0x2F, 0x00, 0x72, 0x00, 0x78, 0x00, 0x54, 0x00, 0x6F, 0x00, 0x6F, 0x00, 0x6C, 0x00, - 0x73, 0x00, 0x2E, 0x00, 0x64, 0x00, 0x61, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x02, 0x65, 0x02, 0x19, 0x13, 0xE0, 0x0D, - 0x11, 0x0E, 0xE6, 0xAC, 0x00, 0xFE, 0x00, 0x01, 0xA5, 0x4F, 0x4A, 0x12, 0x00, 0x00, 0x00, 0x00, - 0x52, 0x00, 0x6B, 0xC1, 0x01, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xB9, 0xF2, 0x10, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, - 0xE1, 0x49, 0x15, 0x00, 0x00, 0x94, 0x27, 0x00, 0xFC, 0x34, 0x13, 0x00, 0xEF, 0xBE, 0xAD, 0xDE, - 0x8C, 0x53, 0x10, 0x00, 0x9C, 0x94, 0x27, 0xF0, 0x60, 0x3D, 0x14, 0x00, 0xEF, 0xBE, 0xAD, 0xDE, - 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, - 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xE1, 0x37, - }, { 0xB9, 0xF2, 0x10, 0x00, 0xAE, 0x2B, 0x27, 0x00, 0xED, 0x0D, 0xDC, 0xBA, 0x9C, 0xF1, 0x18, 0x00, 0x90, 0xB6, 0x10, 0x00, 0x00, 0xB0, 0xFA, 0x00, 0x00, 0x02, 0x20, 0x00, 0xB9, 0xF2, 0x10, 0x00, @@ -114,6 +81,74 @@ unsigned char rops[ROP_COUNT][ROP_SIZE] = { 0x8C, 0x3D, 0x14, 0x00, 0x2F, 0x00, 0x00, 0x00, 0x90, 0xB6, 0x10, 0x00, 0xF0, 0x93, 0x27, 0x00, 0xE8, 0x93, 0x27, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x09, 0xFB, 0x19, 0x00, 0x00, 0x00, 0x31, 0xF1, }, + { + 0x8C, 0x3D, 0x14, 0x00, 0xAE, 0x2B, 0x27, 0x00, 0x9C, 0xF1, 0x18, 0x00, 0x90, 0xB6, 0x10, 0x00, + 0x00, 0xB0, 0xFA, 0x00, 0x00, 0x02, 0x20, 0x00, 0xB9, 0xF2, 0x10, 0x00, 0x00, 0x90, 0x27, 0x00, + 0x01, 0x00, 0x00, 0x00, 0xE1, 0x49, 0x15, 0x00, 0x38, 0x6F, 0x27, 0x00, 0xAC, 0x82, 0x1B, 0x00, + 0xDC, 0xD5, 0x18, 0x00, 0x40, 0x83, 0x27, 0x00, 0x00, 0x02, 0x10, 0x00, 0xCC, 0x48, 0x00, 0x00, + 0x60, 0x3D, 0x14, 0x00, 0xB9, 0xF2, 0x10, 0x00, 0x04, 0x90, 0x27, 0x00, 0x00, 0x80, 0x04, 0x00, + 0x88, 0x11, 0x20, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xB9, 0xF2, 0x10, 0x00, 0x00, 0x90, 0x27, 0x00, + 0x00, 0x00, 0x2B, 0x00, 0x8C, 0x53, 0x10, 0x00, 0x00, 0x90, 0x00, 0x00, 0xE1, 0x49, 0x15, 0x00, + 0x51, 0x00, 0x94, 0x53, 0xE1, 0x49, 0x15, 0x00, 0x20, 0x90, 0x27, 0x00, 0x58, 0x39, 0x1B, 0x00, + 0xE5, 0x04, 0x21, 0x00, 0x00, 0xDA, 0x19, 0x00, 0x00, 0x75, 0x01, 0x00, 0x86, 0xDF, 0x21, 0x00, + 0x00, 0xC1, 0x1A, 0x00, 0x22, 0xDA, 0x1D, 0x00, 0x9B, 0x44, 0x1B, 0x00, 0x00, 0x01, 0x10, 0x00, + 0xBC, 0x4C, 0x14, 0x00, 0x00, 0x00, 0x2B, 0x00, 0x00, 0x90, 0x00, 0x00, 0xE1, 0x49, 0x15, 0x00, + 0xFE, 0xFE, 0xFE, 0xFE, 0xAC, 0xEF, 0x22, 0x00, 0x88, 0x5C, 0x10, 0x00, 0x00, 0x00, 0x0E, 0x00, + 0x90, 0x03, 0x25, 0x00, 0xC0, 0xFA, 0x1E, 0x00, 0x91, 0xFE, 0x16, 0x00, 0x8C, 0x53, 0x10, 0x00, + 0x28, 0x6B, 0x03, 0x00, 0x60, 0x3D, 0x14, 0x00, 0x60, 0x3D, 0x14, 0x00, 0x01, 0x00, 0x3F, 0x00, + 0x00, 0x00, 0x7E, 0x9A, 0x3A, 0x00, 0x2F, 0x00, 0x64, 0x00, 0x61, 0x00, 0x9C, 0xF1, 0x18, 0x00, + 0x1D, 0x00, 0x72, 0x00, 0x52, 0x00, 0x37, 0x3A, 0x00, 0x90, 0x27, 0x00, 0xAE, 0x2B, 0x33, 0x05, + 0x05, 0x00, 0x0F, 0x05, 0x1D, 0x00, 0x72, 0x00, 0x78, 0x00, 0x54, 0x00, 0x6F, 0x00, 0x6F, 0x00, + 0x6C, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x59, 0x00, 0x53, 0x00, + 0x3A, 0x00, 0x2F, 0x00, 0x72, 0x00, 0x78, 0x00, 0x54, 0x00, 0x6F, 0x00, 0x6F, 0x00, 0x6C, 0x00, + 0x73, 0x00, 0x2E, 0x00, 0x64, 0x00, 0x61, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF9, 0x01, 0xF2, 0x01, 0x19, 0x13, 0xF9, 0x0D, + 0xE6, 0x0D, 0xE6, 0xAC, 0x00, 0xFE, 0x00, 0x01, 0xA2, 0x40, 0xD1, 0x12, 0x00, 0x00, 0x00, 0x00, + 0x52, 0x00, 0xBB, 0xD8, 0x01, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xB9, 0xF2, 0x10, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, + 0xE1, 0x49, 0x15, 0x00, 0x00, 0x94, 0x27, 0x00, 0xFC, 0x34, 0x13, 0x00, 0xD0, 0x8C, 0x1E, 0x00, + 0x8C, 0x53, 0x10, 0x00, 0x9C, 0x94, 0x27, 0xF0, 0x60, 0x3D, 0x14, 0x00, 0x01, 0x00, 0x3F, 0x00, + 0x00, 0x90, 0x00, 0x00, 0x3A, 0x00, 0x2F, 0x00, 0x64, 0x00, 0x61, 0x00, 0x9C, 0xF1, 0x18, 0x00, + 0x1D, 0x00, 0x72, 0x00, 0x52, 0x00, 0x37, 0x3A, 0x00, 0x90, 0x27, 0x00, 0xAE, 0x2B, 0x2F, 0xBF, + }, + { + 0xB9, 0xF2, 0x10, 0x00, 0xAE, 0x2B, 0x27, 0x00, 0xEF, 0xBE, 0xAD, 0xDE, 0x9C, 0xF1, 0x18, 0x00, + 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, 0xB9, 0xF2, 0x10, 0x00, + 0x00, 0x90, 0x27, 0x00, 0x01, 0x00, 0x00, 0x00, 0xE1, 0x49, 0x15, 0x00, 0x0C, 0x5E, 0x29, 0x00, + 0xAC, 0x82, 0x1B, 0x00, 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, + 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, 0xB9, 0xF2, 0x10, 0x00, 0x00, 0x90, 0x27, 0x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0x1D, 0x00, 0x72, 0x00, 0x78, 0x00, 0x54, 0x00, 0x6F, 0x00, 0x6F, 0x00, + 0x6C, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x59, 0x00, 0x53, 0x00, + 0x3A, 0x00, 0x2F, 0x00, 0x72, 0x00, 0x78, 0x00, 0x54, 0x00, 0x6F, 0x00, 0x6F, 0x00, 0x6C, 0x00, + 0x73, 0x00, 0x2E, 0x00, 0x64, 0x00, 0x61, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x02, 0x65, 0x02, 0x19, 0x13, 0xE0, 0x0D, + 0x11, 0x0E, 0xE6, 0xAC, 0x00, 0xFE, 0x00, 0x01, 0xA5, 0x4F, 0x4A, 0x12, 0x00, 0x00, 0x00, 0x00, + 0x52, 0x00, 0x6B, 0xC1, 0x01, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xB9, 0xF2, 0x10, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, + 0xE1, 0x49, 0x15, 0x00, 0x00, 0x94, 0x27, 0x00, 0xFC, 0x34, 0x13, 0x00, 0xEF, 0xBE, 0xAD, 0xDE, + 0x8C, 0x53, 0x10, 0x00, 0x9C, 0x94, 0x27, 0xF0, 0x60, 0x3D, 0x14, 0x00, 0xEF, 0xBE, 0xAD, 0xDE, + 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, + 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xE1, 0x37, + }, { 0xB9, 0xF2, 0x10, 0x00, 0xAE, 0x2B, 0x27, 0x00, 0xEF, 0xBE, 0xAD, 0xDE, 0x9C, 0xF1, 0x18, 0x00, 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xAD, 0xDE, 0xB9, 0xF2, 0x10, 0x00,