• Steam recently changed the default privacy settings for all users. This may impact tracking. Ensure your profile has the correct settings by following the guide on our forums.

ASLI Beta-1

mootjeuh

New Member
Hey guys, back with a new homebrew
now, just before you start reading, even though the title says beta, there are absolutely no bugs, so if something goes wrong, its your fault:p
Okay, and now to explain the title, ASLI stands for A Simple Lua (script) Interpreter, this little homebrew is one-of-a-kind, its general purpose, is to give a pspsdk in lua, so no pre-made functions like HM, PGE, and LPE offer.
Its currently not the best interpreter to choose if you want to make a shell with it, i made it so its faster than any other one (yes, even lpe), and uses SDL as rendering engine. (so this is for making games)
Its still far from being complete but i'm releasing this now because I'm going on vacation tomorrow and won't be working on it for weeks, so....
I've ported most of the SDL functions; SDL, SDL_image, SDL_ttf, SDL_mixer, SDL_video (except for YUV rendering), SDL_keyboard, SDL_joystick and SDL_timer. And all of those work perfectly.
I ported the functions memalign and malloc from malloc.h because they're extremely useful, at least for me. And for the pspsdk, I didn't do much, only the necessary for making an awesome game: pspctrl, pspdebug and pspdebugkb.
And I went over to LuaForge and grabbed some implementations of useful libraries: zlib and lua BitOP (for bitwise operations in Lua:D)
So, still no GU or pspiofilemgr, but I promise, I'll add them as soon as I can.
Here's the functions list:
Code:
std.memalign(boundary, size) ;;used to create a display list, GU functions will be added later
std.malloc(size)

bitwise operations from the C implementation of Lua BitOp: [url]http://bitop.luajit.org/[/url]
zlib lua wrapper functions from the C implementation of LuaZlib: [url]http://luaforge.net/projects/luazlib/[/url]

sce.Ctrl.SetSamplingCycle(cycle)
sce.Ctrl.SetSamplingMode(mode)
pad = sce.Ctrl.ReadBufferPositive(number of buffers to read from)
pad = sce.Ctrl.ReadBufferNegative(number of buffers to read from)
pad = sce.Ctrl.PeekBufferPositive(number of buffers to peek from)
pad = sce.Ctrl.PeekBufferNegative(number of buffers to peek from)
pad:TimeStamp()
pad:Buttons()
pad:Lx()
pad:Ly()
pspctrl.band(first value, second value)

psp.DebugScreen.Init()
psp.DebugScreen.SetXY(x, y)
psp.DebugScreen.Printf(...)

psp.DebugKb.DrawKey(row, column , 0 for highlighing)
psp.DebugKb.DrawString(string)
psp.DebugKb.ClearBox()
psp.DebugKb.DrawBox()
return_string = psp.DebugKb.Init(maximum size of string)

SDL.Init(flags)
SDL.InitSubSystem(flags)
SDL.QuitSubSystem()
value = SDL.WasInit(flags)
SDL.Quit()
SDL.Delay(milliseconds)
SDL.ShowCursor(1 or 0)

SDL.SetError("error")
string_value = SDL.GetError()
SDL.ClearError()

value = SDL.NumJoysticks()
name = SDL.JoystickName(device index)
joystick = SDL.JoystickOpen(device index)
value = SDL.JoystickOpened(device index)
value = SDL.JoystickIndex(joystick)
value = SDL.JoystickNumAxes(joystick)
value = SDL.JoystickNumBalls(joystick)
value = SDL.JoystickNumHats(joystick)
value = SDL.JoystickNumButtons(joystick)
SDL.JoystickUpdate()
value = SDL.JoystickEventState(state)
value = SDL.JoystickGetAxis(joystick, axis)
value = SDL.JoystickGetHat(joystick, hat)
SDL.JoystickClose(joystick)

value = SDL.EnableUNICODE(enable)
value = SDL.EnableKeyRepeat(delay, interval)
state = SDL.GetKeyState(nil) \ if state[c0de] then ... end

num_ticks = SDL.GetTicks()
return_value = SDL.SetTimer(time interval, "function callback")

rw_source = SDL.RWFromFile("file", "mode")
rw_source = SDL.AllocRW()
SDL.FreeRW(rw_source)
value = SDL.RWSeek(ctx, offset, whence)

return_value = SDL.VideoInit("driver", flags)
SDL.VideoQuit()
video_surface = SDL.GetVideoSurface()
return_value = SDL.VideoModeOK(width, height, bpp, flags)
video_surface = SDL.SetVideoMode(width, height, bpp, flags)
SDL.UpdateRects(screen surface, number of rects, "rect table")
SDL.UpdateRect(screen surface, x, y, width, height)
return_value = SDL.Flip(screen surface)
bmp_surface = SDL.LoadBMP_RW(RWops source, 1 or 0 to free the source)
return_value = SDL.UpperBlit(source surface, "source rect", destination surface, "destination rect") = SDL.BlitSurface
return_value = SDL.LowerBlit(source surface, "source rect", destination surface, "destination rect")
return_value = SDL.FillRect(surface, "rect table", color)
surface = SDL.DisplayFormat(surface)
surface = SDL.DisplayFormatAlpha(surface)
SDL.FreeSurface(surface)
return_value = SDL.SetGamma(r, g, b)
return_value = SDL.SetColors(surface, "color table", first color, num. of colors)
return_value = SDL.SetPalette(surface, flags, "color table", first color, num. of colors)
surface = SDL.CreateRGBSurface(flags, width, height, depth, r, g, b, a)
return_value = SDL.LockSurface(surface)
return_value = SDL.UnlockSurface(surface)
return_value = SDL.SaveBMP_RW(surface, RWops destination structure, 1 or 0 to free it)
return_value = SDL.SetColorKey(surface, flag, key)
return_value = SDL.SetAlpha(surface, flag, alpha value)
;;when surface is created:
surface:flags()
surface:width()
surface:height()
surface:pitch()
surface:offset()

TTF.BytesSwappedUNICODE(swapped as integer)
return_value = TTF.Init()
font = TTF.OpenFont("font.ttf", point size)
font = TTF.OpenFontIndex("font.ttf", point size, index)
font = TTF.OpenFontRW(RWops source, 1 or 0 to free it, point size)
font = TTF.OpenFontIndexRW(RWops source, 1 or 0 to free it, point size, index)
style = TTF.GetFontStyle(font)
TTF.SetFontStyle(font, style)
height = TTF.FontHeight(font)
return_value = TTF.FontAscent(font)
return_value = TTF.FontDescent(font)
return_value = TTF.FontLineSkip(font)
return_value = TTF.FontFaces(font)
return_value = TTF.FontFaceIsFixedWidth(font)
string_value = TTF.FontFaceFamilyName(font)
string_value = TTF.FontFaceStyleName(font)
return_surface = TTF.RenderTextSolid(font, "text", "color table")
TTF.CloseFont(font)
TTF.Quit()

return_value = Mix.OpenAudio(frequency, format, num. of channels, chunk size)
Mix.CloseAudio()
return_value = Mix.AllocateChannels(num. of channels)
chunk = Mix.LoadWAV_RW(RWops source, 1 or 0 to free it)
music = Mix.LoadMUS("music file")
chunk = Mix.QuickLoad_WAV(memory buffer)
chunk = Mix.QuickLoad_RAW(memory buffer)
return_value = Mix.PlayMusic(music, num. of loops)
;;when chunk is loaded
chunk:allocated()
chunk:abuf()
chunk:alen()
chunk:volume()
;;
Mix.FreeChunk(chunk)
Mix.FreeMusic(music)
Mix.PlayChannelTimed(channel, chunk, num. of loops, num. of ticks) \ Mix.PlayChannelTimed(-1, chunk, 0, -1)
Mix.PlayChannel(channel, chunk, num. of loops)
If you dont understand a specific SDL function, then google it, there's a wonderful online documentation;)
Also, the interpreter parses and runs the main.lua file located at the same directory as the EBOOT.PBP, and this is not based off any other interpreter so don't expect any source code:p
Samples are included for image blitting, wav playing, sprites, button input, font rendering, surface creation.

If you've got suggestions for new functions post here, and I'll see what I can do.
And please, take a look at LuaForge, there are some pretty awesome Lua libraries.

Download.

Awesome examples are included;)
And one last thing, enjoy!
 
Nice release, this looks interesting. I might play around with it just for shits and giggles. Keep up the good work.
 
looks pretty good, well done. Just need screenshots of some LUA programs running :P
 
Thanks, I just finished the second version, making a thread right now, and this time with screenshots *obvious wink*
 
Why the hell would you port malloc and memalign to a managed language? That is extremely counter intuitive. And makes absolutely no sense. Please do give me an example where it would ever make sense to do so. Lua has all the means it needs to gather and use memory, there is not 1 reason you would ever need malloc nor memalign.

I don't want to continue bashing, but SDL is horrible for games. It has slow rendering algorithms, not to mention very few features, then add on top that it is not being interpreted, you mind as well shoot yourself in the foot.

Right now I believe the only properly done lua interpreter for the psp is pge. It also allows plugins in the form of prx's. So if you want new features or something you should just make a plugin for pge, not to mention it already has a boatload of tested proven, battle worthy features, by an excellent coder.
 
Lol, could you be any ruder?
And I was planning on using memalign for creating a display list to be used with the GU, which I haven't implemented yet. So, currently, yes, it is completely useless.
 
I think you misunderstood my entire point. Lua is a managed language, so the stuff you import to it should be managed as well. Also I am not being rude, but I am trying to help you make something that is potentially more usefull.
 
Okay, sorry if I hurt your feelings:P
But how do you want to help me make it better?
From what I understood, I'd better be off developing additional modules to someone else's interpreter. Or throw away an entire API I spent weeks porting.

and with weeks i mean, like 4 full days, but then separated, lol
 
Okay, sorry if I hurt your feelings:P
But how do you want to help me make it better?
From what I understood, I'd better be off developing additional modules to someone else's interpreter. Or throw away an entire API I spent weeks porting.

and with weeks i mean, like 4 full days, but then separated, lol

Not wasted. You learned something along the way I imagine.
 
Well honestly you didn't write and interpreter. The lua interpreter is a lib. And I wouldn't call it porting, because the proper term is binding. As for hurting my feelings, well you have done o such thing. Also 4 days isn't that long at all. I know you are still learning to code, but this is not the best exercise to be doing so. You will end up with something that is hacked together, that is problematic, and more than likely very slow.

If you want some tips/suggestions for better ways to learn different coding technics/methods then do ask. I just feel you are somewhat wasting time on this, as you are not properly adding functionality to lua.
 
a_nub hit all the valid points right on the head, lua does not need any type of memory management functions, lua is designed to assist in creating games, although it's been used for the primary function of creating a game it does not need the entirety of the gu, it does not need the entirety of the pspsdk, it's creating an ungodly bloated interpreter in the process, how many functions are being imported that the average lua dev wouldn't even touch?, pge is perfect for game making, lua hm is a joke imo, the only problem with pge is the dev got addicted to his ps3.
also:
no pre-made functions
what the hell do you think your doing then?, you're exporting pre-made functions for the average c/c++ developer, your not doing anything special but writing a huge list of function exports, nothing special

if people wanted to take advantage of the whole pspsdk, then they'd learn c/c++, however if they wanted to make games in lua, then i doubt this is going to be any better than pge, pge was specifically designed to use lua for writing games, this doesn't sound more than anything of writing a huge list of lua export where you fill in the blank with the appropriate names. i don't mean to sound harsh, but it just sounds too much like your throwing a bunch of things together and expecting it to be fast when you've given no reason why it would run any faster than any of the other options out their.

use your talents for something better
/my 2 cents
 
Back
Top