diff --git a/server/source/noexs/054e4f4558454000.zip b/server/source/noexs/054e4f4558454000.zip index 7509a52..8417a12 100644 Binary files a/server/source/noexs/054e4f4558454000.zip and b/server/source/noexs/054e4f4558454000.zip differ diff --git a/server/source/noexs/054e4f4558454000/exefs.nsp b/server/source/noexs/054e4f4558454000/exefs.nsp index 473d235..06e594e 100644 Binary files a/server/source/noexs/054e4f4558454000/exefs.nsp and b/server/source/noexs/054e4f4558454000/exefs.nsp differ diff --git a/server/source/noexs/exefs.nsp b/server/source/noexs/exefs.nsp index 06e594e..33af5e1 100644 Binary files a/server/source/noexs/exefs.nsp and b/server/source/noexs/exefs.nsp differ diff --git a/server/source/noexs/include/errors.h b/server/source/noexs/include/errors.h index 660abaa..236ec1d 100644 --- a/server/source/noexs/include/errors.h +++ b/server/source/noexs/include/errors.h @@ -21,5 +21,6 @@ enum { TCPGeckoError_watchpoint_not_set, TCPGeckoError_no_free_watchpoints, TCPGeckoError_incorrect_debugger, - TCPGeckoError_user_abort + TCPGeckoError_user_abort, + TCPGeckoError_file_access_error }; \ No newline at end of file diff --git a/server/source/noexs/include/gecko.h b/server/source/noexs/include/gecko.h index 89fa3a6..f93a098 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 (139) +#define VER_PATCH (141) #define GECKO_BUFFER_SIZE (2048 * 32) #define GECKO_BUFFER_SIZE2 (2048 * 4) diff --git a/server/source/noexs/noexs.nso b/server/source/noexs/noexs.nso index 6acf888..0dd2e44 100644 Binary files a/server/source/noexs/noexs.nso and b/server/source/noexs/noexs.nso differ diff --git a/server/source/noexs/noexs.nsp b/server/source/noexs/noexs.nsp index 06e594e..33af5e1 100644 Binary files a/server/source/noexs/noexs.nsp and b/server/source/noexs/noexs.nsp differ diff --git a/server/source/noexs/source/commands.cpp b/server/source/noexs/source/commands.cpp index 72e1c4c..b92a0b9 100644 --- a/server/source/noexs/source/commands.cpp +++ b/server/source/noexs/source/commands.cpp @@ -1,4 +1,5 @@ #include +#include #include "gecko.h" #include "errors.h" #include "dmntcht.h" @@ -29,6 +30,7 @@ return MAKERESULT(Module_TCPGecko, TCPGeckoError_iofail); \ } #define USER_ABORT MAKERESULT(Module_TCPGecko, TCPGeckoError_user_abort) +#define FILE_ACCESS_ERROR MAKERESULT(Module_TCPGecko, TCPGeckoError_file_access_error) static bool dmnt = false; Result writeCompressed(Gecko::Context& ctx, u32 len) { static u8 tmp[GECKO_BUFFER_SIZE2 * 2]; @@ -538,12 +540,60 @@ static Result _dump_ptr(Gecko::Context& ctx){ if (R_SUCCEEDED(rc)) rc = process(ctx, m_heap_start, m_heap_end); return rc; } +static FILE* g_memdumpFile = NULL; +// static FILE* g_bookmarkFile = NULL; +#define HEADERSIZE 134 +//0x1B +static Result _getbookmark(Gecko::Context& ctx){ + // printf("_getbookmark\n"); + if (access("/switch/EdiZon/memdumpbookmark.dat", F_OK) != 0) { + s32 count = 0; + WRITE_CHECKED(ctx, count); + return FILE_ACCESS_ERROR; + } + g_memdumpFile = fopen("/switch/EdiZon/memdumpbookmark.dat", "r+b"); + u32 size, len, index; + u8 cont = 1; + + 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);fclose(g_memdumpFile); return USER_ABORT;} + index += len; + size -= len; + } + WRITE_CHECKED(ctx, 0); + fclose(g_memdumpFile); + return 0; +} +//0x1C +static Result _dmnt_pause(Gecko::Context& ctx){ + return dmntchtPauseCheatProcess(); +} +//0x1D +static Result _dmnt_resume(Gecko::Context& ctx){ + return dmntchtResumeCheatProcess(); +} + Result cmd_decode(Gecko::Context& ctx, int cmd){ - static Result (*cmds[263])(Gecko::Context &) = {NULL, _status, _poke8, _poke16, _poke32, _poke64, _readmem, + static Result (*cmds[287])(Gecko::Context &) = {NULL, _status, _poke8, _poke16, _poke32, _poke64, _readmem, _writemem, _resume, _pause, _attach, _detatch, _querymem_single, _querymem_multi, _current_pid, _attached_pid, _list_pids, _get_titleid, _disconnect, _readmem_multi, _set_breakpoint, _freeze_address, - _search_local, _fetch_result, _detach_dmnt, _dump_ptr, _attach_dmnt}; + _search_local, _fetch_result, _detach_dmnt, _dump_ptr, _attach_dmnt, + _getbookmark, _dmnt_pause, _dmnt_resume}; Result rc = 0; if(cmds[cmd]){ rc = cmds[cmd](ctx); diff --git a/server/source/noexs/source/lz.cpp b/server/source/noexs/source/lz.cpp index 2625261..bc9089c 100644 --- a/server/source/noexs/source/lz.cpp +++ b/server/source/noexs/source/lz.cpp @@ -43,7 +43,8 @@ int LZ_Compress(const unsigned char *in, unsigned char *out, unsigned int insize *(unsigned long long *)(&out[outpos]) = *(unsigned long long *)(&in[inpos]); outpos += marker.front; inpos += 8; - } while (inpos < MAXRANGE*8); + } while (inpos < MAXRANGE*8 && inpos < insize); + if (inpos < insize) do { marker.front = 8; for (int front = 0; front <= 8; front++) {