Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
"Fixed" the HTTPC lib with the crappiest code you've ever seen, Added…
… a (very) small QTM lib Don't look at the HTTPC code !!! Also, the example only work a random number of times.
- Loading branch information
Showing
4 changed files
with
165 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
local ctr = require("ctr") | ||
local gfx = require("ctr.gfx") | ||
local hid = require("ctr.hid") | ||
local httpc = require("ctr.httpc") | ||
|
||
local err = 0 | ||
|
||
--assert(httpc.init()) | ||
|
||
local context = assert(httpc.context()) | ||
|
||
assert(context:open("http://firew0lf.github.io/")) | ||
assert(context:beginRequest()) | ||
|
||
local data = assert(context:downloadData()) | ||
|
||
while ctr.run() do | ||
hid.read() | ||
keys = hid.keys() | ||
if keys.held.start then break end | ||
if keys.down.b then | ||
assert(context:open("http://firew0lf.github.io/")) | ||
assert(context:beginRequest()) | ||
data = assert(context:downloadData()) | ||
data = (data.."!") | ||
end | ||
|
||
gfx.startFrame(gfx.GFX_TOP) | ||
gfx.text(0, 0, data) | ||
gfx.endFrame() | ||
|
||
gfx.render() | ||
end | ||
|
||
|
||
context:close() | ||
--httpc.shutdown() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#include <3ds.h> | ||
#include <3ds/types.h> | ||
#include <3ds/services/qtm.h> | ||
|
||
#include <lapi.h> | ||
#include <lauxlib.h> | ||
|
||
static int qtm_init(lua_State *L) { | ||
qtmInit(); | ||
|
||
return 0; | ||
} | ||
|
||
static int qtm_shutdown(lua_State *L) { | ||
qtmExit(); | ||
|
||
return 0; | ||
} | ||
|
||
static int qtm_checkInitialized(lua_State *L) { | ||
bool isInit = qtmCheckInitialized(); | ||
|
||
lua_pushboolean(L, isInit); | ||
return 1; | ||
} | ||
|
||
static int qtm_getHeadtrackingInfo(lua_State *L) { | ||
return 0; | ||
} | ||
|
||
static int qtm_checkHeadFullyDetected(lua_State *L) { | ||
return 0; | ||
} | ||
|
||
static int qtm_convertCoordToScreen(lua_State *L) { | ||
return 0; | ||
} | ||
|
||
// module | ||
static const struct luaL_Reg qtm_functions[] = { | ||
{"init", qtm_init }, | ||
{"shutdown", qtm_shutdown }, | ||
{"checkInitialized", qtm_checkInitialized }, | ||
{"getHeadtrackingInfo", qtm_getHeadtrackingInfo }, | ||
{"checkHeadFullyDetected", qtm_checkHeadFullyDetected}, | ||
{"convertCoordToScreen", qtm_convertCoordToScreen }, | ||
{NULL, NULL} | ||
}; | ||
|
||
int luaopen_qtm_lib(lua_State *L) { | ||
luaL_newlib(L, qtm_functions); | ||
return 1; | ||
} | ||
|
||
void load_qtm_lib(lua_State *L) { | ||
luaL_requiref(L, "ctr.qtm", luaopen_qtm_lib, false); | ||
} |