mirror of
https://github.com/wiiu-env/AutobootModule.git
synced 2024-09-28 02:58:39 +02: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();
|
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
|
// we need to init kpad for cmpt
|
||||||
KPADInit();
|
KPADInit();
|
||||||
|
|
||||||
// Try to find a screen type that works
|
// Try to find a screen type that works
|
||||||
CMPTAcctSetScreenType(CMPT_SCREEN_TYPE_BOTH);
|
if (drcEnabled) {
|
||||||
|
CMPTAcctSetScreenType(CMPT_SCREEN_TYPE_BOTH);
|
||||||
|
} else {
|
||||||
|
CMPTAcctSetScreenType(CMPT_SCREEN_TYPE_TV);
|
||||||
|
}
|
||||||
|
|
||||||
if (CMPTCheckScreenState() < 0) {
|
if (CMPTCheckScreenState() < 0) {
|
||||||
CMPTAcctSetScreenType(CMPT_SCREEN_TYPE_DRC);
|
CMPTAcctSetScreenType(CMPT_SCREEN_TYPE_DRC);
|
||||||
if (CMPTCheckScreenState() < 0) {
|
if (CMPTCheckScreenState() < 0) {
|
||||||
@ -117,11 +122,11 @@ static void launchvWiiTitle(uint32_t titleId_low, uint32_t titleId_high) {
|
|||||||
free(dataBuffer);
|
free(dataBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bootvWiiMenu() {
|
void bootvWiiMenu(bool drcEnabled) {
|
||||||
launchvWiiTitle(0, 0);
|
launchvWiiTitle(0, 0, drcEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bootHomebrewChannel() {
|
void bootHomebrewChannel(bool drcEnabled) {
|
||||||
// fall back to booting the vWii system menu if anything fails
|
// fall back to booting the vWii system menu if anything fails
|
||||||
uint64_t titleId = 0;
|
uint64_t titleId = 0;
|
||||||
|
|
||||||
@ -157,5 +162,5 @@ void bootHomebrewChannel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_FUNCTION_LINE("Launching vWii title %016llx", titleId);
|
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 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();
|
auto screenBuffer = DrawUtils::InitOSScreen();
|
||||||
if (!screenBuffer) {
|
if (!screenBuffer) {
|
||||||
OSFatal("Failed to alloc memory for screen");
|
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;
|
uint32_t selected = autobootOptionInput > 0 ? autobootOptionInput : 0;
|
||||||
int autoboot = autobootOptionInput;
|
int autoboot = autobootOptionInput;
|
||||||
|
bool drcEnabled = drcEnabledInput;
|
||||||
bool redraw = true;
|
bool redraw = true;
|
||||||
while (true) {
|
while (true) {
|
||||||
VPADStatus vpad{};
|
VPADStatus vpad{};
|
||||||
@ -106,6 +136,9 @@ int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput) {
|
|||||||
} else if (vpad.trigger & VPAD_BUTTON_Y) {
|
} else if (vpad.trigger & VPAD_BUTTON_Y) {
|
||||||
autoboot = selected;
|
autoboot = selected;
|
||||||
redraw = true;
|
redraw = true;
|
||||||
|
} else if (vpad.trigger & VPAD_BUTTON_B) {
|
||||||
|
drcEnabled = !drcEnabled;
|
||||||
|
redraw = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (redraw) {
|
if (redraw) {
|
||||||
@ -133,6 +166,9 @@ int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput) {
|
|||||||
DrawUtils::setFontSize(24);
|
DrawUtils::setFontSize(24);
|
||||||
DrawUtils::drawPNG(16, 2, icon_png);
|
DrawUtils::drawPNG(16, 2, icon_png);
|
||||||
DrawUtils::print(64 + 2, 6 + 24, "Tiramisu Boot Selector");
|
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);
|
DrawUtils::drawRectFilled(8, 8 + 24 + 4, SCREEN_WIDTH - 8 * 2, 3, COLOR_WHITE);
|
||||||
|
|
||||||
// draw bottom bar
|
// draw bottom bar
|
||||||
@ -140,7 +176,7 @@ int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput) {
|
|||||||
DrawUtils::setFontSize(18);
|
DrawUtils::setFontSize(18);
|
||||||
DrawUtils::print(16, SCREEN_HEIGHT - 8, "\ue07d Navigate ");
|
DrawUtils::print(16, SCREEN_HEIGHT - 8, "\ue07d Navigate ");
|
||||||
DrawUtils::print(SCREEN_WIDTH - 16, SCREEN_HEIGHT - 8, "\ue000 Choose", true);
|
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::print(SCREEN_WIDTH / 2 + DrawUtils::getTextWidth(autobootHints) / 2, SCREEN_HEIGHT - 8, autobootHints, true);
|
||||||
|
|
||||||
DrawUtils::endDraw();
|
DrawUtils::endDraw();
|
||||||
@ -164,6 +200,10 @@ int32_t handleMenuScreen(std::string &configPath, int32_t autobootOptionInput) {
|
|||||||
writeAutobootOption(configPath, autoboot);
|
writeAutobootOption(configPath, autoboot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (drcEnabled != drcEnabledInput) {
|
||||||
|
writeDrcEnabledOption(drcSettingPath, drcEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
return selected;
|
return selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,10 @@ int32_t readAutobootOption(std::string &configPath);
|
|||||||
|
|
||||||
void writeAutobootOption(std::string &configPath, int32_t autobootOption);
|
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);
|
nn::act::SlotNo handleAccountSelectScreen(const std::vector<std::shared_ptr<AccountInfo>> &data);
|
@ -204,7 +204,7 @@ bool getQuickBoot() {
|
|||||||
|
|
||||||
if (info.titleId == 0x0005001010004000L) { // OSv0
|
if (info.titleId == 0x0005001010004000L) { // OSv0
|
||||||
DEBUG_FUNCTION_LINE("Launching vWii System Menu");
|
DEBUG_FUNCTION_LINE("Launching vWii System Menu");
|
||||||
bootvWiiMenu();
|
bootvWiiMenu(true);
|
||||||
|
|
||||||
return 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 configPath = "fs:/vol/exernal01/wiiu/autoboot.cfg";
|
||||||
|
std::string drcSettingPath = "fs:/vol/exernal01/wiiu/drcenabled.cfg";
|
||||||
if (argc >= 1) {
|
if (argc >= 1) {
|
||||||
configPath = std::string(argv[0]) + "/autoboot.cfg";
|
configPath = std::string(argv[0]) + "/autoboot.cfg";
|
||||||
|
drcSettingPath = std::string(argv[0]) + "/drcenabled.cfg";
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t bootSelection = readAutobootOption(configPath);
|
int32_t bootSelection = readAutobootOption(configPath);
|
||||||
@ -49,7 +51,7 @@ int32_t main(int32_t argc, char **argv) {
|
|||||||
VPADRead(VPAD_CHAN_0, &vpad, 1, nullptr);
|
VPADRead(VPAD_CHAN_0, &vpad, 1, nullptr);
|
||||||
|
|
||||||
if ((bootSelection == -1) || (vpad.hold & VPAD_BUTTON_PLUS)) {
|
if ((bootSelection == -1) || (vpad.hold & VPAD_BUTTON_PLUS)) {
|
||||||
bootSelection = handleMenuScreen(configPath, bootSelection);
|
bootSelection = handleMenuScreen(configPath, drcSettingPath, bootSelection, readDrcEnabledOption(drcSettingPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bootSelection >= 0) {
|
if (bootSelection >= 0) {
|
||||||
@ -61,10 +63,10 @@ int32_t main(int32_t argc, char **argv) {
|
|||||||
bootHomebrewLauncher();
|
bootHomebrewLauncher();
|
||||||
break;
|
break;
|
||||||
case BOOT_OPTION_VWII_SYSTEM_MENU:
|
case BOOT_OPTION_VWII_SYSTEM_MENU:
|
||||||
bootvWiiMenu();
|
bootvWiiMenu(readDrcEnabledOption(drcSettingPath));
|
||||||
break;
|
break;
|
||||||
case BOOT_OPTION_VWII_HOMEBREW_CHANNEL:
|
case BOOT_OPTION_VWII_HOMEBREW_CHANNEL:
|
||||||
bootHomebrewChannel();
|
bootHomebrewChannel(readDrcEnabledOption(drcSettingPath));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
bootWiiUMenu();
|
bootWiiUMenu();
|
||||||
|
Loading…
Reference in New Issue
Block a user