Code Monkey home page Code Monkey logo

lpp-3ds's Introduction

Description

Lua Player Plus 3DS is the first lua interpreter made for Nintendo 3DS.

The interpreter currently runs under Lua 5.3.1. It has also a debug FTP server to correct your errors in runtime.

Official documentation: http://rinnegatamante.it/lpp-3ds_doc.html
Official support board: http://rinnegatamante.it/board/forumdisplay.php?fid=12

Features

Graphics
  • Advanced 2D Graphics Rendering (CPU and GPU)
  • Basic 3D Rendering
  • Native support to TTF fonts
  • Native support to BMP/PNG/JPG images
  • Native support to JPGV video files
  • Native support to stereoscopic 3D effect
Sounds
  • Sound system with support for WAV/AIFF/OGG audio files
  • Support to different interpolation modes (None, Linear, Polyphase)
  • Complete access to Microphone for sound registration
Controls
  • Controls system with full console support
  • Built-in Keyboard system
Network
  • Easy to use networking basic features
  • Built-in Mail Sender system
  • Complete sockets system support
  • Built-in debug FTP server
  • SSL connections support
System
  • Access to a lot of Nintendo syscalls
  • Native support to CIA files managing
  • Native support to 3DSX and SMDH files
  • Native support to ZIP archives
  • I/O access for SD card and Extdata archives
  • Native support to console Camera to take photos
  • Native support to ARM9 payloads loading
Utilities
  • Timer system
  • Advanced arithmetical functions support (math library)

Nightly Builds

We offer an automated builder service for our nightly builds. Nightly builds are automatically updated every 4 hours by a server we own. To take advantage of this service, you should visit this page.

Showcase

Here are some 3DS homebrews made using Lua Player Plus 3DS:

Games
Utilities
Engines & Interpreters
Updaters

Compiling the source

The repository will provide you a full set of all of the needed libraries. Take in mind that a lot of them are modified versions of the original ones so if you want to update them, take a look at this repository where you can find sourcecodes of every pre-builded library used in this repository. Also take in mind that libkhax includes also libSu sourcecode. Last but not least, please note that libjpeg.a file is a standard compilation of libjpeg-turbo.

Lua Player Plus 3DS supports different flags to enables some features:
-DUSE_MEMCHUNKHAX2 enables memchunkhax2 usage through svchax at startup for firmwares between 9.3 and 10.7.
-DCITRA3DS_COMPATIBLE removes romFs support causing Citra3DS emulator crash.
-DSKIP_ERROR_HANDLING disables error handling for faster code execution (this is used for Unsafe version).
-DFORCE_SD forces interpreter to load main script from SD instead of romFs filesystem.
-DFORCE_DSP forces interpreter to use dsp::DSP audio service even if csnd:SND is available.

Credits

  • Everyone involved in ctrulib creation
  • Smealum for ftpony source used for debug ftp server
  • Myria for libkhax
  • xerpi for sf2dlib
  • fincs for citro3dlib
  • Sean Barrett for stb_truetype
  • Everyone involved in lodepng, zlib, mpg123, libogg, vorbisfile libraries
  • Everyone involved in Brahma developing
  • aliaspider for svchax
  • Misledz for the Lua Player Plus 3DS logo
  • EasyRPG Team for the AudioDecoder used for MP3 support
  • ksanislo for the network module improvements
  • Special thanks to Aurelio and ihaveamac for testing interpreter features

lpp-3ds's People

Contributors

christofsteel avatar elementw avatar gnmmarechal avatar ihaveamac avatar keanutah avatar ksanislo avatar odyzzey avatar rinnegatamante avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lpp-3ds's Issues

Network functions broken on .3dsx builds

Attempting to use Network functions with the .3dsx build fails. It works on .cia and .3ds builds though.
A simple test I put together:

local WHITE = Color.new(255,255,255)
local pad = Controls.read()
local oldpad = pad
Screen.refresh()
Screen.clear(TOP_SCREEN)
Screen.clear(BOTTOM_SCREEN)
Screen.waitVblankStart()
Screen.flip()
Screen.debugPrint(5, 5, "Network: "..tostring(Network.isWifiEnabled()), WHITE, TOP_SCREEN)
while true do
    pad = Controls.read()
    if Controls.check(pad, KEY_A) and not Controls.check(oldpad, KEY_A) then
        System.exit()
    end
    oldpad = pad
end

This code is run in both .cia and .3dsx builds. The following results are achieved

Build Wifi ON Wifi OFF
.cia/.3ds Network: true Network: false
.3dsx Network: true Network: true

Network.downloadFile and Network.requestString seem to be having similar problems.
Furthermore, I observed that Homebrew Launcher or Gridlauncher both show the Network as disabled after exiting the application.

I am using the lpp-3ds build 26b96a2

String.find doesn't work on strings downloaded via Network.requestString

It will return nil no matter what. Either that or I'm just stupid. Here's an example:

    st1start, st1end = string.find(st,startst,stoffset)
    st2start, st2end = string.find(st,endst,stoffset)
    stringstloc = st1end + 1
    stringendloc = st2start - 1
    retstring = string.sub(st,stringstloc,stringendloc)
    return retstring
end

while true do
    Screen.waitVblankStart()
    Screen.refresh()
    pad = Controls.read()
    if (Controls.check(pad, KEY_Y) and pad ~= oldpad) then
        st = Network.requestString("http://galladeguy.x10host.com/3DS/test.txt")
        Screen.debugPrint(0,0,insidestring("[MY_NAME]","[/MY_NAME]",st,1),white,tscreen)
    end
    Screen.flip()
    oldpad = pad
end`

It should print GalladeGuy because that's what's in between [MY_NAME] and [/MY_NAME], but it returns nil instead and doesn't print anything. Is there something wrong with my code? Or is String.find just not working properly?

Build error.

Trying to build lastest commit throws this error: c:/lpp-3ds-master/source/include/lua/lstate.h:144:21: error: 'STRCACHE_SIZE' undeclared here (not in a function)
TString strcache[STRCACHE_SIZE][1]; / cache for strings in API */

3D Rendering Sample does not work.

In Citra, giving the cube.lua script a texture and trying to run it results in a White Screen. On the 3DS, LPP has issues figuring out where the texture is supposed to come from, and multiple different solutions like using System.currentDirectory().."/cube.png" did not work.

Even if Line 2's Variable is a correct path, LPP has trouble with the variable on line 83, saying that it doesnt exist.
If any of you here are still at all active and can figure out how to get this sample working on either 3DS or Citra or both, please let me know, because I have tried everything and it just does not budge.

Network.downloadFile freezes program

When downloading a file via HTTP it freezes the program, and doesent download the file.

Code im using:

if (Controls.check(pad,KEY_A) ) then Network.downloadFile("http://example.com/example.zip","Example.zip"

Is there any way to download a file without it freezing the entire program?

Launch installed cia/title?

Hey,

I'm trying to use your lua stuff to build a simple tool that installs a cia from network and launches it (a bit like the netloader thing i build for 3ds_hb_menu, but just over http because i don't want to touch sockets again...)

So far i got it to download the cia, install it, and exit back to homescreen where I can then launch my app, but I wonder if you could implement something to launch a specified title directly (it seems to be possible, at least DevMenu can do it)

Wav player not working properly.

Using wav player as cia build corrupts the sound system, also after lpp is closed. (Using rxtools).
This happens on most recent commit, but not the previous.

System.launch3DSX causes error

Whenever i try to load a 3dsx with .cia version of lpp-3ds it will exit to the homemenu and display the error;-"An error has occured,forcing the software to close.The system will now restart."
I am on 10.7 reinand.Please help

Also the 3dsx does not have an xml file

System.listCIA() causes a crash

System.listCIA() causes a crash, the app exits and the 3DS restarts.

function checkntr()
local cias = System.listCIA()
local v
local installed = false
local updated = true
local count = 0
if (System.doesFileExist(System.currentDirectory().."ntr/ntr.cia")) then
updated = false
end
for _ in pairs(cias) do count = count + 1 end
for v = 1, count, 1 do
if (cias[v].unique_id == 0x00b00000) then
installed = true
break
else
installed = false
end
end
return installed, updated
end

This script was working correctly before, not on lastest release.

Error while linking

linking lpp-3ds.elf
luaGraphics.o: In function `OpenJPG(char const*)':
/home/atlantic/Pulpit/lpp-3ds/source/luaGraphics.cpp:986: undefined reference to `jpeg_std_error'
/home/atlantic/Pulpit/lpp-3ds/source/luaGraphics.cpp:988: undefined reference to `jpeg_CreateDecompress'
/home/atlantic/Pulpit/lpp-3ds/source/luaGraphics.cpp:1002: undefined reference to `jpeg_mem_src'
/home/atlantic/Pulpit/lpp-3ds/source/luaGraphics.cpp:1003: undefined reference to `jpeg_read_header'
/home/atlantic/Pulpit/lpp-3ds/source/luaGraphics.cpp:1004: undefined reference to `jpeg_start_decompress'
/home/atlantic/Pulpit/lpp-3ds/source/luaGraphics.cpp:1012: undefined reference to `jpeg_read_scanlines'
/home/atlantic/Pulpit/lpp-3ds/source/luaGraphics.cpp:1014: undefined reference to `jpeg_finish_decompress'
/home/atlantic/Pulpit/lpp-3ds/source/luaGraphics.cpp:1015: undefined reference to `jpeg_destroy_decompress'
luaGraphics.o: In function `decodeJpg(unsigned char*, unsigned long long)':
/home/atlantic/Pulpit/lpp-3ds/source/luaGraphics.cpp:1033: undefined reference to `jpeg_std_error'
/home/atlantic/Pulpit/lpp-3ds/source/luaGraphics.cpp:1035: undefined reference to `jpeg_CreateDecompress'
/home/atlantic/Pulpit/lpp-3ds/source/luaGraphics.cpp:1036: undefined reference to `jpeg_mem_src'
/home/atlantic/Pulpit/lpp-3ds/source/luaGraphics.cpp:1037: undefined reference to `jpeg_read_header'
/home/atlantic/Pulpit/lpp-3ds/source/luaGraphics.cpp:1038: undefined reference to `jpeg_start_decompress'
/home/atlantic/Pulpit/lpp-3ds/source/luaGraphics.cpp:1046: undefined reference to `jpeg_read_scanlines'
/home/atlantic/Pulpit/lpp-3ds/source/luaGraphics.cpp:1048: undefined reference to `jpeg_finish_decompress'
/home/atlantic/Pulpit/lpp-3ds/source/luaGraphics.cpp:1049: undefined reference to `jpeg_destroy_decompress'
collect2: error: ld returned 1 exit status
make[1]: *** [/home/atlantic/Pulpit/lpp-3ds/lpp-3ds.elf] Error 1
make: *** [build] Error 2

Depreciated pixel format used

Hello I have a problem which is probably something that is so easy to fix that it will make me look like a idiot ^^

Basically what happens is when I try to put the frame size and I set the resolution to 400x240, which is the resolution for the 3ds/2ds screen. Though when I put it the file it and do the rest of the things it want's me to do it says.

"Depreciated pixel format used, make sure you did set the right one" or something to that nature.

Pretty sure I'm just being stupid, but any help is appreciated.

Fasthax Support

Add support for Fasthax to achieve kernel11 access on firmwares > 10.7 and get access to more syscalls

SSL problem

Trying to connect to a SSL server randomly causes "Failed creating SSL context". This error persists until you reboot your console. (Tried both with der certificate and without, same result).
Code: http://pastebin.com/jCuH4vzb

EDIT: This was caused by not calling Socket.Term() in some code paths, causing too many soc sessions to get initialized.

3rdparty may too old.

3DS applications now need to be built with -mfloat-abi=hard in devkitARM,but all the lib is built with softfp(i guess).

ZIP Extraction Bug

When I extract a .zip file to a certain directory, it gives no errors. However, the contents of the zip are not in that directory.

Sample cia_installer issue.

Core.execCall("AM_FinishCiaInstall", 0x01, cia_handle) returns Error: [string "?"]: unknown syscall

(Using lastest build)

Problems With System.launch3DSX function.

Whenever i try to load a .3DSX through lpp-3ds it comes out with two black screens.
I was just trying something out this morning and ran into this issue.
Help would greatly be appreciated!

System.exit() causes loop instead of returning to homebrew menu

System details:

  • EU N3DS
  • 11.2
  • Soundhax entrypoint
  • Latest version of lpp-3ds

Problem

Calling System.exit() causes the bottom screen to alternate between red and black, constantly happens until I force close it using L+R+Down+B (doing this sometimes causes a complete crash, meaning I have to reboot the whole system)

Copying to Clipboard?

Is there any way to set a line of text to copy to the 3DS clipboard?
I'd love to do this but im not sure how..

[O3DS] Strange error with romfs on r5

When I run the attached CIA, loadfile fails with the error Function not implemented when called with a romfs:/ name.

Am I doing something wrong?

  • An example of the failing call is loadfile('romfs:/p3600/init.lua')(). (The target file does exist.)
  • System.doesFileExist returns false as well. (Once again, the file is there...)

case.zip (contains CIA and the contents of the romfs)

Error when compiling..

Whenever i try to compile it, it gives me a error saying cannot find 3dsx_crt0.o.Please help.

I'm not a native english user so my grammer maybe wrong.

Running lpp-3ds causes audio jack volume to low.

This only seem to affect audio jack, not built-in speakers. Running lpp-3ds and then exiting, causes the audio output volume to low. (Tested on O3DS nonXL Luma a9lh) I can tell it's not because the script, because even showing "index.lua file not found" causes the bug.

[Crash] Windows 8.1 Pro

Hi,

Tried running "vid2bmov" but I get the following error message: "The application was unable to start coorectly (0xc000007b). Click OK to close the application."

I'm using a 64BIT system too.

As for BMPV Creator (the GUI version), that sort of works. When I try and convert the file though, I get the following error: "Unhandled exception has occurred in your aplication... Could not find file '.\temp\audio.wav'.

Here are the details:

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IO.FileNotFoundException: Could not find file '.\temp\audio.wav'.
File name: '.\temp\audio.wav'
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileInfo.get_Length()
at BMPV_Creator.Form1.Button2_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.8009 (FX35W81RTMGDR.050727-8000)

CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll

BMPV Creator
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0

CodeBase: file:///C:/Users/Lavanoid/Documents/3DS/BMPV_Creator_BETA_RELEASE_2/BMPV%20Creator.exe

Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.8007 (FX35W81RTMGDR.050727-8000)

CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll

System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.8009 (FX35W81RTMGDR.050727-8000)

CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll

System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.8008 (FX35W81RTMGDR.050727-8000)

CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.8007 (FX35W81RTMGDR.050727-8000)

CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

System.Runtime.Remoting
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.8012 (FX35W81RTMGDR.050727-8000)

CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

[vid2jpgv] Cygwin Missing & No error handling

  1. Convert a mp4 h264 30fps video to jpgv via vid2jpgv
  2. After temp extraction, jpgv compains that cygwin.exe is missing.
  3. Get Video converted successfully message.
  4. There is no output file.

Is cygwin needed for this?

The Script vid2jpgv.bat should be reworked, it contains no check about if the convert was successful for real or not. It just uses a predefined text string.

Dofile from/Access to RomFS

Sorry if this is a stupid question, but is it possible to access resources from the RomFS from a lpp3ds script?

Trying to create CIA

When trying to use the "makerom" tool, the "rsf" file shows that there is an unrecoginized key.

C:\Users\Alex\Git-Stuff\Project_CTR\makerom>makerom -f cia -rsf C:\Users\Alex\Downloads\lpp-3ds_r4\Workarounds\cia_workaround.rsf -target t
[RSF ERROR] Unrecognised Key: 'ExeFs'
[RSF ERROR] Error Proccessing RSF file

Thanks for any help. Have a good one.

Non blocking (or periodic callback calling) Network functions

Right now, all Network functions are blocking. Calling downloadFile makes the application looks like it stopped responding and there is no way to indicate that the System is still doing something to the user.
I suggest adding a callback function to Network.downloadFile and maybe Network.requestString too (although requestString usually doesn't block as long as big file downloads) that gets called so developers can use that to show a progress bar for example, or simply allow for some kind of animated indicator that the download is still going.

If possible, adding the currently downloaded size and the full size of the file in question as arguments of the callback.
Example:

Network.downloadFile("http://www.example.com/example.file", "/example.file",...., function(currentBytes, maxBytes)
   Screen.clearScreen(TOP_SCREEN)
   Screen.debugPrint(5,5,"Currently downloaded "..currentByte.."/"..maxBytes.." Bytes", Color.new(255,255,255), TOP_SCREEN)
end)

Sockets not working.

Tried to request a http file with sockets.
function testsocket()
Socket.init()
checksckt = Socket.connect("ctgp.dshack.org", 80, false) -- (Also tried with the ip 133.130.123.204, still doesn't work)
Socket.send(checksckt, "GET /check.txt HTTP/1.0\r\n\r\n")
checkscktdata = Socket.receive(checksckt, 1024)
Socket.term()
end
Printing checkscktdata returns: " " (nothing)

Error while try to compile newest commit

c:/Users/Dell/Desktop/lpp-3ds-master/source/luaSound.cpp: In function 'void stre
amDEC_CSND(void_)':
c:/Users/Dell/Desktop/lpp-3ds-master/source/luaSound.cpp:424:54: error: 'struct
wav' has no member named 'misc'
AudioDecoder_ audio_decoder = (AudioDecoder_)src->misc;
^
c:/Users/Dell/Desktop/lpp-3ds-master/source/luaSound.cpp: In function 'int lua_o
penmp3_old(lua_State_)':
c:/Users/Dell/Desktop/lpp-3ds-master/source/luaSound.cpp:677:23: error: 'CSND_EN
CODING_MPEG' was not declared in this scope
wav_file->encoding = CSND_ENCODING_MPEG;
^
c:/Users/Dell/Desktop/lpp-3ds-master/source/luaSound.cpp:682:12: error: 'struct
wav' has no member named 'misc'
wav_file->misc = (u32_)audio_decoder;
^
c:/Users/Dell/Desktop/lpp-3ds-master/source/luaSound.cpp:703:61: error: expected
')' at end of input
audio_decoder->DecodeAsMono(wav_file->audiobuf, wav_file->audiobuf2
^
c:/Users/Dell/Desktop/lpp-3ds-master/source/luaSound.cpp:703:61: error: expected
'}' at end of input
c:/Users/Dell/Desktop/lpp-3ds-master/source/luaSound.cpp:703:61: error: expected
'}' at end of input
make[1]: *_* [luaSound.o] Error 1
make: *** [build] Error 2

The Font.print doesn't work about the ttf font

while true do
-- Draw something on screen
Screen.refresh()
Screen.waitVblankStart()
Screen.flip()
my_font = Font.load("/font.tff");
Font.setPixelSizes(my_font,18);
-- Writing something on screen
Font.print(my_font, 5, 5, "hello world", Color.new(255,255,255), TOP_SCREEN)
-- Sets up HomeMenu syscall
if Controls.check(Controls.read(),KEY_HOME) or Controls.check(Controls.read(),KEY_POWER) then
System.showHomeMenu()
end
-- Exit if HomeMenu calls APP_EXITING
if System.checkStatus() == APP_EXITING then
System.exit()
end
end

This is about ttf script ,and my 3ds forced exit,just like the Font.print doesn't work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.