Homebrew [Release] Lua Player Plus 3DS (lpp-3ds) - LUA interpreter for 3DS

ihaveahax

Well-Known Member
Member
Joined
Apr 20, 2015
Messages
6,069
Trophies
2
XP
7,805
Country
United States
I need a bit of help with stuff that's been frustrating me.

Take a look at this code:
code

After the for loop is done, the place where the number is displayed looks like a rectangle with two missing pixels because all the numbers are overlapping, and the words "angry" are gone. Why is that?
try drawing both at once instead of putting a "Screen.flip()" between them.
Code:
for i = 0, 10 do
    Screen.waitVblankStart()
    Screen.refresh()
    Screen.clear(TOP_SCREEN)
    Screen.clear(BOTTOM_SCREEN)
    Screen.debugPrint(0, 0, ("angry"), Color.new(255,255,255), TOP_SCREEN)
   
    Screen.debugPrint(0, 64, tostring(math.random(1,5)), Color.new(255,255,255), TOP_SCREEN)
    Screen.flip()
end
 

ihaveahax

Well-Known Member
Member
Joined
Apr 20, 2015
Messages
6,069
Trophies
2
XP
7,805
Country
United States
Okay, that works.
What would I need to do if I wanted to display something, have the user be able to see it, and then display another thing on the screen while still being able to see the first thing?
Code:
show_number = false
-- do something to set this to true
for i = 0, 10 do
    Screen.waitVblankStart()
    Screen.refresh()
    Screen.clear(TOP_SCREEN)
    Screen.clear(BOTTOM_SCREEN)
    Screen.debugPrint(0, 0, ("angry"), Color.new(255,255,255), TOP_SCREEN)
   
    if show_number then
        Screen.debugPrint(0, 64, tostring(math.random(1,5)), Color.new(255,255,255), TOP_SCREEN)
    end
    Screen.flip()
end
 

Rinnegatamante

Well-Known Member
OP
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,857
Country
Italy
Finally lpp-3ds r4 is available for download on http://rinnegatamante.it !
I would say thanks for all his hard work testing stuffs everyday to @ihaveamac .

Now lpp-3ds will be provided in two version as told before:

- Normal: Normal version of lpp-3ds.
- Unsafe: Modified version without error handling but with a better speed.

I suggest to use normal version during developing and then unsafe version for releases.

Complete changelog:

New functions:

Code:
- Controls.enableGyro() - Enables Gyroscope.
- Controls.disableGyro() - Disables Gyroscope.
- Controls.enableAccel() - Enables Accelerometer.
- Controls.disableAccel() - Disables Accelerometer.
- Controls.readGyro() - Reads Gyroscope state.
- Controls.readAccel() - Reads Accelerometer state.
- Controls.enableScreen() - Power on a screen.
- Controls.disableScreen() - Power off a screen.
- Controls.shellStatus() - Gets shell status.
- Graphics.getPixel() - Gets a pixel for a GPU texture.
- System.setCpuSpeed() - Sets CPU frequency.
- System.getCpuSpeed() - Gets CPU frequency.
- Camera.init() - Inits console camera.
- Camera.getOutput() - Blends on screen camera output.
- Camera.takePhoto() - Takes a photo with the camera.
- Camera.takeImage() - Takes an image with the camera.
- Camera.term() - Terminates camera.
- Mic.start() - Starts recording with microphone.
- Mic.isRecording() - Checks if microphone is still recording.
- Mic.stop() - Stops recording and save the result.
- Mic.pause() - Pauses record.
- Mic.resume() - Resumes record.
- JPGV.drawFast() - Draws a JPGV video in fast mode (only fullscreen videos).
- Sound.getService() - Gets used service for audio system.

New features and improvements:

- Now sockets are set in non-blocking mode by default.
- Now Screen functions can be used to edit GPU textures (like before for normal Images).
- Now System.checkBuild() will return different codes for NH1 and NH2.
- Updated Lua build from 5.3.0 to 5.3.1.
- Speedup for I/O functions.
- Now if index.lua file is not found, interpreter will give an error instead of a system crash.
- Introduced Audio-Device system to manage Audio on the system.
- Now if csnd:SND is not available, dsp::DSP will be used for a basic audio support.
- Now a faster version (unsafe) of the interpreter will be provided in official builds without error handler.
- Now third argument for System.takeScreenshot() and Screen.saveImage() is facoltative (Default = false).
- Added possibility to change interpolation mode for sounds (Default = LINEAR_INTERP).

Deprecated functions:

- BMPV module deprecated ( Useless video format ).
- Sound.register() deprecated ( Use Mic module ).

Syntax changes:

- Now System.getKernel() and System.getFirmware() will return MAJOR_VERSION, MINOR_VERSION and REVISION.
- Now Sound.play() will not take channels arguments anymore and will take as third (facoltative) argument an interpolation mode.
- Now JPGV.start() will not take channels arguments anymore.

Bugfixes:

- System.extractZIP() now closes ZIP files correctly, allowing to delete them for example.
- Now an interpreter crash during Sockets usage will not corrupt Networking features.
- Now System.getKernel() and System.getFirmware are not swapped anymore.
- Now Kernel privilege escalation for 4.5-9.2 users is done also on Ninjhax 2.x.
- Now Graphics.fillCircle() accepts correct arguments number.
- Now Screen.drawPartialImage() blends correctly on RIGHT_EYE.
- Now exiting from interpreter will not crash the system anymore on NH2.5.
- Now Sound module functions work correctly on NH2.5.
- Now System.getDate() will not cause freezes if console clock was never set.
- Now System.addNotification() works also on NH2.
- Now enabling 3D with 3D slider off will not cause system crashes anymore.

Samples:

- Replaced BMPV sample with a JPGV sample.
- Added Camera sample for camera usage.
- Updated Mic sample with new Mic module.

Known bugs/strange behaviors:

Code:
- Some modules (Advanced Sound Module, Camera Module, Network Module) are not accessible together on NH2.5. When you write your homebrews take a look to Descriptors folder to use one of these services.
- Mic module could crash on initialization in some circumstances on N3DS.
- Basic Sound Module is unfinished due to lack of a good library for dsp::DSP service support. Advanced Sound Module is highly recommended.
- System.addNotification will require a target title to be used on NH 2.x.
- Polyphase interpolation mode is available ONLY on Basic Sound Module.
 
Last edited by Rinnegatamante,

Rinnegatamante

Well-Known Member
OP
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,857
Country
Italy
Code:
fileStream = (io.open("/Options.cfg",FREAD))
bad argument #2 to 'open' (number expected, got nil)

Use 0 instead of FREAD (i've done a little mistake in current build, i'll fix it and patch the downloadable build as soon as i can)

EDIT: Updated! Re-download r4 to solve.
 
Last edited by Rinnegatamante,

ihaveahax

Well-Known Member
Member
Joined
Apr 20, 2015
Messages
6,069
Trophies
2
XP
7,805
Country
United States
Does setting the CPU to the n3ds speed on an o3ds do anything? If it does do something, does it do anything harmful
does nothing at all. you can use it regardless of system, and it will only do something on New 3DS [XL].
If so, is there a way to check which type of 3ds the user is using?
Code:
model = System.getModel()
0 = 3DS
1 = 3DS XL
2 = New 3DS
3 = 2DS
4 = New 3DS XL
 
Last edited by ihaveahax,

Rinnegatamante

Well-Known Member
OP
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,857
Country
Italy
With your DSP work, have you heard any noticeable difference with different interpolation modes?

Not an appreciable difference (if you're talking about linear and polyphase. Disabling interpolation produce a shitty audio output instead) but it could be caused by samplerates i used.
 

ElyosOfTheAbyss

Well-Known Member
Member
Joined
Aug 20, 2015
Messages
2,225
Trophies
1
XP
1,901
Country
When I try to compile it gives me the following error.
Code:
c:/Users/Chris/Desktop/sadsd/lpp-3ds-master/source/luaMic.cpp:142:12: error: redefinition of 'int lua_stoprec_CSND(lua_State*)'
static int lua_stoprec_CSND(lua_State *L)
            ^
c:/Users/Chris/Desktop/sadsd/lpp-3ds-master/source/luaMic.cpp:105:12: note: 'int lua_stoprec_CSND(lua_State*)' previously defined here
static int lua_stoprec_CSND(lua_State *L)
            ^
c:/Users/Chris/Desktop/sadsd/lpp-3ds-master/source/luaMic.cpp: At global scope:
c:/Users/Chris/Desktop/sadsd/lpp-3ds-master/source/luaMic.cpp:211:15: error: 'lua_stoprec_DSP' was not declared in this scope
  {"stop",     lua_stoprec_DSP},
               ^
make[1]: *** [luaMic.o] Error 1
make: *** [build] Error 2
 

Rinnegatamante

Well-Known Member
OP
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,857
Country
Italy
When I try to compile it gives me the following error.
Code:
c:/Users/Chris/Desktop/sadsd/lpp-3ds-master/source/luaMic.cpp:142:12: error: redefinition of 'int lua_stoprec_CSND(lua_State*)'
static int lua_stoprec_CSND(lua_State *L)
            ^
c:/Users/Chris/Desktop/sadsd/lpp-3ds-master/source/luaMic.cpp:105:12: note: 'int lua_stoprec_CSND(lua_State*)' previously defined here
static int lua_stoprec_CSND(lua_State *L)
            ^
c:/Users/Chris/Desktop/sadsd/lpp-3ds-master/source/luaMic.cpp: At global scope:
c:/Users/Chris/Desktop/sadsd/lpp-3ds-master/source/luaMic.cpp:211:15: error: 'lua_stoprec_DSP' was not declared in this scope
  {"stop",     lua_stoprec_DSP},
               ^
make[1]: *** [luaMic.o] Error 1
make: *** [build] Error 2

Typo error, rename the function which uses Music struct type pointers to lua_stoprec_DSP
 

Rinnegatamante

Well-Known Member
OP
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,857
Country
Italy
How do I make it so I can use network features and sound features? When I put in the sound xml, I can't use network features anymore.

I tried to combine the network and sound xml files to make this:
Code:
<services autodetect="false">
    <request priority="1">csnd:SND</request>
    <request priority="2">soc:U</request>
</services>

But that didn't work.

You simply can't cause NH 2.X has limitations on serviceaccesscontrol.

Usng soc:U you'll be able to use dsp::DSP for audio system (basic functions like open/play/close work fine)
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: Good morning