foxygit / fake-08-xbox360 Log in
commit 9346b8dee69e62d1676ce99561e76861ada95180
Author:     jtothebell <j.to.the.bell@gmail.com>
AuthorDate: Fri Mar 12 21:21:35 2021 -0700
Commit:     jtothebell <j.to.the.bell@gmail.com>
CommitDate: Fri Mar 12 21:21:35 2021 -0700

    Stub out extmcd
---
 source/picoluaapi.cpp | 12 ++++++++++++
 source/picoluaapi.h   |  1 +
 source/vm.cpp         |  5 +++++
 source/vm.h           |  1 +
 4 files changed, 19 insertions(+)

diff --git a/source/picoluaapi.cpp b/source/picoluaapi.cpp
index 3b2e9c7..15ef97a 100644
--- a/source/picoluaapi.cpp
+++ b/source/picoluaapi.cpp
@@ -880,6 +880,18 @@ int run(lua_State *L) {
     return 0;
 }

+int extcmd(lua_State *L){
+    const char * str = "";
+
+    if (lua_isstring(L, 1)){
+        str = lua_tolstring(L, 1, nullptr);
+    }
+
+    _vmForLuaApi->vm_extcmd(str);
+
+    return 0;
+}
+
 int listcarts(lua_State *L) {
     //get cart list from VM (who should get it from host)
     vector<string> carts = _vmForLuaApi->GetCartList();
diff --git a/source/picoluaapi.h b/source/picoluaapi.h
index 3d8e8fc..2f9cda9 100644
--- a/source/picoluaapi.h
+++ b/source/picoluaapi.h
@@ -104,6 +104,7 @@ int rnd(lua_State *L);
 int srand(lua_State *L);
 int _update_buttons(lua_State *L);
 int run(lua_State *L);
+int extcmd(lua_State *L);

 //api.tonum(val)

diff --git a/source/vm.cpp b/source/vm.cpp
index 0c40a17..71d8aad 100644
--- a/source/vm.cpp
+++ b/source/vm.cpp
@@ -239,6 +239,7 @@ bool Vm::loadCart(Cart* cart) {
     lua_register(_luaState, "stat", stat);
     lua_register(_luaState, "_update_buttons", _update_buttons);
     lua_register(_luaState, "run", run);
+    lua_register(_luaState, "extcmd", extcmd);

     //rng
     lua_register(_luaState, "rnd", rnd);
@@ -779,3 +780,7 @@ void Vm::vm_run() {
         loadCart(_loadedCart);
     }
 }
+
+void Vm::vm_extcmd(const char* cmd){
+
+}
diff --git a/source/vm.h b/source/vm.h
index c72c718..4c293f3 100644
--- a/source/vm.h
+++ b/source/vm.h
@@ -122,5 +122,6 @@ class Vm {

     void vm_flip();
     void vm_run();
+    void vm_extcmd(const char* cmd);
 };