mirror of
https://github.com/wiiu-env/AutobootModule.git
synced 2024-11-16 00:15:05 +01:00
Add vWii DRC Enabled Option
This adds an option to disable the DRC (gamepad) when booting into vWii.
This commit is contained in:
parent
29bb0499d7
commit
7d63690a44
@ -90,12 +90,17 @@ void handleAccountSelection() {
|
||||
nn::act::Finalize();
|
||||
}
|
||||
|
||||
static void launchvWiiTitle(uint32_t titleId_low, uint32_t titleId_high) {
|
||||
static void launchvWiiTitle(uint32_t titleId_low, uint32_t titleId_high, bool drcEnabled) {
|
||||
// we need to init kpad for cmpt
|
||||
KPADInit();
|
||||
|
||||
// Try to find a screen type that works
|
||||
if (drcEnabled) {
|
||||
CMPTAcctSetScreenType(CMPT_SCREEN_TYPE_BOTH);
|
||||
} else {
|
||||
CMPTAcctSetScreenType(CMPT_SCREEN_TYPE_TV);
|
||||
}
|
||||
|
||||
if (CMPTCheckScreenState() < 0) {
|
||||
CMPTAcctSetScreenType(CMPT_SCREEN_TYPE_DRC);
|
||||
if (CMPTCheckScreenState() < 0) {
|
||||
@ -117,11 +122,11 @@ static void launchvWiiTitle(uint32_t titleId_low, uint32_t titleId_high) {
|
||||
free(dataBuffer);
|
||||
}
|
||||
|
||||
void bootvWiiMenu() {
|
||||
launchvWiiTitle(0, 0);
|
||||
void bootvWiiMenu(bool drcEnabled) {
|
||||
launchvWiiTitle(0, 0, drcEnabled);
|
||||
}
|
||||
|
||||
void bootHomebrewChannel() {
|
||||
void bootHomebrewChannel(bool drcEnabled) {
|
||||
// fall back to booting the vWii system menu if anything fails
|
||||
uint64_t titleId = 0;
|
||||
|
||||
@ -157,5 +162,5 @@ void bootHomebrewChannel() {
|
||||
}
|
||||
|
||||
DEBUG_FUNCTION_LINE("Launching vWii title %016llx", titleId);
|
||||
launchvWiiTitle((uint32_t) (titleId >> 32), (uint32_t) (titleId & 0xffffffff));
|
||||
launchvWiiTitle((uint32_t) (titleId >> 32), (uint32_t) (titleId & 0xffffffff), drcEnabled);
|
||||
}
|
||||
|
@ -6,6 +6,6 @@ void bootWiiUMenu();
|
||||
|
||||
void bootHomebrewLauncher();
|
||||
|
||||
void bootvWiiMenu();
|
||||
void bootvWiiMenu(bool drcEnabled);
|
||||
|
||||
void bootHomebrewChannel();
|
||||
void bootHomebrewChannel(bool drcEnabled);
|
@ -69,7 +69,36 @@ void writeAutobootOption(std::string &configPath, int32_t autobootOption) {
|
||||
}
|
||||
}
|
||||
|
||||
int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput) {
|
||||
bool readDrcEnabledOption(std::string &configPath) {
|
||||
FILE *f = fopen(configPath.c_str(), "r");
|
||||
if (f) {
|
||||
char buf[128]{};
|
||||
fgets(buf, sizeof(buf), f);
|
||||
fclose(f);
|
||||
|
||||
if (strncmp("0", buf, strlen("0")) == 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void writeDrcEnabledOption(std::string &configPath, bool drcEnabled) {
|
||||
FILE *f = fopen(configPath.c_str(), "w");
|
||||
if (f) {
|
||||
if (drcEnabled) {
|
||||
fputs("1", f);
|
||||
} else {
|
||||
fputs("0", f);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t handleMenuScreen(std::string &configPath, std::string &drcSettingPath, int32_t autobootOptionInput, bool drcEnabledInput) {
|
||||
auto screenBuffer = DrawUtils::InitOSScreen();
|
||||
if (!screenBuffer) {
|
||||
OSFatal("Failed to alloc memory for screen");
|
||||
@ -83,6 +112,7 @@ int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput) {
|
||||
|
||||
uint32_t selected = autobootOptionInput > 0 ? autobootOptionInput : 0;
|
||||
int autoboot = autobootOptionInput;
|
||||
bool drcEnabled = drcEnabledInput;
|
||||
bool redraw = true;
|
||||
while (true) {
|
||||
VPADStatus vpad{};
|
||||
@ -106,6 +136,9 @@ int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput) {
|
||||
} else if (vpad.trigger & VPAD_BUTTON_Y) {
|
||||
autoboot = selected;
|
||||
redraw = true;
|
||||
} else if (vpad.trigger & VPAD_BUTTON_B) {
|
||||
drcEnabled = !drcEnabled;
|
||||
redraw = true;
|
||||
}
|
||||
|
||||
if (redraw) {
|
||||
@ -133,6 +166,9 @@ int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput) {
|
||||
DrawUtils::setFontSize(24);
|
||||
DrawUtils::drawPNG(16, 2, icon_png);
|
||||
DrawUtils::print(64 + 2, 6 + 24, "Tiramisu Boot Selector");
|
||||
DrawUtils::setFontSize(18);
|
||||
const char *vWiiDrcStatus = drcEnabled ? "vWii DRC Enabled" : "vWii DRC Disabled";
|
||||
DrawUtils::print(SCREEN_WIDTH - DrawUtils::getTextWidth(vWiiDrcStatus) - 16, 6 + 24, vWiiDrcStatus);
|
||||
DrawUtils::drawRectFilled(8, 8 + 24 + 4, SCREEN_WIDTH - 8 * 2, 3, COLOR_WHITE);
|
||||
|
||||
// draw bottom bar
|
||||
@ -140,7 +176,7 @@ int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput) {
|
||||
DrawUtils::setFontSize(18);
|
||||
DrawUtils::print(16, SCREEN_HEIGHT - 8, "\ue07d Navigate ");
|
||||
DrawUtils::print(SCREEN_WIDTH - 16, SCREEN_HEIGHT - 8, "\ue000 Choose", true);
|
||||
const char *autobootHints = "\ue002 Clear Autoboot / \ue003 Select Autoboot";
|
||||
const char *autobootHints = "\ue002 Clear Autoboot / \ue003 Select Autoboot / \ue001 Toggle vWii DRC";
|
||||
DrawUtils::print(SCREEN_WIDTH / 2 + DrawUtils::getTextWidth(autobootHints) / 2, SCREEN_HEIGHT - 8, autobootHints, true);
|
||||
|
||||
DrawUtils::endDraw();
|
||||
@ -164,6 +200,10 @@ int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput) {
|
||||
writeAutobootOption(configPath, autoboot);
|
||||
}
|
||||
|
||||
if (drcEnabled != drcEnabledInput) {
|
||||
writeDrcEnabledOption(drcSettingPath, drcEnabled);
|
||||
}
|
||||
|
||||
return selected;
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,10 @@ int32_t readAutobootOption(std::string &configPath);
|
||||
|
||||
void writeAutobootOption(std::string &configPath, int32_t autobootOption);
|
||||
|
||||
int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput);
|
||||
bool readDrcEnabledOption(std::string &configPath);
|
||||
|
||||
void writeDrcEnabledOption(std::string &configPath, bool drcEnabled);
|
||||
|
||||
int32_t handleMenuScreen(std::string &configPath, std::string &drcSettingPath, int32_t autobootOptionInput, bool drcEnabledInput);
|
||||
|
||||
nn::act::SlotNo handleAccountSelectScreen(const std::vector<std::shared_ptr<AccountInfo>> &data);
|
@ -204,7 +204,7 @@ bool getQuickBoot() {
|
||||
|
||||
if (info.titleId == 0x0005001010004000L) { // OSv0
|
||||
DEBUG_FUNCTION_LINE("Launching vWii System Menu");
|
||||
bootvWiiMenu();
|
||||
bootvWiiMenu(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -39,8 +39,10 @@ int32_t main(int32_t argc, char **argv) {
|
||||
}
|
||||
|
||||
std::string configPath = "fs:/vol/exernal01/wiiu/autoboot.cfg";
|
||||
std::string drcSettingPath = "fs:/vol/exernal01/wiiu/drcenabled.cfg";
|
||||
if (argc >= 1) {
|
||||
configPath = std::string(argv[0]) + "/autoboot.cfg";
|
||||
drcSettingPath = std::string(argv[0]) + "/drcenabled.cfg";
|
||||
}
|
||||
|
||||
int32_t bootSelection = readAutobootOption(configPath);
|
||||
@ -49,7 +51,7 @@ int32_t main(int32_t argc, char **argv) {
|
||||
VPADRead(VPAD_CHAN_0, &vpad, 1, nullptr);
|
||||
|
||||
if ((bootSelection == -1) || (vpad.hold & VPAD_BUTTON_PLUS)) {
|
||||
bootSelection = handleMenuScreen(configPath, bootSelection);
|
||||
bootSelection = handleMenuScreen(configPath, drcSettingPath, bootSelection, readDrcEnabledOption(drcSettingPath));
|
||||
}
|
||||
|
||||
if (bootSelection >= 0) {
|
||||
@ -61,10 +63,10 @@ int32_t main(int32_t argc, char **argv) {
|
||||
bootHomebrewLauncher();
|
||||
break;
|
||||
case BOOT_OPTION_VWII_SYSTEM_MENU:
|
||||
bootvWiiMenu();
|
||||
bootvWiiMenu(readDrcEnabledOption(drcSettingPath));
|
||||
break;
|
||||
case BOOT_OPTION_VWII_HOMEBREW_CHANNEL:
|
||||
bootHomebrewChannel();
|
||||
bootHomebrewChannel(readDrcEnabledOption(drcSettingPath));
|
||||
break;
|
||||
default:
|
||||
bootWiiUMenu();
|
||||
|
Loading…
Reference in New Issue
Block a user