Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed external/lua-5.4.2/src/liblua.a
Binary file not shown.
Binary file removed external/lua-5.4.2/src/lua
Binary file not shown.
Binary file removed external/lua-5.4.2/src/luac
Binary file not shown.
3 changes: 3 additions & 0 deletions source/hiddbg_global_buffer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "hiddbg_global_buffer.hpp"

HiddbgHdlsSessionId tasScriptGlobalHiddbgSessionId;
5 changes: 5 additions & 0 deletions source/hiddbg_global_buffer.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#pragma once

#include <switch.h>

extern HiddbgHdlsSessionId tasScriptGlobalHiddbgSessionId;
4 changes: 3 additions & 1 deletion source/lua_hiddbg.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "lua_hiddbg.hpp"

#include "hiddbg_global_buffer.hpp"

// Returns a pro controller connected using bluetooth, accepting arguments for the bodyColor then buttonsColor then gripLColor then gripRcolor
Controller lua_hiddbg_AttachController(u32 bodyColor, u32 buttonsColor, u32 gripLColor, u32 gripRColor)
{
Expand Down Expand Up @@ -47,7 +49,7 @@ bool lua_hiddbg_IsControllerAttached(Controller *controller)
{
bool isAttached;

Result rc = hiddbgIsHdlsVirtualDeviceAttached(controller->handle, &isAttached);
Result rc = hiddbgIsHdlsVirtualDeviceAttached(tasScriptGlobalHiddbgSessionId, controller->handle, &isAttached);
if (R_FAILED(rc))
{
throw string_format("Error checking if controller attached: %#x", rc);
Expand Down
7 changes: 5 additions & 2 deletions source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
#include "lua_hiddbg.hpp"
#include "lua_vi.hpp"

// Include the global hiddbg work buffer
#include "hiddbg_global_buffer.hpp"

extern "C"
{
// Sysmodules should not use applet*.
Expand Down Expand Up @@ -103,7 +106,7 @@ void __attribute__((weak)) __appInit(void)
fatalThrow(rc);

// Attach Work Buffer
rc = hiddbgAttachHdlsWorkBuffer();
rc = hiddbgAttachHdlsWorkBuffer(&tasScriptGlobalHiddbgSessionId);
if (R_FAILED(rc))
fatalThrow(rc);

Expand All @@ -115,7 +118,7 @@ void __attribute__((weak)) userAppExit(void);
void __attribute__((weak)) __appExit(void)
{
// Cleanup default services.
hiddbgReleaseHdlsWorkBuffer();
hiddbgReleaseHdlsWorkBuffer(tasScriptGlobalHiddbgSessionId);
//timeExit();
viExit();
hiddbgExit();
Expand Down