1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-26 12:12:02 +00:00

Update to v1.0.2.

This commit is contained in:
Pablo Curiel 2018-06-22 05:45:41 -04:00
parent a122605b6e
commit db3f5698e7
5 changed files with 127 additions and 106 deletions

View file

@ -33,9 +33,9 @@ include $(DEVKITPRO)/libnx/switch_rules
VERSION_MAJOR := 1
VERSION_MINOR := 0
VERSION_MICRO := 1
VERSION_MICRO := 2
APP_TITLE := Game Card Dump Tool
APP_TITLE := gcdumptool
APP_AUTHOR := MCMrARM, DarkMatterCore
APP_VERSION := ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_MICRO}

View file

@ -25,6 +25,10 @@ Thanks to
Changelog
--------------
**v1.0.2:**
* Fixed a silly bug in the file splitting code.
**v1.0.1:**
* Minor UI fixes and tweaks.

View file

@ -380,7 +380,7 @@ bool dumpGameCartridge(FsDeviceOperator* fsOperator, bool isFat32, bool dumpCert
if (new_file_chunk_size > 0)
{
if (fwrite(buf, 1, new_file_chunk_size, outFile) != new_file_chunk_size)
if (fwrite(buf + old_file_chunk_size, 1, new_file_chunk_size, outFile) != new_file_chunk_size)
{
snprintf(strbuf, sizeof(strbuf) / sizeof(strbuf[0]), "Failed to write chunk to offset 0x%016lX", fileOffset + old_file_chunk_size);
uiDrawString(strbuf, 0, (breaks + 7) * 8, 255, 0, 0);
@ -517,7 +517,7 @@ bool dumpGameCartridge(FsDeviceOperator* fsOperator, bool isFat32, bool dumpCert
if (new_file_chunk_size > 0)
{
if (fwrite(buf, 1, new_file_chunk_size, outFile) != new_file_chunk_size)
if (fwrite(buf + old_file_chunk_size, 1, new_file_chunk_size, outFile) != new_file_chunk_size)
{
snprintf(strbuf, sizeof(strbuf) / sizeof(strbuf[0]), "Failed to write chunk to offset 0x%016lX", fileOffset + old_file_chunk_size);
uiDrawString(strbuf, 0, (breaks + 7) * 8, 255, 0, 0);
@ -770,7 +770,7 @@ bool dumpRawPartition(FsDeviceOperator* fsOperator, u32 partition, bool doSplitt
if (new_file_chunk_size > 0)
{
if (fwrite(buf, 1, new_file_chunk_size, outFile) != new_file_chunk_size)
if (fwrite(buf + old_file_chunk_size, 1, new_file_chunk_size, outFile) != new_file_chunk_size)
{
snprintf(strbuf, sizeof(strbuf) / sizeof(strbuf[0]), "Failed to write chunk to offset 0x%016lX", off + old_file_chunk_size);
uiDrawString(strbuf, 0, (breaks + 4) * 8, 255, 0, 0);
@ -989,12 +989,15 @@ bool copyFile(const char* source, const char* dest, bool doSplitting)
break;
}
if (fwrite(buf, 1, new_file_chunk_size, outFile) != new_file_chunk_size)
if (new_file_chunk_size > 0)
{
if (fwrite(buf + old_file_chunk_size, 1, new_file_chunk_size, outFile) != new_file_chunk_size)
{
snprintf(strbuf, sizeof(strbuf) / sizeof(strbuf[0]), "Failed to write chunk to offset 0x%016lX", off + old_file_chunk_size);
uiDrawString(strbuf, 0, (breaks + 7) * 8, 255, 0, 0);
break;
}
}
} else {
if (fwrite(buf, 1, n, outFile) != n)
{

View file

@ -2,7 +2,6 @@
#include <malloc.h>
#include <switch.h>
#include <memory.h>
#include <switch/services/ns.h>
#include "dumper.h"
#include "ncmext.h"
@ -37,12 +36,16 @@ int main(int argc, char **argv)
currentFB = gfxGetFramebuffer(&currentFBWidth, &currentFBHeight);
int ret = 0;
Result result;
char strbuf[512] = {'\0'};
if (R_SUCCEEDED(ncmInitialize()))
if (R_SUCCEEDED(result = fsInitialize()))
{
if (R_SUCCEEDED(nsInitialize()))
if (R_SUCCEEDED(result = fsOpenDeviceOperator(&fsOperatorInstance)))
{
if (R_SUCCEEDED(fsOpenDeviceOperator(&fsOperatorInstance)))
if (R_SUCCEEDED(result = ncmInitialize()))
{
if (R_SUCCEEDED(result = nsInitialize()))
{
bool exitLoop = false;
@ -58,7 +61,7 @@ int main(int argc, char **argv)
{
if (hfs0_header == NULL)
{
// Don't access the gamecard immediately to avoid conflicts with the fs-srv, ncm and ns services
// Don't access the gamecard immediately to avoid conflicts with the fsp-srv, ncm and ns services
uiPleaseWait();
getRootHfs0Header(&fsOperatorInstance);
@ -141,23 +144,34 @@ int main(int argc, char **argv)
syncDisplay();
}
fsDeviceOperatorClose(&fsOperatorInstance);
} else {
uiDrawString("Failed to open device operator.", 0, 0, 255, 255, 255);
delay(5);
ret = -3;
}
nsExit();
} else {
uiDrawString("Failed to initialize the NS service.", 0, 0, 255, 255, 255);
snprintf(strbuf, sizeof(strbuf) / sizeof(strbuf[0]), "Failed to initialize the ns service! (0x%08x)", result);
uiDrawString(strbuf, 0, 0, 255, 255, 255);
delay(5);
ret = -2;
ret = -4;
}
ncmExit();
} else {
uiDrawString("Failed to initialize the NCM service.", 0, 0, 255, 255, 255);
snprintf(strbuf, sizeof(strbuf) / sizeof(strbuf[0]), "Failed to initialize the ncm service! (0x%08x)", result);
uiDrawString(strbuf, 0, 0, 255, 255, 255);
delay(5);
ret = -3;
}
fsDeviceOperatorClose(&fsOperatorInstance);
} else {
snprintf(strbuf, sizeof(strbuf) / sizeof(strbuf[0]), "Failed to open device operator! (0x%08x)", result);
uiDrawString(strbuf, 0, 0, 255, 255, 255);
delay(5);
ret = -2;
}
fsExit();
} else {
snprintf(strbuf, sizeof(strbuf) / sizeof(strbuf[0]), "Failed to initialize the fsp-srv service! (0x%08x)", result);
uiDrawString(strbuf, 0, 0, 255, 255, 255);
delay(5);
ret = -1;
}

View file

@ -5,7 +5,7 @@
#include <switch.h>
#define APP_VERSION "1.0.1"
#define APP_VERSION "1.0.2"
#define NAME_BUF_LEN 4096
bool isGameCardInserted(FsDeviceOperator* o);