Merge pull request #14 from wwylele/font-archive

Dump shared font archive
This commit is contained in:
Weiyi Wang 2017-07-16 20:13:59 +03:00 committed by GitHub
commit 4d6486bade
4 changed files with 4 additions and 76 deletions

View File

@ -6,12 +6,10 @@
#include <stdio.h>
#include <3ds.h>
#include "utils/shared_font/shared_font.h"
#include "utils/savedatacheck/savedatacheck.h"
static unsigned int util_counter = 0;
static void (*utils[]) (void) = {
SharedFont::Dump,
SaveDataCheck::Dump,
};

View File

@ -9,7 +9,6 @@
#include <3ds.h>
#include "fs_common.h"
#include "utils/shared_font/shared_font.h"
#define TITLE_PATH "/3dsutils/nand/00000000000000000000000000000000/title/"
@ -75,6 +74,10 @@ void Dump() {
// savedatacheck/0004009b00010402.bin
u64 binary_lowpath_0004009b00010402[] = { 0x0004009b00010402, 0x00000001ffffff00 };
DumpSharedRomFS((u32*)binary_lowpath_0004009b00010402);
// savedatacheck/0004009b00014002.bin
u64 binary_lowpath_0004009b00014002[] = { 0x0004009b00014002, 0x00000001ffffff00 };
DumpSharedRomFS((u32*)binary_lowpath_0004009b00014002);
}
} // namespace

View File

@ -1,62 +0,0 @@
// Copyright 2014 Citra Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <cstdio>
#include <3ds.h>
#include "fs_common.h"
#include "utils/shared_font/shared_font.h"
#define SYSDATA_PATH "/3dsutils/sysdata/"
namespace SharedFont {
static const u32 SHARED_FONT_SIZE = 0x300000;
void Dump() {
if (!CreateFullPath(SYSDATA_PATH)) {
printf("Creating path (%s) failed! Aborting!\n", SYSDATA_PATH);
return;
}
std::string path = SYSDATA_PATH "/shared_font.bin";
SanitizeSeparators(&path);
printf("Dumping shared system font (%s)... ", path.c_str());
// Connect to APT service...
Handle apt_handle;
srvGetServiceHandle(&apt_handle, "APT:U");
u32* cmdbuf = getThreadCommandBuffer();
// Call APT::GetSharedFont function to load font into memory...
cmdbuf[0] = 0x00440000;
svcSendSyncRequest(apt_handle);
Handle mem_handle = cmdbuf[4];
void* shared_font_addr = reinterpret_cast<void*>(cmdbuf[2]);
// Close APT handle...
svcCloseHandle(apt_handle);
// Map shared font memory...
svcMapMemoryBlock(mem_handle, 0, MEMPERM_READ, MEMPERM_DONTCARE);
// Dump shared font to SDMC...
FILE* out_file = fopen(path.c_str(), "wb");
size_t bytes_written = fwrite(shared_font_addr, 1, SHARED_FONT_SIZE, out_file);
fclose(out_file);
if (bytes_written == SHARED_FONT_SIZE)
printf("Done!\n");
else
printf("Failed!\n");
}
} // namespace

View File

@ -1,11 +0,0 @@
// Copyright 2014 Citra Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#pragma once
namespace SharedFont {
void Dump();
}