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

Discussion in '3DS - Homebrew Development and Emulators' started by Rinnegatamante, Mar 18, 2015.

  1. MyLegGuy

    MyLegGuy Moron

    Member
    4
    Nov 26, 2014
    United States
    I need a bit of help with stuff that's been frustrating me.

    Take a look at this code:
    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.flip()
    
    Screen.waitVblankStart()
    Screen.refresh()
    Screen.debugPrint(0, 64, tostring(math.random(1,5)), Color.new(255,255,255), TOP_SCREEN)
    Screen.flip()
    end
    
    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?
     
  2. ihaveamac

    ihaveamac GBAtemp Guru

    Member
    14
    Apr 20, 2015
    United States
    Tigard, OR
    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
     
  3. MyLegGuy

    MyLegGuy Moron

    Member
    4
    Nov 26, 2014
    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?
     
  4. ihaveamac

    ihaveamac GBAtemp Guru

    Member
    14
    Apr 20, 2015
    United States
    Tigard, OR
    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
     
  5. Rinnegatamante
    OP

    Rinnegatamante GBAtemp Psycho!

    Member
    13
    Nov 24, 2014
    Italy
    Bologna
    ihaveamac likes this.
  6. MyLegGuy

    MyLegGuy Moron

    Member
    4
    Nov 26, 2014
    United States
    So, that's the only way? Not ideal, but still okay.
    Thanks.
     
  7. Rinnegatamante
    OP

    Rinnegatamante GBAtemp Psycho!

    Member
    13
    Nov 24, 2014
    Italy
    Bologna
    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, Dec 6, 2015
  8. MyLegGuy

    MyLegGuy Moron

    Member
    4
    Nov 26, 2014
    United States
    Code:
    fileStream = (io.open("/Options.cfg",FREAD))
    
    bad argument #2 to 'open' (number expected, got nil)
     
  9. Rinnegatamante
    OP

    Rinnegatamante GBAtemp Psycho!

    Member
    13
    Nov 24, 2014
    Italy
    Bologna
    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, Dec 7, 2015
  10. MyLegGuy

    MyLegGuy Moron

    Member
    4
    Nov 26, 2014
    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? If so, is there a way to check which type of 3ds the user is using?
     
  11. ihaveamac

    ihaveamac GBAtemp Guru

    Member
    14
    Apr 20, 2015
    United States
    Tigard, OR
    does nothing at all. you can use it regardless of system, and it will only do something on New 3DS [XL].
    Code:
    model = System.getModel()
    0 = 3DS
    1 = 3DS XL
    2 = New 3DS
    3 = 2DS
    4 = New 3DS XL
     
    Last edited by ihaveamac, Dec 7, 2015
  12. MyLegGuy

    MyLegGuy Moron

    Member
    4
    Nov 26, 2014
    United States
    Thanks.
    I'll read the documentation more thoroughly next time before posting here.
     
  13. TheCruel

    TheCruel Developer

    Banned
    12
    Dec 6, 2013
    United States
    With your DSP work, have you heard any noticeable difference with different interpolation modes?
     
  14. Rinnegatamante
    OP

    Rinnegatamante GBAtemp Psycho!

    Member
    13
    Nov 24, 2014
    Italy
    Bologna
    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.
     
  15. ElyosOfTheAbyss

    ElyosOfTheAbyss GBAtemp Addict

    Member
    7
    Aug 20, 2015
    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
     
  16. Rinnegatamante
    OP

    Rinnegatamante GBAtemp Psycho!

    Member
    13
    Nov 24, 2014
    Italy
    Bologna
    Typo error, rename the function which uses Music struct type pointers to lua_stoprec_DSP
     
  17. MyLegGuy

    MyLegGuy Moron

    Member
    4
    Nov 26, 2014
    United States
    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.
     
  18. Rinnegatamante
    OP

    Rinnegatamante GBAtemp Psycho!

    Member
    13
    Nov 24, 2014
    Italy
    Bologna
    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)
     
  19. MyLegGuy

    MyLegGuy Moron

    Member
    4
    Nov 26, 2014
    United States
    Using the networking_features.xml gives me the ability to use sound, but not network features. :huh:
    Warning: Spoilers inside!
     
  20. Rinnegatamante
    OP

    Rinnegatamante GBAtemp Psycho!

    Member
    13
    Nov 24, 2014
    Italy
    Bologna
    What do you intend for network features? Try to change soc:U with http:C
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice