mirror of
https://github.com/ihaveamac/custom-install.git
synced 2026-01-21 14:06:02 +00:00
Compare commits
2 Commits
finalize-1
...
finalize-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a515ca7e61 | ||
|
|
167a80ff11 |
@@ -85,6 +85,8 @@ int load_cifinish(char* path, struct finish_db_entry_final **entries)
|
||||
struct finish_db_entry_v2 v2;
|
||||
struct finish_db_entry_v3 v3;
|
||||
|
||||
struct finish_db_entry_final *tmp;
|
||||
|
||||
int i;
|
||||
size_t read;
|
||||
|
||||
@@ -114,6 +116,12 @@ int load_cifinish(char* path, struct finish_db_entry_final **entries)
|
||||
}
|
||||
|
||||
*entries = calloc(header.title_count, sizeof(struct finish_db_entry_final));
|
||||
if (!*entries) {
|
||||
printf("Couldn't allocate memory.\n");
|
||||
printf("This should never happen.\n");
|
||||
goto fail;
|
||||
}
|
||||
tmp = *entries;
|
||||
|
||||
if (header.version == 1)
|
||||
{
|
||||
@@ -133,9 +141,9 @@ int load_cifinish(char* path, struct finish_db_entry_final **entries)
|
||||
printf(" Is the file corrupt?\n");
|
||||
goto fail;
|
||||
}
|
||||
entries[i]->has_seed = v1.has_seed;
|
||||
entries[i]->title_id = v1.title_id;
|
||||
memcpy(entries[i]->seed, v1.seed, 16);
|
||||
tmp[i].has_seed = v1.has_seed;
|
||||
tmp[i].title_id = v1.title_id;
|
||||
memcpy(tmp[i].seed, v1.seed, 16);
|
||||
}
|
||||
} else if (header.version == 2) {
|
||||
for (i = 0; i < header.title_count; i++)
|
||||
@@ -154,9 +162,9 @@ int load_cifinish(char* path, struct finish_db_entry_final **entries)
|
||||
printf(" Is the file corrupt?\n");
|
||||
goto fail;
|
||||
}
|
||||
entries[i]->has_seed = v2.has_seed;
|
||||
entries[i]->title_id = v2.title_id;
|
||||
memcpy(entries[i]->seed, v2.seed, 16);
|
||||
tmp[i].has_seed = v2.has_seed;
|
||||
tmp[i].title_id = v2.title_id;
|
||||
memcpy(tmp[i].seed, v2.seed, 16);
|
||||
}
|
||||
} else if (header.version == 3) {
|
||||
for (i = 0; i < header.title_count; i++)
|
||||
@@ -175,9 +183,9 @@ int load_cifinish(char* path, struct finish_db_entry_final **entries)
|
||||
printf(" Is the file corrupt?\n");
|
||||
goto fail;
|
||||
}
|
||||
entries[i]->has_seed = v3.has_seed;
|
||||
entries[i]->title_id = v3.title_id;
|
||||
memcpy(entries[i]->seed, v3.seed, 16);
|
||||
tmp[i].has_seed = v3.has_seed;
|
||||
tmp[i].title_id = v3.title_id;
|
||||
memcpy(tmp[i].seed, v3.seed, 16);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,7 +275,7 @@ int main(int argc, char* argv[])
|
||||
gfxInitDefault();
|
||||
consoleInit(GFX_TOP, NULL);
|
||||
|
||||
printf("custom-install-finalize v1.3\n");
|
||||
printf("custom-install-finalize v1.4\n");
|
||||
|
||||
finalize_install();
|
||||
// print this at the end in case it gets pushed off the screen
|
||||
|
||||
22
gui.py
22
gui.py
@@ -342,7 +342,7 @@ class gui(tk.Tk):
|
||||
run_button.place(relwidth=1, rely=1, y=- 22)
|
||||
|
||||
def run(self):
|
||||
argstring = ""
|
||||
args_extra = []
|
||||
|
||||
self.output_to_console("-----------------------\nStarting...\n")
|
||||
|
||||
@@ -350,32 +350,33 @@ class gui(tk.Tk):
|
||||
if not boot9:
|
||||
self.output_to_console(
|
||||
"Warning - boot9 not selected, if it's not set externally you may run into problems.\n")
|
||||
argstring += f"-b {boot9} "
|
||||
else:
|
||||
args_extra.extend(['-b', boot9])
|
||||
|
||||
sed = self.sed_box.get()
|
||||
if not sed:
|
||||
self.output_to_console("Failed to run - No movable.sed selected.\n")
|
||||
return
|
||||
argstring += f"-m {sed} "
|
||||
args_extra.extend(['-m', sed])
|
||||
|
||||
sd = self.sd_box.get().strip()
|
||||
if not sd:
|
||||
self.output_to_console("Failed to run - SD path not selected.\n")
|
||||
return
|
||||
argstring += f"--sd {sd} "
|
||||
args_extra.extend(['--sd', sd])
|
||||
|
||||
cias = []
|
||||
for i in range(0, self.cia_box.size()):
|
||||
cias.append(self.cia_box.get(i).strip())
|
||||
for cia in cias:
|
||||
argstring += f" {cia}"
|
||||
args_extra.append(cia)
|
||||
|
||||
if self.skip_contents.get():
|
||||
argstring += "--skip-contents "
|
||||
args_extra.append('--skip-contents')
|
||||
|
||||
print(f"Running custom-install.py with args {args}\n")
|
||||
print(f"Running custom-install.py with args {args_extra}\n")
|
||||
|
||||
self.threader.do_async(execute_script, [argstring, self.output_to_console])
|
||||
self.threader.do_async(execute_script, [args_extra, self.output_to_console])
|
||||
|
||||
def output_to_console(self, outstring):
|
||||
self.console.insert('end', outstring)
|
||||
@@ -410,12 +411,11 @@ class gui(tk.Tk):
|
||||
self.cia_box.select_set(0)
|
||||
|
||||
|
||||
def execute_script(argstring, printer):
|
||||
def execute_script(args_extra, printer):
|
||||
"""Wrapper function to pipe install script output to a printer"""
|
||||
try:
|
||||
args = [sys.executable, '-u', os.path.join(os.path.dirname(__file__), "custominstall.py")]
|
||||
for arg in argstring.split():
|
||||
args.append(arg.strip())
|
||||
args.extend(args_extra)
|
||||
p = subprocess.Popen(args,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
|
||||
Reference in New Issue
Block a user