diff --git a/custom_action.go b/custom_action.go index 88c525b..2ab588a 100644 --- a/custom_action.go +++ b/custom_action.go @@ -24,7 +24,7 @@ import ( // Implementers of this interface must embed an CustomActionHandler struct // and provide implementations for the Run and Stop methods. type CustomActionImpl interface { - Run(ctx SyncContext, taskName, ActionParam string, curBox RectBuffer, curRecDetail string) bool + Run(ctx SyncContext, taskName, ActionParam string, curBox Rect, curRecDetail string) bool Stop() Handle() unsafe.Pointer @@ -56,11 +56,12 @@ func _RunAgent( actionArg C.MaaTransparentArg, ) C.uint8_t { act := *(*CustomActionImpl)(unsafe.Pointer(actionArg)) + curBoxRectBuffer := rectBuffer{handle: curBox} ok := act.Run( SyncContext{handle: ctx}, C.GoString(taskName), C.GoString(customActionParam), - &rectBuffer{handle: curBox}, + curBoxRectBuffer.Get(), C.GoString(curRecDetail), ) if ok { diff --git a/run_without_file_test.go b/run_without_file_test.go index c6afb22..6ac5856 100644 --- a/run_without_file_test.go +++ b/run_without_file_test.go @@ -10,7 +10,7 @@ type MyAct struct { CustomActionHandler } -func (act MyAct) Run(ctx SyncContext, taskName, ActionParam string, curBox RectBuffer, curRecDetail string) bool { +func (act MyAct) Run(ctx SyncContext, taskName, ActionParam string, curBox Rect, curRecDetail string) bool { image, ok := ctx.Screencap() defer image.Destroy() if !ok {