mirror of
https://github.com/wiiu-env/AutobootModule.git
synced 2024-11-22 10:59:15 +01:00
Use the current environment path for the autoboot config
This commit is contained in:
parent
5bb799dd3e
commit
46ff1052ee
@ -1,6 +1,7 @@
|
|||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <string>
|
||||||
#include <coreinit/screen.h>
|
#include <coreinit/screen.h>
|
||||||
#include <coreinit/filesystem.h>
|
#include <coreinit/filesystem.h>
|
||||||
#include <coreinit/memdefaultheap.h>
|
#include <coreinit/memdefaultheap.h>
|
||||||
@ -54,10 +55,11 @@ static const char* autoboot_config_strings[] = {
|
|||||||
"vwii_homebrew_channel",
|
"vwii_homebrew_channel",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::string configPath;
|
||||||
int autobootOption = -1;
|
int autobootOption = -1;
|
||||||
|
|
||||||
void readAutobootOption(){
|
void readAutobootOption(){
|
||||||
FILE* f = fopen("autoboot.txt", "r");
|
FILE* f = fopen(configPath.c_str(), "r");
|
||||||
if (f) {
|
if (f) {
|
||||||
char buf[128]{};
|
char buf[128]{};
|
||||||
fgets(buf, sizeof(buf), f);
|
fgets(buf, sizeof(buf), f);
|
||||||
@ -73,7 +75,7 @@ void readAutobootOption(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void writeAutobootOption(){
|
void writeAutobootOption(){
|
||||||
FILE* f = fopen("autoboot.txt", "w");
|
FILE* f = fopen(configPath.c_str(), "w");
|
||||||
if (f) {
|
if (f) {
|
||||||
if (autobootOption >= 0) {
|
if (autobootOption >= 0) {
|
||||||
fputs(autoboot_config_strings[autobootOption], f);
|
fputs(autoboot_config_strings[autobootOption], f);
|
||||||
@ -359,6 +361,11 @@ int main(int argc, char **argv){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configPath = "fs:/vol/exernal01/wiiu/autoboot.cfg";
|
||||||
|
if (argc >= 1) {
|
||||||
|
configPath = std::string(argv[0]) + "/autoboot.cfg";
|
||||||
|
}
|
||||||
|
|
||||||
readAutobootOption();
|
readAutobootOption();
|
||||||
int bootSelection = autobootOption;
|
int bootSelection = autobootOption;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user