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
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
)
So, still no GU or pspiofilemgr, but I promise, I'll add them as soon as I can.
Here's the functions list:
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
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!
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
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
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)
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
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!