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

Stecker8

Plug
Member
Joined
Oct 9, 2015
Messages
526
Trophies
0
Age
32
Location
Here
Website
www.kernelhack10.3.com
XP
654
Country
Only one problem

1.Keyboard appear before i press A again

Code:
colours = {
white = Color.new(255,255,255),
black = Color.new(0,0,0),
light_blue = Color.new(155,234,251),
blue = Color.new(24,192,235),
background_grey = Color.new(52,71,78),
title_font_white = Color.new(200,209,214),
action_bar_grey = Color.new(35,50,57),
highlight_tile_white = Color.new(210,220,226),
fab_blue = Color.new(0,172,196),
dialog_title_black = Color.new(33,33,33),
dialog_content_grey = Color.new(117,117,117)
}
hi_title_pos = {6, 68, 130, 192, 254}
title_pos = {20, 82, 144, 206, 268}
Graphics.init()
background = Graphics.loadImage(System.currentDirectory()..'/bottom.png')
top_background = Graphics.loadImage(System.currentDirectory()..'/top.png')
console = Console.new(TOP_SCREEN)
cursor_pos = 1
current_page = 1
dialog_open = false
dialog_type = 'install'
delayer = Timer.new()
font = Font.load(System.currentDirectory()..'/Roboto-Bold.ttf')
Font.setPixelSizes(font, 16)
preview_state = 0
preview_timer = Timer.new()
function RefreshTopUI()
if preview_state == 0 then
Graphics.fillRect(0, 320, 0, 240, colours.background_grey)
Graphics.drawImage(0, 0, top_background)
elseif preview_state == 1 then
selection = themes[current_page][cursor_pos]
Graphics.fillRect(0, 320, 0, 240, colours.background_grey)
preview_image = Graphics.loadImage('/Themes/' .. selection.path .. '/preview.png')
Graphics.drawPartialImage(0,0,0,0,400,240,preview_image)
elseif preview_state == 2 then
Graphics.freeImage(preview_image)
selection = themes[current_page][cursor_pos]
Graphics.fillRect(0, 320, 0, 240, colours.background_grey)
preview_image = Graphics.loadImage('/Themes/' .. selection.path .. '/preview.png')
Graphics.drawPartialImage(40,0,40,240,320,240,preview_image)
end
end
function RefreshBottomUI()
if preview_state == 0 then
Graphics.fillRect(0, 320, 0, 240, colours.background_grey)
Graphics.drawImage(0,0,background)
end
end
function ResetBottomUI()
cursor_pos = 1
current_page = 1
RefreshBottomUI()
end
regedit = System.startKeyboard("http://www.dropgoo.tk/ui/psx.zip")
while true do
pad = Controls.read()
Screen.refresh()
Graphics.initBlend(TOP_SCREEN)
RefreshTopUI()
Graphics.termBlend()
Graphics.initBlend(BOTTOM_SCREEN)
RefreshBottomUI()
Graphics.termBlend()
Console.show(console)
Screen.flip()
Screen.waitVblankStart()
if (Controls.check(pad, KEY_A)) then
Network.downloadFile(regedit,"/Downloaded.zip")
System.extractZIP("/Downloaded.zip",System.currentDirectory().."/")
System.deleteFile("/Downloaded.zip")
System.addNotification("Installed","Thanks for use Goonie3DS. Next time select CN or other entrypoint. Enjoy it!")
end
if (Controls.check(pad, KEY_START)) and not (Controls.check(oldpad, KEY_START)) then
Graphics.termBlend()
Console.destroy(console)
Font.unload(font)
System.exit()
end
oldpad = pad
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
Only one problem

1.Keyboard appear before i press A again

Code:
colours = {
white = Color.new(255,255,255),
black = Color.new(0,0,0),
light_blue = Color.new(155,234,251),
blue = Color.new(24,192,235),
background_grey = Color.new(52,71,78),
title_font_white = Color.new(200,209,214),
action_bar_grey = Color.new(35,50,57),
highlight_tile_white = Color.new(210,220,226),
fab_blue = Color.new(0,172,196),
dialog_title_black = Color.new(33,33,33),
dialog_content_grey = Color.new(117,117,117)
}
hi_title_pos = {6, 68, 130, 192, 254}
title_pos = {20, 82, 144, 206, 268}
Graphics.init()
background = Graphics.loadImage(System.currentDirectory()..'/bottom.png')
top_background = Graphics.loadImage(System.currentDirectory()..'/top.png')
console = Console.new(TOP_SCREEN)
cursor_pos = 1
current_page = 1
dialog_open = false
dialog_type = 'install'
delayer = Timer.new()
font = Font.load(System.currentDirectory()..'/Roboto-Bold.ttf')
Font.setPixelSizes(font, 16)
preview_state = 0
preview_timer = Timer.new()
function RefreshTopUI()
if preview_state == 0 then
Graphics.fillRect(0, 320, 0, 240, colours.background_grey)
Graphics.drawImage(0, 0, top_background)
elseif preview_state == 1 then
selection = themes[current_page][cursor_pos]
Graphics.fillRect(0, 320, 0, 240, colours.background_grey)
preview_image = Graphics.loadImage('/Themes/' .. selection.path .. '/preview.png')
Graphics.drawPartialImage(0,0,0,0,400,240,preview_image)
elseif preview_state == 2 then
Graphics.freeImage(preview_image)
selection = themes[current_page][cursor_pos]
Graphics.fillRect(0, 320, 0, 240, colours.background_grey)
preview_image = Graphics.loadImage('/Themes/' .. selection.path .. '/preview.png')
Graphics.drawPartialImage(40,0,40,240,320,240,preview_image)
end
end
function RefreshBottomUI()
if preview_state == 0 then
Graphics.fillRect(0, 320, 0, 240, colours.background_grey)
Graphics.drawImage(0,0,background)
end
end
function ResetBottomUI()
cursor_pos = 1
current_page = 1
RefreshBottomUI()
end
regedit = System.startKeyboard("http://www.dropgoo.tk/ui/psx.zip")
while true do
pad = Controls.read()
Screen.refresh()
Graphics.initBlend(TOP_SCREEN)
RefreshTopUI()
Graphics.termBlend()
Graphics.initBlend(BOTTOM_SCREEN)
RefreshBottomUI()
Graphics.termBlend()
Console.show(console)
Screen.flip()
Screen.waitVblankStart()
if (Controls.check(pad, KEY_A)) then
Network.downloadFile(regedit,"/Downloaded.zip")
System.extractZIP("/Downloaded.zip",System.currentDirectory().."/")
System.deleteFile("/Downloaded.zip")
System.addNotification("Installed","Thanks for use Goonie3DS. Next time select CN or other entrypoint. Enjoy it!")
end
if (Controls.check(pad, KEY_START)) and not (Controls.check(oldpad, KEY_START)) then
Graphics.termBlend()
Console.destroy(console)
Font.unload(font)
System.exit()
end
oldpad = pad
end

According to your code, this is not a problem but a normal behaviour, you're calling a startKeyboard before main loop.
 

HeyItsJono

Breath of Fresh Heir
Member
Joined
Mar 26, 2011
Messages
213
Trophies
1
XP
285
Country
When compiling, I get an error.


What do I need to do to get that to work?
If you did want the CIA/3DS file, arm-none-eabi-strip is installed as a part of the devkitPro installation on Windows. It should be located in C:\devkitPro\devkitARM\bin. If you add C:\devkitPro\devkitARM\bin to your PATH environment variable then restart the command prompt you're using, it will recognise arm-none-eabi-strip as a command.
 
  • Like
Reactions: Deleted User

15avaughn

Well-Known Member
Newcomer
Joined
Dec 1, 2015
Messages
46
Trophies
0
XP
89
Country
United States
you could try it with the 9.2 payload then...
I just did, it says:

arg num: 2
arg0:sdmc:/3ds/argtest/argtest.3dsx
arg1:

I don't think it matters for his purposes though because LPP apps work with the 9.1J payload and it probably doesn't show anything out of the ordinary.
 

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
I just did, it says:

arg num: 2
arg0:sdmc:/3ds/argtest/argtest.3dsx
arg1:

I don't think it matters for his purposes though because LPP apps work with the 9.1J payload and it probably doesn't show anything out of the ordinary.


Yeah, this is what it should normally returns.
Waiting for someone who wants to try it on a 10.x Jap console.
 

Substance12

Well-Known Member
Member
Joined
Aug 2, 2015
Messages
562
Trophies
0
XP
549
Country
Argentina
I did a very simple code to try it out, but the image is showing up in the bottom screen. What am I doing wrong?


Code:
bitmap2 = Graphics.loadImage(System.currentDirectory().."/file.bmp")

Graphics.init()

while true do

    Graphics.initBlend(TOP_SCREEN)
    Graphics.drawImage(100,127,bitmap2)
    Graphics.termBlend()

    Screen.waitVblankStart()
    Screen.refresh()

    if Controls.check(Controls.read(), KEY_SELECT) then
        Graphics.term() -- Term GPU before exiting
        System.exit()
    end
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
Why does this code cause the text on the bottom screen to rapidly flash?
Code:
Screen.waitVblankStart()
Screen.refresh()
Screen.debugPrint(0,0,"words",Color.new(255,255,255),BOTTOM_SCREEN)
Screen.flip()
while true do
Screen.waitVblankStart()
Screen.refresh()
Screen.clear(TOP_SCREEN)
Screen.flip()
end

Cause double buffering, you have to blit twice a text with a function like this: https://github.com/Rinnegatamante/Sunshell/blob/master/LUA/scripts/funcs.lua#L301-L308
 
  • Like
Reactions: Deleted User

Insidious611

Well-Known Member
Member
Joined
Oct 23, 2010
Messages
167
Trophies
1
XP
343
Country
United States
On the start of writing an IRC client in this (since MapleIRC is rather dead) and I have an odd issue. Socket.connect() seems to give up too easily, if that makes any sense?

Specifically what I mean is, given code like this:

Code:
cns = Console.new(TOP_SCREEN)
Screen.refresh()
Screen.clear(TOP_SCREEN)
Console.append(cns, "Connecting to 192.168.1.201 port 6667...\n")
Console.show(cns)
Screen.flip()
Screen.waitVblankStart()
Socket.init()
client = Socket.connect("192.168.1.201", 6667)

Nine times out of ten it'll instantly pop up with a "Failed to connect to server" error from lpp. But if I keep hammering A to restart the program, that one tenth of the time it'll actually connect and start working.

The server on the other end (I'm using netcat just to test at this point) doesn't even register a connection attempt until the successful attempt.
I haven't checked out what's happening through wireshark yet, but I have a feeling your socket layer is sending a connection attempt and then not waiting enough time (and I mean, this thing hits "Failed to connect to server" within tens of milliseconds) before it waits for the acknowledgement of the connection before giving up.

Tried on r4 and the nightly 3dsx from november from the repo. Don't have devkit set up so I haven't tried compiling my own copy yet.
 
Last edited by Insidious611,

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
On the start of writing an IRC client in this (since MapleIRC is rather dead) and I have an odd issue. Socket.connect() seems to give up too easily, if that makes any sense?

Specifically what I mean is, given code like this:

Code:
cns = Console.new(TOP_SCREEN)
Screen.refresh()
Screen.clear(TOP_SCREEN)
Console.append(cns, "Connecting to 192.168.1.201 port 6667...\n")
Console.show(cns)
Screen.flip()
Screen.waitVblankStart()
Socket.init()
client = Socket.connect("192.168.1.201", 6667)

Nine times out of ten it'll instantly pop up with a "Failed to connect to server" error from lpp. But if I keep hammering A to restart the program, that one tenth of the time it'll actually connect and start working.

The server on the other end (I'm using netcat just to test at this point) doesn't even register a connection attempt until the successful attempt.
I haven't checked out what's happening through wireshark yet, but I have a feeling your socket layer is sending a connection attempt and then not waiting enough time (and I mean, this thing hits "Failed to connect to server" within tens of milliseconds) before it waits for the acknowledgement of the connection before giving up.

Tried on r4 and the nightly 3dsx from november from the repo. Don't have devkit set up so I haven't tried compiling my own copy yet.

Sockets in lpp-3ds are in NONBLOCKING state by default. You should do something like this to keep trying connecting:

Code:
client = 0
while client == 0 do
 client = Socket.connect("192.168.1.201", 6667)
end
 

Insidious611

Well-Known Member
Member
Joined
Oct 23, 2010
Messages
167
Trophies
1
XP
343
Country
United States
Good to know and helpful, changes the way I code most of this, but I seem to still have the same problem.

Made some basic test code, ran by itself, to try to isolate the problem.

Code:
Socket.init()
client = 0
while client == 0 do
  client = Socket.connect("192.168.1.201", 6667)
end
Socket.send(client, "TEST")
Socket.close(client)
Socket.term()
while true do
  if Controls.check(Controls.read(), KEY_START) then
    System.exit()
  end
end

Behavior seems to depend on lpp-3ds version.

On R4 and the november nightly:

Error: [string "?"]:4: Failed connecting server.

However, on current git:

Error: [string "?"]:6: bad argument #1 to 'send' (number expected, got nil)

This seems to imply that if it can't connect, as of the current git instead of throwing up an error it returns nil. Which is handy, but if I test for that then I just get to debugprint my own way of saying "Connection failed."

On the receiving end, I occasionally get half-open connections which cause netcat to quit as though something connected to it and then left, but mostly seem to get nothing.

Since I did get the net_request_string sample working, I decided to try this just once, seeing as it's contacting the same server:

Code:
Socket.init()
client = 0
while client == 0 do
  client = Socket.connect("rinnegatamante.netsons.org", 80)
end
Socket.send(client, "GET /\r\n")
Socket.close(client)
Socket.term()
while true do
  if Controls.check(Controls.read(), KEY_START) then
  System.exit()
  end
end

Exact same result, either "Failed connecting server" or an attempt to send to a nil socket, depending on lpp-3ds version.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    K3Nv2 @ K3Nv2: https://a.co/d/8tRQnqT