mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-22 20:06:40 +00:00
[stage2] Add dump_to_file
This commit is contained in:
parent
8df624a10d
commit
bc7369b5d1
3 changed files with 13 additions and 0 deletions
|
@ -13,3 +13,14 @@ size_t read_from_file(void *dst, size_t dst_size, const char *filename) {
|
|||
return sz;
|
||||
}
|
||||
}
|
||||
|
||||
size_t dump_to_file(const void *src, size_t src_size, const char *filename) {
|
||||
FILE *file = fopen(filename, "wb+");
|
||||
if (file == NULL) {
|
||||
return 0;
|
||||
} else {
|
||||
size_t sz = fwrite(src, 1, src_size, file);
|
||||
fclose(file);
|
||||
return sz;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
#include "sdmmc.h"
|
||||
|
||||
size_t read_from_file(void *dst, size_t dst_size, const char *filename);
|
||||
size_t dump_to_file(const void *src, size_t src_size, const char *filename);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -44,6 +44,7 @@ static int mmc_partition_initialize(device_partition_t *devpart) {
|
|||
if (mmcpart->mmc == &g_sd_mmc && !g_sd_mmc_initialized) {
|
||||
int rc = sdmmc_init(mmcpart->mmc, mmcpart->controller);
|
||||
if (rc == 0) {
|
||||
sdmmc_set_write_enable(mmcpart->mmc, SDMMC_WRITE_ENABLED);
|
||||
g_sd_mmc_initialized = true;
|
||||
}
|
||||
return rc;
|
||||
|
|
Loading…
Reference in a new issue