Merge pull request #14 from wwylele/font-archive
Dump shared font archive
This commit is contained in:
commit
4d6486bade
@ -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,
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
@ -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();
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user