Skip to content

Commit

Permalink
elf2kip: add support for 12.0.0 immortal process flag
Browse files Browse the repository at this point in the history
  • Loading branch information
SciresM authored and fincs committed Apr 10, 2021
1 parent f85a558 commit 07835aa
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/elf2kip.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,17 @@ int ParseKipConfiguration(const char *json, KipHeader *kip_hdr) {
}
}

/* Parse immortality. */
/* This field is optional, and defaults to true (set before this function is called). */
int immortal = 1;
if (cJSON_GetBooleanOptional(npdm_json, "immortal", &immortal)) {
if (immortal) {
kip_hdr->Flags |= 0x40;
} else {
kip_hdr->Flags &= ~0x40;
}
}

/* Parse main_thread_stack_size. */
u64 stack_size = 0;
if (!cJSON_GetU64(npdm_json, "main_thread_stack_size", &stack_size)) {
Expand Down Expand Up @@ -553,7 +564,7 @@ int main(int argc, char* argv[]) {

KipHeader kip_hdr = {0};
memcpy(kip_hdr.Magic, "KIP1", 4);
kip_hdr.Flags = 0x3F;
kip_hdr.Flags = 0x7F;

if (sizeof(KipHeader) != 0x100) {
fprintf(stderr, "Bad compile environment!\n");
Expand Down

0 comments on commit 07835aa

Please sign in to comment.