1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-08 11:51:48 +00:00

More baby steps.

This commit is contained in:
Pablo Curiel 2020-04-15 20:06:41 -04:00
parent eccd3f0c1c
commit c83858311b
28 changed files with 543 additions and 63 deletions

View file

@ -1,3 +1,19 @@
/*
* Copyright (c) 2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

View file

@ -1,3 +1,19 @@
/*
* Copyright (c) 2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef __CERT_H__

View file

@ -8,8 +8,7 @@
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include "crc32_fast.h"
#include <switch/types.h>
u32 crc32_for_byte(u32 r)
{

View file

@ -1,10 +0,0 @@
#pragma once
#ifndef __CRC32_FAST_H__
#define __CRC32_FAST_H__
#include <switch/types.h>
void crc32(const void *data, u64 n_bytes, u32 *crc);
#endif /* __CRC32_FAST_H__ */

View file

@ -1,3 +1,19 @@
/*
* Copyright (c) 2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <switch/services/sm.h>
#include <stdlib.h>
#include <string.h>

View file

@ -1,3 +1,19 @@
/*
* Copyright (c) 2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef __ES_H__

View file

@ -1,3 +1,19 @@
/*
* Copyright (c) 2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <switch/services/fs.h>
#include <stdlib.h>
#include <string.h>

View file

@ -1,3 +1,19 @@
/*
* Copyright (c) 2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef __FS_EXT_H__

View file

@ -1,3 +1,20 @@
/*
* Copyright (c) 2019-2020 XorTroll
* Copyright (c) 2019-2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define NX_SERVICE_ASSUME_NON_DOMAIN
#include "fspusb.h"
#include "service_guard.h"

View file

@ -1,9 +1,20 @@
/**
* @file fspusb.h
* @brief USB filesystem extension (fsp-usb) service IPC wrapper.
* @author XorTroll
* @copyright libnx Authors
/*
* Copyright (c) 2019-2020 XorTroll
* Copyright (c) 2019-2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef __FSPUSB_H__

View file

@ -1,3 +1,19 @@
/*
* Copyright (c) 2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@ -75,7 +91,8 @@ static void gamecardCloseStorageArea(void);
static bool gamecardGetSizesFromStorageAreas(void);
/* Service guard used to generate thread-safe initialize + exit functions */
/* Service guard used to generate thread-safe initialize + exit functions. */
/* I'm using this here even though this actually isn't a service but who cares, it gets the job done. */
NX_GENERATE_SERVICE_GUARD(gamecard);
bool gamecardIsReady(void)
@ -766,7 +783,7 @@ static bool gamecardGetSizesFromStorageAreas(void)
gamecardCloseStorageArea();
if (R_FAILED(rc))
if (R_FAILED(rc) || !area_size)
{
LOGFILE("fsStorageGetSize failed to retrieve %s storage area size! (0x%08X)", GAMECARD_STORAGE_AREA_NAME(area), rc);
g_gameCardStorageNormalAreaSize = g_gameCardStorageSecureAreaSize = 0;

View file

@ -1,3 +1,19 @@
/*
* Copyright (c) 2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef __GAMECARD_H__

View file

@ -1,3 +1,19 @@
/*
* Copyright (c) 2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

View file

@ -1,3 +1,19 @@
/*
* Copyright (c) 2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef __KEYS_H__

View file

@ -1,3 +1,19 @@
/*
* Copyright (c) 2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -44,26 +60,113 @@ int main(int argc, char *argv[])
if (gamecardIsReady()) break;
}
u64 size = 0;
if (!gamecardGetTotalRomSize(&size))
FILE *tmp_file = NULL;
GameCardHeader header = {0};
FsGameCardCertificate cert = {0};
u64 total_size = 0, trimmed_size = 0;
u32 update_version = 0;
if (gamecardGetHeader(&header))
{
printf("totalromsize failed");
goto out2;
printf("header success\n");
consoleUpdate(NULL);
tmp_file = fopen("sdmc:/header.bin", "wb");
if (tmp_file)
{
fwrite(&header, 1, sizeof(GameCardHeader), tmp_file);
fclose(tmp_file);
tmp_file = NULL;
printf("header saved\n");
} else {
printf("header not saved\n");
}
} else {
printf("header failed\n");
}
printf("totalromsize: 0x%lX\n", size);
consoleUpdate(NULL);
if (!gamecardGetTrimmedRomSize(&size))
if (gamecardGetTotalRomSize(&total_size))
{
printf("trimmedromsize failed");
goto out2;
printf("total_size: 0x%lX\n", total_size);
} else {
printf("total_size failed\n");
}
printf("trimmedromsize: 0x%lX\n", size);
out2:
consoleUpdate(NULL);
if (gamecardGetTrimmedRomSize(&trimmed_size))
{
printf("trimmed_size: 0x%lX\n", trimmed_size);
} else {
printf("trimmed_size failed\n");
}
consoleUpdate(NULL);
if (gamecardGetCertificate(&cert))
{
printf("cert success\n");
consoleUpdate(NULL);
tmp_file = fopen("sdmc:/cert.bin", "wb");
if (tmp_file)
{
fwrite(&cert, 1, sizeof(FsGameCardCertificate), tmp_file);
fclose(tmp_file);
tmp_file = NULL;
printf("cert saved\n");
} else {
printf("cert not saved\n");
}
} else {
printf("cert failed\n");
}
consoleUpdate(NULL);
if (gamecardGetBundledFirmwareUpdateVersion(&update_version))
{
printf("update_version: %u\n", update_version);
} else {
printf("update_version failed\n");
}
consoleUpdate(NULL);
u8 *buf = malloc((u64)0x400300); // 4 MiB + 512 bytes + 256 bytes
if (buf)
{
printf("buf succeeded\n");
consoleUpdate(NULL);
if (gamecardRead(buf, (u64)0x400300, (u64)0x16F18100)) // force unaligned read that spans both storage areas
{
printf("read succeeded\n");
consoleUpdate(NULL);
tmp_file = fopen("sdmc:/data.bin", "wb");
if (tmp_file)
{
fwrite(buf, 1, (u64)0x400300, tmp_file);
fclose(tmp_file);
tmp_file = NULL;
printf("data saved\n");
} else {
printf("data not saved\n");
}
} else {
printf("read failed\n");
}
free(buf);
} else {
printf("buf failed\n");
}
consoleUpdate(NULL);
SLEEP(3);
consoleExit(NULL);

View file

@ -1,3 +1,19 @@
/*
* Copyright (c) 2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

View file

@ -1,3 +1,19 @@
/*
* Copyright (c) 2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef __NCA_H__

View file

@ -1,3 +1,19 @@
/*
* Copyright (c) 2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <string.h>
#include <mbedtls/entropy.h>

View file

@ -1,3 +1,19 @@
/*
* Copyright (c) 2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef __RSA_H__

View file

@ -1,5 +1,19 @@
/* Savedata container parsing code taken from Lockpick_RCM with some slight modifications */
/* Big thanks to shchmue */
/*
* Copyright (c) 2019-2020 shchmue
* Copyright (c) 2019-2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <string.h>
@ -122,39 +136,40 @@ static remap_segment_ctx_t *save_remap_init_segments(remap_header_t *header, rem
for(i = 0; i < header->map_segment_count; i++)
{
remap_segment_ctx_t *seg = &segments[i];
remap_segment_ctx_t *seg = &(segments[i]);
seg->entries = calloc(1, sizeof(remap_entry_ctx_t));
seg->entry_count = 0;
seg->entries = calloc(1, sizeof(remap_entry_ctx_t*));
if (!seg->entries)
{
LOGFILE("Failed to allocate memory for remap segment entry #%u!", entry_idx);
goto out;
}
memcpy(seg->entries, &map_entries[entry_idx], sizeof(remap_entry_ctx_t));
seg->entries[seg->entry_count++] = &map_entries[entry_idx];
seg->offset = map_entries[entry_idx].virtual_offset;
map_entries[entry_idx].segment = seg;
seg->entry_count = 1;
entry_idx++;
map_entries[entry_idx++].segment = seg;
while(entry_idx < num_map_entries && map_entries[entry_idx - 1].virtual_offset_end == map_entries[entry_idx].virtual_offset)
{
map_entries[entry_idx].segment = seg;
map_entries[entry_idx - 1].next = &map_entries[entry_idx];
seg->entries = calloc(1, sizeof(remap_entry_ctx_t));
if (!seg->entries)
remap_entry_ctx_t **ptr = calloc(sizeof(remap_entry_ctx_t*), seg->entry_count + 1);
if (!ptr)
{
LOGFILE("Failed to allocate memory for remap segment entry #%u!", entry_idx);
goto out;
}
memcpy(seg->entries, &map_entries[entry_idx], sizeof(remap_entry_ctx_t));
seg->entry_count++;
entry_idx++;
memcpy(ptr, seg->entries, sizeof(remap_entry_ctx_t*) * seg->entry_count);
free(seg->entries);
seg->entries = ptr;
seg->entries[seg->entry_count++] = &map_entries[entry_idx++];
}
seg->length = (seg->entries[seg->entry_count - 1].virtual_offset_end - seg->entries[0].virtual_offset);
seg->length = (seg->entries[seg->entry_count - 1]->virtual_offset_end - seg->entries[0]->virtual_offset);
}
success = true;
@ -174,8 +189,7 @@ out:
map_entries[entry_idx].segment->entries = NULL;
}
map_entries[entry_idx].segment = NULL;
entry_idx++;
map_entries[entry_idx++].segment = NULL;
while(entry_idx < num_map_entries && map_entries[entry_idx - 1].virtual_offset_end == map_entries[entry_idx].virtual_offset)
{
@ -189,8 +203,7 @@ out:
map_entries[entry_idx].segment->entries = NULL;
}
map_entries[entry_idx].segment = NULL;
entry_idx++;
map_entries[entry_idx++].segment = NULL;
}
}
@ -215,7 +228,7 @@ static remap_entry_ctx_t *save_remap_get_map_entry(remap_storage_ctx_t *ctx, u64
{
for(unsigned int i = 0; i < ctx->segments[segment_idx].entry_count; i++)
{
if (ctx->segments[segment_idx].entries[i].virtual_offset_end > offset) return (&ctx->segments[segment_idx].entries[i]);
if (ctx->segments[segment_idx].entries[i]->virtual_offset_end > offset) return ctx->segments[segment_idx].entries[i];
}
}
@ -360,7 +373,7 @@ static bool save_ivfc_storage_init(hierarchical_integrity_verification_storage_c
u32 length;
};
static struct salt_source_t salt_sources[6] = {
static const struct salt_source_t salt_sources[6] = {
{ "HierarchicalIntegrityVerificationStorage::Master", 48 },
{ "HierarchicalIntegrityVerificationStorage::L1", 44 },
{ "HierarchicalIntegrityVerificationStorage::L2", 44 },
@ -560,7 +573,7 @@ static bool save_ivfc_storage_read(integrity_verification_storage_ctx_t *ctx, vo
}
memcpy(data_buffer, ctx->salt, 0x20);
memcpy(data_buffer + 0x20, buffer, count);
memcpy(data_buffer + 0x20, buffer, ctx->sector_size);
sha256CalculateHash(hash, data_buffer, ctx->sector_size + 0x20);
hash[0x1F] |= 0x80;
@ -1223,9 +1236,7 @@ bool save_process(save_ctx_t *ctx)
return success;
}
if (!save_process_header(ctx)) return success;
if (ctx->header_hash_validity == VALIDITY_INVALID)
if (!save_process_header(ctx) || ctx->header_hash_validity == VALIDITY_INVALID)
{
/* Try to parse Header B. */
fr = f_lseek(ctx->file, 0x4000);
@ -1242,9 +1253,7 @@ bool save_process(save_ctx_t *ctx)
return success;
}
if (!save_process_header(ctx)) return success;
if (ctx->header_hash_validity == VALIDITY_INVALID)
if (!save_process_header(ctx) || ctx->header_hash_validity == VALIDITY_INVALID)
{
LOGFILE("Savefile header is invalid!");
return success;
@ -1591,7 +1600,7 @@ void save_free_contexts(save_ctx_t *ctx)
{
for(unsigned int j = 0; j < ctx->data_remap_storage.segments[i].entry_count; j++)
{
if (&(ctx->data_remap_storage.segments[i].entries[j])) free(&(ctx->data_remap_storage.segments[i].entries[j]));
if (ctx->data_remap_storage.segments[i].entries[j]) free(ctx->data_remap_storage.segments[i].entries[j]);
}
}
}
@ -1614,7 +1623,7 @@ void save_free_contexts(save_ctx_t *ctx)
{
for(unsigned int j = 0; j < ctx->meta_remap_storage.segments[i].entry_count; j++)
{
if (&(ctx->meta_remap_storage.segments[i].entries[j])) free(&(ctx->meta_remap_storage.segments[i].entries[j]));
if (ctx->meta_remap_storage.segments[i].entries[j]) free(ctx->meta_remap_storage.segments[i].entries[j]);
}
}
}

View file

@ -1,5 +1,19 @@
/* Savedata container parsing code taken from Lockpick_RCM with some slight modifications */
/* Big thanks to shchmue */
/*
* Copyright (c) 2019-2020 shchmue
* Copyright (c) 2019-2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
@ -165,7 +179,7 @@ struct remap_entry_ctx_t {
struct remap_segment_ctx_t{
u64 offset;
u64 length;
remap_entry_ctx_t *entries;
remap_entry_ctx_t **entries;
u64 entry_count;
};

View file

@ -1,3 +1,19 @@
/*
* Copyright (c) 2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <string.h>
#include <switch.h>

View file

@ -1,3 +1,19 @@
/*
* Copyright (c) 2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef __SERVICES_H__

View file

@ -1,3 +1,19 @@
/*
* Copyright (c) 2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef __SIGNATURE_H__

View file

@ -1,3 +1,19 @@
/*
* Copyright (c) 2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

View file

@ -1,3 +1,19 @@
/*
* Copyright (c) 2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef __TIK_H__

View file

@ -1,3 +1,19 @@
/*
* Copyright (c) 2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
@ -84,7 +100,7 @@ void utilsWriteLogMessage(const char *func_name, const char *fmt, ...)
time_t now = time(NULL);
struct tm *ts = localtime(&now);
fprintf(logfile, "%d/%d/%d %d:%d:%d -> %s: ", ts->tm_year + 1900, ts->tm_mon + 1, ts->tm_mday, ts->tm_hour, ts->tm_min, ts->tm_sec, func_name);
fprintf(logfile, "%d/%d/%d %d:%02d:%02d -> %s: ", ts->tm_year + 1900, ts->tm_mon + 1, ts->tm_mday, ts->tm_hour, ts->tm_min, ts->tm_sec, func_name);
va_start(args, fmt);
vfprintf(logfile, fmt, args);

View file

@ -1,3 +1,19 @@
/*
* Copyright (c) 2020 DarkMatterCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef __UTILS_H__