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

  • Thread starter Thread starter Rinnegatamante
  • Start date Start date
  • Views Views 187,220
  • Replies Replies 1,199
  • Likes Likes 35
I'm getting some crashes on LPP-3DS R5 with this code :

Code:
function setup(pScreen)
    local screen={
        previous_screen = pScreen;
        black = Color.new(0, 0, 0);
        blue = Color.new(90, 90, 255);
        red = Color.new(255, 0, 0);
        draw = function(self)
            Screen.fillRect(0, 400, 0, 240, self.blue, TOP_SCREEN)
            Screen.fillRect(0, 320, 0, 240, self.blue, BOTTOM_SCREEN)
            if not Network.isWifiEnabled() then
                Screen.debugPrint(200-(string.len("Please enable the wifi!")*15)/4, 120, "Please enable the wifi!", self.red, TOP_SCREEN)
            else
                Screen.debugPrint(200-(string.len("FTP Setup Screen")*15)/4, 120, "FTP Setup Screen", self.black, TOP_SCREEN)
            end
        end;
        controls = function(self)
            --if Controls.check(Controls.read(), KEY_START) then
            --    return pScreen
            --end
            return self
        end;
    }
    return screen
end

The crash is not instantly on the screen init but after several seconds it drew the screen.
 
I'm getting some crashes on LPP-3DS R5 with this code :

Code:
function setup(pScreen)
    local screen={
        previous_screen = pScreen;
        black = Color.new(0, 0, 0);
        blue = Color.new(90, 90, 255);
        red = Color.new(255, 0, 0);
        draw = function(self)
            Screen.fillRect(0, 400, 0, 240, self.blue, TOP_SCREEN)
            Screen.fillRect(0, 320, 0, 240, self.blue, BOTTOM_SCREEN)
            if not Network.isWifiEnabled() then
                Screen.debugPrint(200-(string.len("Please enable the wifi!")*15)/4, 120, "Please enable the wifi!", self.red, TOP_SCREEN)
            else
                Screen.debugPrint(200-(string.len("FTP Setup Screen")*15)/4, 120, "FTP Setup Screen", self.black, TOP_SCREEN)
            end
        end;
        controls = function(self)
            --if Controls.check(Controls.read(), KEY_START) then
            --    return pScreen
            --end
            return self
        end;
    }
    return screen
end

The crash is not instantly on the screen init but after several seconds it drew the screen.

Are you using unsafe version of lpp-3ds?
It looks like you're printing out of framebuffers (for example fillRect should be 0,399 / 0 ,239 for example)
 
  • Like
Reactions: UltiNaruto
I'm using normal version. I didn't know about this, thanks.

EDIT: Works perfectly. :)

EDIT 2:
Here's a small example of making OOP project for games or tools for anyone who needs it :

index.lua :
Code:
if System.getModel() == 2 or System.getModel() == 4 then
    System.setCpuSpeed(NEW_3DS_CLOCK)
end
dofile("/YourHomebrew/Includes.lua")
-- Initialize oldpad
oldpad = 0

g_KeyPressTimer = Timer.new()
g_LastKeyPress = Timer.getTime(g_KeyPressTimer)

currentScreen = yourScreen()

Screen.disable3D()

-- Main Loop
while true do
    -- Updating screens
    Screen.waitVblankStart()
    Screen.refresh()
    Screen.clear(TOP_SCREEN)
    Screen.clear(BOTTOM_SCREEN)

    pad = Controls.read()

    currentScreen:draw(currentScreen)

    -- Flipping screen
    Screen.flip()

    if Timer.getTime(g_KeyPressTimer) - g_LastKeyPress > 120 then
        currentScreen, last_key = currentScreen:controls(currentScreen)
        if pad ~= 0 then
            g_LastKeyPress = Timer.getTime(g_KeyPressTimer)
        end
    end

    -- Sets up HomeMenu syscall
    if Controls.check(Controls.read(),KEY_HOME) then
        System.showHomeMenu()
    end

    -- Exit if HomeMenu calls APP_EXITING
    if System.checkStatus() == APP_EXITING then
        System.exit()
    end
    oldpad = pad
end

Includes.lua :
Code:
dofile("/YourHomebrew/scripts/screen/yourScreen.lua")
-- include other files if you make other screens (and sort it in Z-A format and not in A-Z format if you plan to link the screens)

yourScreen.lua :
Code:
function yourScreen(pScreen)
    local screen={
        previous_screen = pScreen; -- store previous screen to make it possible to return to old screen
        getStringLength = function (self, str, fontSize)
            return math.floor(math.abs((string.len(str)*fontSize)/4))
        end;
        draw = function(self)
            -- draw your stuff here
        end;
        controls = function(self)
            if Controls.check(Controls.read(), KEY_B) then
                return pScreen -- return to previous screen because B key was pressed
            end
            return self -- return same screen because no actions were made
        end;
    }
    return screen
end

@Rinnegatamante Could you include this in your future release of LPP-3DS? It may help some people.
 
Last edited by UltiNaruto,
Last edited by PabloMK7,
is there a way to make lpp force itself to use CSND without using the XML file for it? I'm trying to use it as my boot.3dsx file and I don't think the XML can work there.
 
Hey @Rinnegatamante ! I'm trying to make a function to ping a server (before downloading a file from it,because if you do that it hangs forever), using the socket system.
I know what to send for a ping thanks to http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=8&txtCodeId=1786
Here's my code: http://pastebin.com/AGjpiqUr
The output function simply writes to a file, you can ignore it
I tried with multiple websites and always get the same error: "Failed connecting server."
Do you know why it happens and how I can fix it?
 
Hey @Rinnegatamante ! I'm trying to make a function to ping a server (before downloading a file from it,because if you do that it hangs forever), using the socket system.
I know what to send for a ping thanks to http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=8&txtCodeId=1786
Here's my code: http://pastebin.com/AGjpiqUr
The output function simply writes to a file, you can ignore it
I tried with multiple websites and always get the same error: "Failed connecting server."
Do you know why it happens and how I can fix it?

Are you using the network descriptor?
Also Socket needs an IP, not an http URL since there is no url resolver atm.
 
Screenshot function just freezes the application. There's a file, but it's unreadable (50.5KB). Never had an issue with it when I was using release 3.
 
Last edited by HexZyle,
Yes, I'm using an IP, not an url.
What do you call "network descriptor" ?
Things like "Network.isWifiEnabled()" or things like "http://" ?
 
Connect to the IP then send a GET request maybe?
it should return a status like 200 for success.
You can't just ping the address like that.
The main problem is that if the address is a dns then it won't work as @Rinnegatamante told you.

@Rinnegatamante Isn't there a gethostbyname function on 3ds or you didn't think about it?
 
Connect to the IP then send a GET request maybe?
it should return a status like 200 for success.
You can't just ping the address like that.
The main problem is that if the address is a dns then it won't work as @Rinnegatamante told you.

@Rinnegatamante Isn't there a gethostbyname function on 3ds or you didn't think about it?

These are all the available functions from standard C for socketing: https://github.com/smealum/ctrulib/blob/master/libctru/include/sys/socket.h

Screenshot function just freezes the application. There's a file, but it's unreadable (50.5KB). Never had an issue with it when I was using release 3.

Are you using jpg compression?

Yes, I'm using an IP, not an url.
What do you call "network descriptor" ?
Things like "Network.isWifiEnabled()" or things like "http://" ?

The xml descriptors included in r5 pack.
 
@Rinnegatamante welp, copied the "networking_features.xml" to the same directory as my .3dsx and index.lua, changed the address to a normal website instead of google's dns, changed port from 80 to 1 and I still get the error. I don't know what can be wrong now.
EDIT: also, when trying to build lpp-3ds myself, I always get the same error:
Code:
linking lpp-3ds-master.elf
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/5.3.0/../../../../arm-none-eabi/bin/ld.exe: cannot find 3dsx_crt0.o: No such file or directory
collect2.exe: error: ld returned 1 exit status
 
Last edited by LiquidFenrir,

Site & Scene News

Popular threads in this forum