Add rxtools 4x rop installer feature.

Needs cfg:nor service access enabled on the cia .rsf (ctrcommon PR is pending). Works on ninjhax .3dsx and cia, but not GW .3ds of course.
This commit is contained in:
idgrepthat 2015-06-25 06:00:21 -05:00
parent 6b8ad81c55
commit d31cb41500

View File

@ -9,6 +9,10 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <3ds.h>
#include <3ds/services/cfgnor.h>
#include "ropdata.h"
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
@ -33,6 +37,7 @@ int main(int argc, char **argv) {
Mode mode = INSTALL_CIA; Mode mode = INSTALL_CIA;
bool exit = false; bool exit = false;
bool netInstall = false; bool netInstall = false;
int ropinstalled = 0;
u64 freeSpace = fsGetFreeSpace(destination); u64 freeSpace = fsGetFreeSpace(destination);
auto onLoop = [&]() { auto onLoop = [&]() {
if(ninjhax && inputIsPressed(BUTTON_START)) { if(ninjhax && inputIsPressed(BUTTON_START)) {
@ -74,6 +79,21 @@ int main(int argc, char **argv) {
breakLoop = true; breakLoop = true;
} }
if(inputIsPressed(BUTTON_SELECT) && ropinstalled==0){
Result result=0;
CFGNOR_Initialize( (u8)1 );
result=CFGNOR_WriteData(0x1FE00, (u32*)mset4x, 0x200);
CFGNOR_Shutdown();
if(result){ // 1 is fail install 2 is success install
ropinstalled=1;
}
else{
ropinstalled=2;
}
}
std::stringstream stream; std::stringstream stream;
stream << "Free Space: " << freeSpace << " bytes (" << std::fixed << std::setprecision(2) << freeSpace / 1024.0f / 1024.0f << "MB)" << "\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 << "Destination: " << (destination == NAND ? "NAND" : "SD") << ", Mode: " << (mode == INSTALL_CIA ? "Install CIA" : mode == DELETE_CIA ? "Delete CIA" : mode == DELETE_TITLE ? "Delete Title" : "Launch Title") << "\n";
@ -88,6 +108,7 @@ int main(int argc, char **argv) {
if(ninjhax) { if(ninjhax) {
stream << "START - Exit to launcher" << "\n"; stream << "START - Exit to launcher" << "\n";
} }
stream << (ropinstalled == 0 ? "SELECT - Install rxTools mset: NOT INSTALLED\n" : ropinstalled == 2 ? "SELECT - Install rxTools mset: INSTALLED\n" : "SELECT - Install rxTools mset: FAILED\n");
std::string str = stream.str(); std::string str = stream.str();
const std::string title = "FBI v1.3.8"; const std::string title = "FBI v1.3.8";