Skip to content

Commit

Permalink
check model before formatting flash
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseAaronLopezGarcia committed Jun 5, 2024
1 parent fb12bba commit 35b1449
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions loader/dc/vunbricker/install.c
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,38 @@ int install_thread(SceSize args, void *argp)

dcSetCancelMode(1);

int file_count = sizeof(f0_common) / sizeof(f0_common[0]);

switch (model)
{
case 0:
file_count += sizeof(f0_01g) / sizeof(f0_01g[0]);
break;
case 1:
file_count += sizeof(f0_02g) / sizeof(f0_02g[0]);
break;
case 2:
file_count += sizeof(f0_03g) / sizeof(f0_03g[0]);
break;
case 3:
file_count += sizeof(f0_04g) / sizeof(f0_04g[0]);
break;
case 4:
file_count += sizeof(f0_05g) / sizeof(f0_05g[0]);
break;
case 6:
file_count += sizeof(f0_07g) / sizeof(f0_07g[0]);
break;
case 8:
file_count += sizeof(f0_09g) / sizeof(f0_09g[0]);
break;
case 10:
file_count += sizeof(f0_11g) / sizeof(f0_11g[0]);
break;
default:
InstallError(fw, "Unsupported model.");
}

switch(LoadUpdaterModules(fw))
{
case 0: break;
Expand Down Expand Up @@ -1079,38 +1111,6 @@ int install_thread(SceSize args, void *argp)

SetStatus("Flashing files...");

int file_count = sizeof(f0_common) / sizeof(f0_common[0]);

switch (model)
{
case 0:
file_count += sizeof(f0_01g) / sizeof(f0_01g[0]);
break;
case 1:
file_count += sizeof(f0_02g) / sizeof(f0_02g[0]);
break;
case 2:
file_count += sizeof(f0_03g) / sizeof(f0_03g[0]);
break;
case 3:
file_count += sizeof(f0_04g) / sizeof(f0_04g[0]);
break;
case 4:
file_count += sizeof(f0_05g) / sizeof(f0_05g[0]);
break;
case 6:
file_count += sizeof(f0_07g) / sizeof(f0_07g[0]);
break;
case 8:
file_count += sizeof(f0_09g) / sizeof(f0_09g[0]);
break;
case 10:
file_count += sizeof(f0_11g) / sizeof(f0_11g[0]);
break;
default:
InstallError(fw, "Unsupported model.");
}

int ctr = 0;
CopyFileList(fw, f0_common, sizeof(f0_common) / sizeof(f0_common[0]), ctr, file_count);
ctr += sizeof(f0_common) / sizeof(f0_common[0]);
Expand Down

0 comments on commit 35b1449

Please sign in to comment.