Skip to content

Commit

Permalink
Set ld_bin_format for embedded Zehn files properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Vogtinator committed Mar 14, 2023
1 parent 8ec6e54 commit eda6325
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ndless/src/resources/ploaderhook.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ static int ndless_load(const char *docpath, NUC_FILE *docfile, void **base, int
{
case 0: // Execute as Zehn
case 2: // Valid Zehn, but don't execute
ld_bin_format = LD_ZEHN_BIN;
free(scanarea);
return ret;
case 1: // Invalid Zehn
Expand Down Expand Up @@ -301,30 +302,30 @@ int ld_exec_with_args(const char *path, int argsn, char *args[], void **resident
switch(signature)
{
case 0x00475250: //"PRG\0"
ld_bin_format = LD_PRG_BIN;
if((ret = ndless_load(prgm_path, prgm, &base, &entry, &supports_hww)) == 0)
{
nuc_fclose(prgm);
ld_bin_format = LD_PRG_BIN;
break;
}

nuc_fclose(prgm);
return ret == 1 ? 0xDEAD : 0xBEEF;
case 0x544c4662: //"bFLT"
ld_bin_format = LD_BFLT_BIN;
if(bflt_load(prgm, &base, &entry) == 0)
{
nuc_fclose(prgm);
ld_bin_format = LD_BFLT_BIN;
break;
}

nuc_fclose(prgm);
return 0xDEAD;
case 0x6e68655a: //"Zehn"
ld_bin_format = LD_ZEHN_BIN;
if((ret = zehn_load(prgm, &base, &entry, &supports_hww)) == 0)
{
nuc_fclose(prgm);
ld_bin_format = LD_ZEHN_BIN;
break;
}

Expand Down

0 comments on commit eda6325

Please sign in to comment.