diff --git a/server/source/noexs/include/gecko.h b/server/source/noexs/include/gecko.h index 4377dcc..b6f30be 100644 --- a/server/source/noexs/include/gecko.h +++ b/server/source/noexs/include/gecko.h @@ -12,7 +12,7 @@ #define VER_MAJOR (1) #define VER_MINOR (1) -#define VER_PATCH (155) +#define VER_PATCH (157) #define GECKO_BUFFER_SIZE (2048 * 32) #define GECKO_BUFFER_SIZE2 (2048 * 4) diff --git a/server/source/noexs/source/commands.cpp b/server/source/noexs/source/commands.cpp index 19e8ba8..caf418e 100644 --- a/server/source/noexs/source/commands.cpp +++ b/server/source/noexs/source/commands.cpp @@ -63,6 +63,7 @@ static u8 outbuffer[GECKO_BUFFER_SIZE * 9 / 8]; static FILE* g_memdumpFile = NULL; // static FILE* g_bookmarkFile = NULL; #define HEADERSIZE 135 +#define HEADERSIZE2 424 enum t_searchsize { _8, _16, _32, _64 }; @@ -264,7 +265,7 @@ static Result _attach(Gecko::Context& ctx){ ctx.status = Gecko::Status::Paused; } else { if (ctx.dbg.attached()) { - // dmntchtInitialize(); + dmntchtInitialize(); DmntCheatProcessMetadata cht; dmntchtGetCheatProcessMetadata(&cht); if (cht.process_id == pid) { @@ -276,7 +277,7 @@ static Result _attach(Gecko::Context& ctx){ } } else { - // dmntchtExit(); + dmntchtExit(); } } } @@ -723,36 +724,78 @@ static Result _dump_ptr(Gecko::Context& ctx){ static Result _getbookmark(Gecko::Context& ctx){ // printf("_getbookmark\n"); u8 cont = 1; - if (access("/switch/EdiZon/BMDump.dat", F_OK) != 0) { + if ((access("/switch/EdiZon/BMDump.dat", F_OK) != 0) && (access("/switch/Breeze/cheats/BMDump.dat", F_OK) != 0)) { WRITE_CHECKED(ctx, 0) READ_CHECKED(ctx, cont); return FILE_ACCESS_ERROR; } - g_memdumpFile = fopen("/switch/EdiZon/BMDump.dat", "r+b"); - u32 size, len, index; - - fseek(g_memdumpFile, 0, SEEK_END); - size = (ftell(g_memdumpFile) - HEADERSIZE); - printf("size = %d\n",size); - - index = 0; - while (size > 0) { - len = (size < GECKO_BUFFER_SIZE) ? size : GECKO_BUFFER_SIZE; - fseek(g_memdumpFile, HEADERSIZE + index, SEEK_SET); - fread(outbuffer + outbuffer_offset, 1, len, g_memdumpFile); - // compress option - s32 count = LZ_Compress(outbuffer + outbuffer_offset, outbuffer, len); - // - printf("count = %d\n", count); - WRITE_CHECKED(ctx, count); - WRITE_BUFFER_CHECKED(ctx, outbuffer, count); - READ_CHECKED(ctx,cont); if (!cont) {WRITE_CHECKED(ctx, 0);READ_CHECKED(ctx, cont);fclose(g_memdumpFile); return USER_ABORT;} - index += len; - size -= len; + if (access("/switch/EdiZon/BMDump.dat", F_OK) == 0) { + g_memdumpFile = fopen("/switch/EdiZon/BMDump.dat", "r+b"); + + u32 size, len, index; + + fseek(g_memdumpFile, 0, SEEK_END); + size = (ftell(g_memdumpFile) - HEADERSIZE); + printf("size = %d\n", size); + + index = 0; + while (size > 0) { + len = (size < GECKO_BUFFER_SIZE) ? size : GECKO_BUFFER_SIZE; + fseek(g_memdumpFile, HEADERSIZE + index, SEEK_SET); + fread(outbuffer + outbuffer_offset, 1, len, g_memdumpFile); + // compress option + s32 count = LZ_Compress(outbuffer + outbuffer_offset, outbuffer, len); + // + printf("count = %d\n", count); + WRITE_CHECKED(ctx, count); + WRITE_BUFFER_CHECKED(ctx, outbuffer, count); + READ_CHECKED(ctx, cont); + if (!cont) { + WRITE_CHECKED(ctx, 0); + READ_CHECKED(ctx, cont); + fclose(g_memdumpFile); + return USER_ABORT; + } + index += len; + size -= len; + } + fclose(g_memdumpFile); + } + if (access("/switch/Breeze/cheats/BMDump.dat", F_OK) == 0) { + g_memdumpFile = fopen("/switch/Breeze/cheats/BMDump.dat", "r+b"); + + u32 size, len, index; + + fseek(g_memdumpFile, 0, SEEK_END); + size = (ftell(g_memdumpFile) - HEADERSIZE2); + printf("size = %d\n", size); + + index = 0; + while (size > 0) { + len = (size < GECKO_BUFFER_SIZE) ? size : GECKO_BUFFER_SIZE; + fseek(g_memdumpFile, HEADERSIZE2 + index, SEEK_SET); + fread(outbuffer + outbuffer_offset, 1, len, g_memdumpFile); + // compress option + s32 count = LZ_Compress(outbuffer + outbuffer_offset, outbuffer, len); + // + printf("count = %d\n", count); + WRITE_CHECKED(ctx, count); + WRITE_BUFFER_CHECKED(ctx, outbuffer, count); + READ_CHECKED(ctx, cont); + if (!cont) { + WRITE_CHECKED(ctx, 0); + READ_CHECKED(ctx, cont); + fclose(g_memdumpFile); + return USER_ABORT; + } + index += len; + size -= len; + } + fclose(g_memdumpFile); } + WRITE_CHECKED(ctx, 0); READ_CHECKED(ctx, cont); - fclose(g_memdumpFile); return 0; } //0x1C diff --git a/server/source/noexs/source/main.cpp b/server/source/noexs/source/main.cpp index 364d8da..1a09f76 100644 --- a/server/source/noexs/source/main.cpp +++ b/server/source/noexs/source/main.cpp @@ -38,7 +38,7 @@ void __libnx_initheap(void) { void __appInit(void) { Result rc; - if (hosversionGet() == 0) { + rc = setsysInitialize(); if (R_SUCCEEDED(rc)) { SetSysFirmwareVersion fw; @@ -47,7 +47,10 @@ void __appInit(void) { hosversionSet((BIT(31)) | (MAKEHOSVERSION(fw.major, fw.minor, fw.micro))); setsysExit(); } - } + if (rc!=0) { + printf("version set failed rc=%d",rc); + hosversionSet(6); + }; // SetSysFirmwareVersion hosversion; // rc = setsysGetFirmwareVersion(&hosversion); // hosversionSet(hosversion.major); @@ -90,7 +93,7 @@ void __appInit(void) { fatalThrow(rc); // maybe set a variable like noSd or something? It doesn't HAVE to log. } - rc = dmntchtInitialize(); + // rc = dmntchtInitialize(); // if (R_FAILED(rc)) { // fatalThrow(rc); // maybe set a variable like noSd or something? It doesn't HAVE to log. // }