lovebrew / lovepotion Goto Github PK
View Code? Open in Web Editor NEWLÖVE for Nintendo Homebrew
Home Page: https://lovebrew.org
License: Other
LÖVE for Nintendo Homebrew
Home Page: https://lovebrew.org
License: Other
Title pretty much explains it all, I have a suspicion that this has yet to be implemented as a solution to distinguish between right and left joycon would need to be made, and adopted as convention.
How to reproduce :
Maybe related to modules ?
I tried to get Mari0 (http://stabyourself.net/mari0) on the Switch. Sadly it uses filesystem.enumerate, which seems to not be implemented
Log:
main.lua:13: attempt to call field 'enumerate' (a nil value)
Traceback
boot:238: in function 'enumerate'
./main.lua:13: in function <./main.lua:10>
[C]: in function 'xpcall'
Love Potion 1.1.0 (API 11.1.0)
Date and Time: Fri Jan 18 19:17:57 2019
A log has been saved to sdmc:/switch/mari0/log.txt
It can not print Korean Letters anything despite I have puted a font supporting Korean Language. As I said before, in Love2D, it was seemed to successful because it can printed Korean Letters. Does not LovePotion support Korean Letters?
Add asset caching (audio, music, images) to improve RAM usage on badly designed games (games that load multiples times the same file).
This could depend on a implementation of (Compressed)ImageData, SoundData.
It's nice to have, but now with romfs
being a thing along with the examples it's pretty useless (unless you use Citra or yuzu/ryujinx).
What this means is the game directory won't supported anymore soon™. Next release will still have it, but after that it will be removed.
I just tested and crashed.
Calling love.graphics.getDimensions() returns an exception
How I called it:
WINDOWWIDTH, WINDOWHEIGHT = love.graphics.getDimensions()
Error:
Error: ./class/Settings.lua:8: attempt to call field 'getDimensions' (a nil value)
This happens with the latest 2.0.0 Pre-release 1
Currently, Löve Potion 3DS will exit without warning if the user's DSP is not dumped to the sdmc://3ds/
directory, booting back to the Homebrew Launcher. Booting the user to the errhand with an appropriate message would be preferable to the current outcome.
Something like deferred initialization of the modules done somewhere like boot.lua would help, so the modules could be called with a pcall
and if theres an error message, everything continues as normal until the error can be processed and written (and flushed) to a file and also shown on screen.
Something I stumbled upon. Basically, any error that happens when loading conf.lua or running love.conf goes unreported while running the boot.lua script, and ends up preventing the application from fully loading.
I haven't tested if it locks the application up entirely, preventing anything continuing to happen (ie another frame to pass in the main loop) or if it just prevents the main love functions from loading and thus softlocks the whole thing. Either way, wrapping the boot script or the love.conf loading and executing in an xpcall and properly reporting the error should fix it.
Add enet as already implemented in LÖVE.
It uses http://leafo.net/lua-enet/ with enet library so probably needs a enet port for devkitpro.
This library is used in some network libraries like https://github.com/josefnpat/LoverNet
LoverNet does use bitser and enet to work and is designed for games.
(however, bitser only work with FFI, "embedded" FFI is sufficient (so bitser should work), so needs LuaJIT)
When changing the origin of a drawable the change is not reflected in the switch build. This can be observed when using love.graphics.draw
and changing the rotation origin, or when using love.graphics.printf
and using "center".
When running locally this change is applied, but after exporting the .nro the origin is reset.
I'm trying to make a really basic game just for testing and I'm getting the following error
(log.txt)
attempt to call a nil value
Traceback
[string "boot"]:248: in function <[string "boot"]:235>
[C]: in function 'xpcall'
Love Potion 1.1.0 (API 11.2.0)
Date and Time: Tue Nov 12 19:24:10 2019
A log has been saved to sdmc:/3ds/LovePotion/log.txt
Here's the code I'm testing with (based off nogame.lua as I couldn't find any other example)
function love.draw()
love.graphics.setFont(love.graphics.newFont("standard"))
love.graphics.setScreen("top")
love.graphics.print("top", 10, 10)
love.graphics.setScreen("bottom")
love.graphics.print("bottom", 30, 10)
end
function love.gamepadpressed(joy, button)
if button == love.gamepad.b or button == "start" then
love.event.quit()
end
end
3ds ver ,Failed to open the PNG file in the directory. use Citra.
only build inside *.3dsx ?
LovePotion uses currently this structure for graphics matrices :
typedef struct
{
double ox;
double oy;
double r;
double sx;
double sy;
double kx;
double ky;
} StackMatrix;
The problem with this is that it can be hard to stack multiples transformations (some code don't seem working (comments)) and it could be inefficient since we will have to do a pretty much computation (multiples sin+cos and some arithmetic) to transform a unique point.
With matrices, transformation have a regular cost regardless on how much do we translate (we will only have to multiply the point with a matrix which is pretty easy and optimises very well (SIMD easily)).
To stack transformations, we have to multiply a matrix with a matrix, just as simple as that.
Some useful wikipedia informations :
https://en.wikipedia.org/wiki/Transformation_matrix#Examples_in_2D_computer_graphics
https://upload.wikimedia.org/wikipedia/commons/2/2c/2D_affine_transformation_matrix.svg
About the official LÖVE way :
They do use matrices, either 3x3 or 4x4 :
Hiya! Just would like to say I really like that you're continuing LovePotion, but I did run into a problem earlier with your recent build.
I ran into a pesky problem earlier where I was trying to load an image "cursor3x3.png" from a folder "Common" as follows.
cursor = love.graphics.newImage('Common/cursor.png') <-- (Yes I misspelled it as 'cursor.png', that was the problem)
Whenever I booted the new pre-release version with this mistake, my system crashed and spat out a luma dump.
However with the old videah build I was properly given the line where the error occurred, and that it had failed to create an image.
Not sure how much this helps at all, but hopefully it can assist with improving the error handler so that the system won't crash.
I believe the old version (Pre-TurtleP fork) of LövePotion did this and it's noticably absent in this version, at least to my knowledge.
When I try to load a *.png image, it throws an error telling me the image doesn't exist. According to the error screen, it appears that it's looking for t3x files and only t3x files. Would it be possible to load image files without converting to t3x first?
Hello. Looks like Lua can't support cyrillic characters from 1040 in unicode. Instead of writting them game can show something like on photo. Any way to fix this? I got too many troubles with this cause can't do translation for one of games on LovePotion without very many workarounds.
P.S. Thanks for your work!
Photo
title. tested for latest (1.0.2-hotfix 1) and previous latest (1.0.2), for switch
The Switch error log is being created as switchlog.txt instead of switch/log.txt
This happens with 1.0.3 and the latest doozer build.
When LP encounters an error, the program doesn't completely stop. This causes other problems too, as trying to access other lua files when an error is initially encountered, it creates more errors with it but doesn't allow access to other files.
Example
[string "boot"]:214: attempt to call global 'printf' (a nil value)
Might want to fix this, it's preventing me from starting my game.
I'm sure both @NotQuiteApex and myself have (briefly) discussed this before:
There should be an attempt to keep the code bases on the same page. I've thought about this for quite some time and I wasn't sure how to go about it, mainly because I have to see what needs changing to make it work on each platform. I definitely want to avoid a bunch of #ifdef
stuff clogging up the code, but it might be necessary for some things.
Using module wrappers. Things like the system
module clearly have differences between Switch and 3DS and there should be something to keep them apart, but still allowing the code to be built for either platform.
We could do a git diff
and apply patches to whichever version (most likely when building 3DS from Switch, as it's more feature-complete), but that might not be a good option. This is because we'd wind up removing most of the Switch functionality that the 3DS diff would remove. like canvases or threads unless we can somehow allow the diff to fill in these missing pieces. This sounds like a pain to do.
Any other ideas are welcome and I'll discuss with others who might be more knowledgeable with regards to this.
tl;dr
citra needed to create sdmc://3ds/dspfirm.cdc to run LovePotion
Shouldn't need to create this file in citra.
I'm not expecting this bug to be fixed. I'm really just logging it here because it took me a long time to figure this out and the issue doc may help others.
Error in the crash.txt will be
Error: Failed to load ndsp. Please make sure your dspfirm.cdc has been dumped properly.
stack traceback:
[string "boot.lua"]:495: in function <[string "boot.lua"]:490>
[C]: ?
[C]: in function 'require'
[string "boot.lua"]:388: in function <[string "boot.lua"]:285>
[C]: in function 'xpcall'
[string "boot.lua"]:506: in function <[string "boot.lua"]:498>
[C]: in function 'xpcall'
I had to create a zero byte sdmc://3ds/dspfirm.cdc
to run the game successfully.
Box2D support may be not that hard to implement (nothing platform-specific) and is a part of love namespace (unlike enet).
Some games uses it and Box2D doesn't have issues regarding 3DS and Switch (Box2D is said supported on NDS so I don't see any issue)
Love2D implementation of love.physics : https://github.com/love2d/love/tree/master/src/modules/physics
The code for Switch multithreading is already in place, and the love.thread module is currently stubbed. Most of the function names are identical across libctru and libnx, any that aren't can be swapped with preprocessor directives.
Threads will be an amazing improvement for 3DS, which completely locks up during the boot sequence. In theory, tests done on either system should indicate that both systems will work fine if the code is identical in function.
In order to improve performance, add FFI support, it is desirable to add LuaJIT support.
(additionally, some LÖVE2D games expect a LuaJIT environment)
LuaJIT for 3DS has been tested in the past with the LuaJIT test on the 3ds-next branch
Since that, LuaJIT for 3DS has been improved (bug fixing, improvements, FFI improved with SLDL (better support for ffi.cdef/ffi.load)
We now have a stable 2.1-2 version that is stable enough to run a shell based on FFI (FFI with some ctrulib routines). lunnyjit shell
For the Switch, things improved a lot as we get able to run the nbody(50000) benchmark on a true Switch (thanks @Dax). There is still stuff to test (e.g FFI), but things are supposed stable enough to run LovePotion.
We can test out the 2.1-test2 version that potentially work.
I followed all the instructions on the wiki.
I ran the environment setup file, and followed all of the instructions, however, trying to run "make" results in the following error:
Makefile:99: warning: overriding target recipe for target '3ds'
Makefile:95: warning: ignoring old recipe for target '3ds'
Building 3dsx...
Usage:
C:\devkitPro\tools\bin 3dsxtool.exe input.elf output.elf [options]
Options:
shows various options
and after that the make fails with an error code of 1.
Running "make -k" will build an SMDH file but not a 3DSX file.
Just to reiterate, everything where it's supposed to be. I have a 3ds.elf placed in my ~/.lovepotion folder and I have ran the environment set up.
I'm using Windows mSys if that could be the issue.
Currently doesn't work. Some things need to be done:
SDL_Joystick
ptrs into Joysticks: pass the SDL_Joystick
ptr to the Gamepad ctorGamepad
object's pair ID's as an std::pair, e.g. CONTROLLER_PLAYER_1::CONTROLLER_PLAYER_2
for Player 1 in Dual
modeGamepad
object's SDL_Joystick
ptr to an std::pair and map first
to the ctor valueGamepad::SetLayout
:
SDL_Joystick
ptrs from the std::pair (or make them both nullptr?)hid
calls to the pair valuesSDL_Joystick
ptrs into the proper std::pairSDL_Joystick
ptr to the proper std::pairThis should work mainly because the SDL_Joystick ptr(s) are only used within the Gamepad
class. Calling SDL_JoystickOpen(int which)
affects the SDL_PollEvent
function so that each Joycon may operate properly.
Replace all current TCP and UDP code to use SDL2_net.
Drawing using love.graphics.circle doesn't use transformations defined by the transformation stack (see love.graphics.push and love.graphics.pop).
Here is an example script which highlights this error.
I tried this, but seems horribly wrong.
require 'socket.http'
function love.load()
data, ok = request("http://www.google.es")
end
I have no idea how Lua works so I tried looking at the source code (and looking at the UDP Wiki example) but since I don't know how to check for errors and immediately crashes...
Some examples don’t work 100% on 3DS.
I’ll add a 3DS folder with proper files to these.
This and readme.md’s explaining the differences, like with audio having to be 44100Hz on 3DS va 48000Hz on Switch.
i need create a savefile for my game, what another call i can use? or i can use some database like sqlite?
thanks.
When attempting to call this function lovepotion returns the following error:
attempt to call field 'setLineWidth' (a nil value)
Would be useful mainly because users wouldn’t have to compile an entire nro every time. File association of a romfs with a *.love extension should work (passed via args).
See this page for details
Better than having the error handler show up. To remedy this, consolidate graphics files to minimize file headers in the program (use quads).
Suggestions to load the graphics while in nogame
are welcome. The main issue is I can use a Boolean flag which is global—bad, but works—or check the string path to something like nogame:
prefixed to the file name.
It would be nice if this was installable with FBI using tinydb, the titleDB clone: https://tinydb.eiphax.tech/
But FBI does not currently support installing 3dsx files in zip files, so this would require CIA builds for the 3ds. Is this possible?
I can't compile LovePotion with the latest libnx build, there are a few functions related to the console information that need more arguments and some incorrect conversions.
Here's the log:
F:/Proyectos/DDLC-Development/lovepotion2020/LovePotion/platform/switch/source/modules/system.cpp: In static member function 'static void System::Initialize()':
F:/Proyectos/DDLC-Development/lovepotion2020/LovePotion/platform/switch/source/modules/system.cpp:13:23: error: too few arguments to function 'Result accountInitialize(AccountServiceType)'
13 | accountInitialize();
| ^
In file included from C:/devkitPro/libnx/include/switch/services/fs.h:13,
from C:/devkitPro/libnx/include/switch.h:49,
from f:\proyectos\ddlc-development\lovepotion2020\lovepotion\include\common\runtime_common.h:40,
from F:/Proyectos/DDLC-Development/lovepotion2020/LovePotion/platform/switch/include/common/runtime.h:3,
from F:/Proyectos/DDLC-Development/lovepotion2020/LovePotion/platform/switch/source/modules/system.cpp:1:
c:\devkitpro\libnx\include\switch\services\acc.h:52:8: note: declared here
52 | Result accountInitialize(AccountServiceType service_type);
| ^~~~~~~~~~~~~~~~~
F:/Proyectos/DDLC-Development/lovepotion2020/LovePotion/platform/switch/source/modules/system.cpp:16:20: error: too few arguments to function 'Result nifmInitialize(NifmServiceType)'
16 | nifmInitialize();
| ^
In file included from C:/devkitPro/libnx/include/switch.h:84,
from f:\proyectos\ddlc-development\lovepotion2020\lovepotion\include\common\runtime_common.h:40,
from F:/Proyectos/DDLC-Development/lovepotion2020/LovePotion/platform/switch/include/common/runtime.h:3,
from F:/Proyectos/DDLC-Development/lovepotion2020/LovePotion/platform/switch/source/modules/system.cpp:1:
C:/devkitPro/libnx/include/switch/services/nifm.h:32:8: note: declared here
32 | Result nifmInitialize(NifmServiceType service_type);
| ^~~~~~~~~~~~~~
F:/Proyectos/DDLC-Development/lovepotion2020/LovePotion/platform/switch/source/modules/system.cpp: In static member function 'static int System::GetLanguage(lua_State*)':
F:/Proyectos/DDLC-Development/lovepotion2020/LovePotion/platform/switch/source/modules/system.cpp:67:37: error: cannot convert 's32*' {aka 'int*'} to 'SetLanguage*'
67 | setMakeLanguage(languageString, &languageID);
| ^~~~~~~~~~~
| |
| s32* {aka int*}
In file included from C:/devkitPro/libnx/include/switch/services/applet.h:17,
from C:/devkitPro/libnx/include/switch.h:54,
from f:\proyectos\ddlc-development\lovepotion2020\lovepotion\include\common\runtime_common.h:40,
from F:/Proyectos/DDLC-Development/lovepotion2020/LovePotion/platform/switch/include/common/runtime.h:3,
from F:/Proyectos/DDLC-Development/lovepotion2020/LovePotion/platform/switch/source/modules/system.cpp:1:
c:\devkitpro\libnx\include\switch\services\set.h:275:55: note: initializing argument 2 of 'Result setMakeLanguage(u64, SetLanguage*)'
275 | Result setMakeLanguage(u64 LanguageCode, SetLanguage *Language);
| ~~~~~~~~~~~~~^~~~~~~~
F:/Proyectos/DDLC-Development/lovepotion2020/LovePotion/platform/switch/source/modules/system.cpp: In static member function 'static int System::GetUsername(lua_State*)':
F:/Proyectos/DDLC-Development/lovepotion2020/LovePotion/platform/switch/source/modules/system.cpp:115:51: error: cannot convert 'u128*' {aka '__int128 unsigned*'} to 'AccountUid*'
115 | Result resultCode = accountGetPreselectedUser(&userID);
| ^~~~~~~
| |
| u128* {aka __int128 unsigned*}
In file included from C:/devkitPro/libnx/include/switch/services/fs.h:13,
from C:/devkitPro/libnx/include/switch.h:49,
from f:\proyectos\ddlc-development\lovepotion2020\lovepotion\include\common\runtime_common.h:40,
from F:/Proyectos/DDLC-Development/lovepotion2020/LovePotion/platform/switch/include/common/runtime.h:3,
from F:/Proyectos/DDLC-Development/lovepotion2020/LovePotion/platform/switch/source/modules/system.cpp:1:
c:\devkitpro\libnx\include\switch\services\acc.h:97:46: note: initializing argument 1 of 'Result accountGetPreselectedUser(AccountUid*)'
97 | Result accountGetPreselectedUser(AccountUid *uid);
| ~~~~~~~~~~~~^~~
F:/Proyectos/DDLC-Development/lovepotion2020/LovePotion/platform/switch/source/modules/system.cpp:119:50: error: could not convert 'userID' from 'u128' {aka '__int128 unsigned'} to 'AccountUid'
119 | resultCode = accountGetProfile(&profile, userID);
| ^~~~~~
| |
| u128 {aka __int128 unsigned}
F:/Proyectos/DDLC-Development/lovepotion2020/LovePotion/platform/switch/source/modules/system.cpp:128:47: error: 'struct AccountProfileBase' has no member named 'username'
128 | strncpy(username, profilebase.username, sizeof(username) - 1);
| ^~~~~~~~
make[2]: *** [/opt/devkitpro/devkitA64/base_rules:14: system.o] Error 1
make[1]: *** [Makefile:172: build] Error 2
make[1]: se sale del directorio '/f/Proyectos/DDLC-Development/lovepotion2020/LovePotion/platform/switch'
make: *** [Makefile:17: switch] Error 2
Calling a line like
width = love.graphics.getFont().getWidth("Some Text")
crashes with the following log:
main.lua:28: bad argument #2 to 'getWidth' (string expected, got no value)
Traceback
boot:238: in function <boot:225>
[C]: ?
[C]: in function 'xpcall'
Love Potion 1.1.0 (API 11.1.0)
getWidth only has one parameter, and passing in a second one anyways crashes the Switch.
Will there still be updates for the 3ds version and maybe support for canvase and multiple screens in the future?
Full log:
modules/sti/init.lua:862: attempt to call method 'setFilter' (a nil value)
Traceback
boot:248: in function 'setFilter'
./modules/sti/init.lua:862: in function 'resize'
./modules/sti/init.lua:79: in function 'init'
./modules/sti/init.lua:47: in function <./modules/sti/init.lua:24>
(tail call): ?
./main.lua:10: in function <./main.lua:8>
[C]: in function 'xpcall'Love Potion 1.0.4 (API 11.2.0)
Date and Time: Fri Jan 4 15:43:46 2019
A log has been saved to sdmc:/switch/log.txt
Trying to use STI (Simple Tiled Implementation) and apparently Canvas:setFilter is nil? Is this unimplemented or an alternative function that will achieve the same or similar results?
In the love documentation for love.graphics.draw, the scale factor for Y 'sy' defaults to the scale factor for x 'sx'.
However, when using love potion 'sy' is does not seem to default to 'sx', rather both parameters have to be specified for a uniform scaling.
The offset should be applied after any scaling operation is done, (I think that's how it works) but instead it functions as if I just added it to the X and Y coordinates.
See below.
Assumptions:
The following code should show an image that is displayed at half its size. It should remain in the exact center of the screen.
love.graphics.draw(
image,
centerX + width / 2, -- compensating for offset
centerY + height / 2,
0,
0.5, 0.5, -- half size
width / 2, height / 2 -- offset
)
The following code should show an image that is displayed at half its size. However, its offset point is not set so it will be slightly off to the bottom right.
love.graphics.draw(
image,
centerX, centerY,
0,
0.5, 0.5 -- half size
-- no offset
)
Currently, Löve Potion treats both these calls as one and the same, but in Löve2D they are very different.
Here is a variant of the first example love.graphics.draw
in Löve2D. Note that its pivot point is in the center:
And here's the same program running on the 2DS. Note that its pivot point is in the top left rather than the middle:
LOVE recommends making use of Source:clone on duplicate audio sources since it significantly saves memory on static sound objects. Having this is a must for multi-shot audio, and implementing it in LovePotion would increase performance relating to multi-shot audio.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.