diff --git a/sys-botbase/source/.vs/ProjectSettings.json b/sys-botbase/source/.vs/ProjectSettings.json deleted file mode 100644 index 0cf5ea5..0000000 --- a/sys-botbase/source/.vs/ProjectSettings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "CurrentProjectSetting": "No Configurations" -} \ No newline at end of file diff --git a/sys-botbase/source/.vs/VSWorkspaceState.json b/sys-botbase/source/.vs/VSWorkspaceState.json deleted file mode 100644 index 47cea52..0000000 --- a/sys-botbase/source/.vs/VSWorkspaceState.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "ExpandedNodes": [ - "" - ], - "SelectedNode": "\\commands.c", - "PreviewInSolutionExplorer": false -} \ No newline at end of file diff --git a/sys-botbase/source/.vs/slnx.sqlite b/sys-botbase/source/.vs/slnx.sqlite deleted file mode 100644 index ca65077..0000000 Binary files a/sys-botbase/source/.vs/slnx.sqlite and /dev/null differ diff --git a/sys-botbase/source/.vs/source/v16/.suo b/sys-botbase/source/.vs/source/v16/.suo deleted file mode 100644 index e2f9464..0000000 Binary files a/sys-botbase/source/.vs/source/v16/.suo and /dev/null differ diff --git a/sys-botbase/source/.vs/source/v16/Browse.VC.db b/sys-botbase/source/.vs/source/v16/Browse.VC.db deleted file mode 100644 index 07dc2b4..0000000 Binary files a/sys-botbase/source/.vs/source/v16/Browse.VC.db and /dev/null differ diff --git a/sys-botbase/source/commands.c b/sys-botbase/source/commands.c index dbc849a..60548a9 100644 --- a/sys-botbase/source/commands.c +++ b/sys-botbase/source/commands.c @@ -21,6 +21,7 @@ u64 buttonClickSleepTime = 50; u64 keyPressSleepTime = 25; u64 pollRate = 17; // polling is linked to screen refresh rate (system UI) or game framerate. Most cases this is 1/60 or 1/30 u32 fingerDiameter = 50; +HiddbgHdlsSessionId sessionId = {0}; void attach() { @@ -42,6 +43,22 @@ void detach(){ svcCloseHandle(debughandle); } +void detachController() +{ + initController(); + + Result rc = hiddbgDetachHdlsVirtualDevice(controllerHandle); + if (R_FAILED(rc) && debugResultCodes) + printf("hiddbgDetachHdlsVirtualDevice: %d\n", rc); + rc = hiddbgReleaseHdlsWorkBuffer(sessionId); + if (R_FAILED(rc) && debugResultCodes) + printf("hiddbgReleaseHdlsWorkBuffer: %d\n", rc); + hiddbgExit(); + bControllerIsInitialised = false; + + sessionId.id = 0; +} + u64 getMainNsoBase(u64 pid){ LoaderModuleInfo proc_modules[2]; s32 numModules = 0; @@ -140,7 +157,7 @@ void initController() controllerState.analog_stick_l.y = -0x0; controllerState.analog_stick_r.x = 0x0; controllerState.analog_stick_r.y = -0x0; - rc = hiddbgAttachHdlsWorkBuffer(); + rc = hiddbgAttachHdlsWorkBuffer(&sessionId); if (R_FAILED(rc) && debugResultCodes) printf("hiddbgAttachHdlsWorkBuffer: %d\n", rc); rc = hiddbgAttachHdlsVirtualDevice(&controllerHandle, &controllerDevice); @@ -151,7 +168,6 @@ void initController() bControllerIsInitialised = true; } - void poke(u64 offset, u64 size, u8* val) { attach(); diff --git a/sys-botbase/source/commands.h b/sys-botbase/source/commands.h index 4048ec9..37c5f1c 100644 --- a/sys-botbase/source/commands.h +++ b/sys-botbase/source/commands.h @@ -37,6 +37,7 @@ typedef struct { void attach(); void detach(); +void detachController(); u64 getMainNsoBase(u64 pid); u64 getHeapBase(Handle handle); u64 getTitleId(u64 pid); diff --git a/sys-botbase/source/main.c b/sys-botbase/source/main.c index 89984e8..41825d1 100644 --- a/sys-botbase/source/main.c +++ b/sys-botbase/source/main.c @@ -312,14 +312,7 @@ int argmain(int argc, char **argv) //detachController if(!strcmp(argv[0], "detachController")) { - Result rc = hiddbgDetachHdlsVirtualDevice(controllerHandle); - if (R_FAILED(rc) && debugResultCodes) - printf("hiddbgDetachHdlsVirtualDevice: %d\n", rc); - rc = hiddbgReleaseHdlsWorkBuffer(); - if (R_FAILED(rc) && debugResultCodes) - printf("hiddbgReleaseHdlsWorkBuffer: %d\n", rc); - hiddbgExit(); - bControllerIsInitialised = false; + detachController(); } //configure