abi>>forums

abi>>forums (http://www.anythingbutipod.com/forum/index.php)
-   Download Zen X-Fi2 Games & Applications (http://www.anythingbutipod.com/forum/forumdisplay.php?f=223)
-   -   multiplatform compatibility framework update 1.1.1 (http://www.anythingbutipod.com/forum/showthread.php?t=66728)

delirius 11-27-2011 03:45 PM

multiplatform compatibility framework update 1.1.1
 
3 Attachment(s)
Love compatibility framework for zen x-fi2 lua
by Delirius
current version 1.1.1
How to use:

1)
copy dir "loveCompatibility" and file "conf.lua" to your app dir.

2)
To include and initialize love compatibility,
at the beginning of main.lua add:
require "loveCompatibility.load";
main = function()

And at the end of main.lua add:
end;
if(love) then
love.run = main;
else
main();
end;

As seen in example main bundled with this release.

3)
change settings in "conf.lua"
what you should change:
- t.console
- t.title
- t.author
- t.screen.width
- t.screen.height
(fullscreen doesn't work)

Buttons:
home button is mapped to escape.
power button is mapped to f1.

File operations:

In love framework you can't write to application source folder.
Every write operation is done into application data folder
(on winsows7 it is "C:\Users\User\AppData\Roaming"). More information
can be found in "http://love2d.org/wiki/love.filesystem".
loveCompatibility copies all read and written files
from source folder and all new files to data folder.
Files can be deleted only in data folder, so if you have
copy of file in your source folder, you can never get rid of it.

Image resources bins:
As with zen you can use images packed into resource bins. For packing and unpacking use ThievingSix's X-Fi2 Resource Compiler/Decompiler. When resource bin is used to load image, its contents are unpacked to data directory into _ResBin_ directory. Btw. Zen resource bins aren't compressed.

Implementation:
working functions "http://en.wikipedia.org/wiki/User:Thieving6/X-FI_2_Lua"

Usable tables:
- string
- package
- image
- os
- button
- touch
- control
- screen
- color
- text (need original font)
- io
- coroutine (maybe)
- math
- table
- coroutine
- debug
- audio
- wav
+ most misc functions

Missing tables:
- accelerometer (i have no idea, how to implement it)

Functions which doesn't work properly:
- screen.backlight (obviously)
- screen.orientation (to be done)
- image.setbg (who knows what it does anyway?)
- image.fill (never used it anyway)
- os.rename (does someone use it anyway?)
- io.popen (zen x-fi2 lua doesn't have this function working)
- io.popen (zen x-fi2 lua doesn't have this function working)
- io.tmpfile
- io.output
- io.input
- io.stdin
- io.stdout
- io.stderr
- print (on love works differently)

History:

1.1.1
- fix: touch messages

1.1.0
- made compatible with Love2d 0.8.0
- compatibility with Love2d 0.7.2 is lost
- fix: text color works

1.0.1
- fix: loading image

1.0
- wav table
- audio table
- image.setresource

0.8 initial public release

To run example in Love2d simply change extension from zip to love.
Added second Zip with new updated version for compatibility with Lova2d 0.8.0

Kalle Kula 11-27-2011 06:06 PM

greate thinking... but what of a enviorment are we using..?
Quote:

With this framework included in your app, you can run it on zen x-fi2 and Love.
I have to install löve and lua libs and run the app from a command-line?

delirius 11-28-2011 04:37 AM

Quote:

Originally Posted by Kalle Kula (Post 586045)
greate thinking... but what of a enviorment are we using..?

I have to install löve and lua libs and run the app from a command-line?

You can install love only. Or make executable for your platform (for win, linux or osx). More information can be found here.

I have added download links

Kalle Kula 11-30-2011 05:36 AM

Standalone App
 
I have been able to do a love-version of my chess app and the speed improvements compared to the ADK simulator is amazing.

The standalone app fails and maybe It's not necessary to have that, anyway if you got some clue how to solve it.
I get the same errors in Linux, Linux-Wine and Windows XP:

Quote:

[toti@koket Dokument]$ ./ChessX
Warning, quality setting failed! (Result: buffers: 0, samples: 0)
Error: [string "loveCompatibility/io2.lua"]:57: Could not set write directory.
stack traceback:
[C]: in function 'open'
[string "loveCompatibility/io2.lua"]:57: in function '_copyLoveFile'
[string "loveCompatibility/io2.lua"]:109: in function 'open'
[string "main.lua"]:618: in function 'RestoreFromFile'
[string "main.lua"]:643: in main chunk
[C]: in function 'require'
[string "boot.lua"]:1: in function <[string "boot.lua"]:1>
[C]: in function 'xpcall'
[toti@koket Dokument]$
Quote:

function RestoreFromFile()
local f = io.open("fen.fen","r")
if f ~= nil then
local s = f:read("*all")
if s ~= nil and string.len(s) > 0 then
InitializeFromFen(s)
c_usebook = false
end
f:close()
end
end
And as I said the love-version working fine. :)

delirius 11-30-2011 05:34 PM

Try running it as admin. Or sudo if i am not mistaken on Linux (not expert there :).
I seems it failed to create file or dir in user space. Could you send it to me? I will look at it tomorrow.

Btw. do you have all necessary libs with standalone binary of your game?

Kalle Kula 12-02-2011 06:01 AM

Quote:

Try running it as admin. Or sudo if i am not mistaken on Linux (not expert there) .
As admin/sudo,get the same error.
Quote:

I seems it failed to create file or dir in user space. Could you send it to me? I will look at it tomorrow.
I try to send it to you if the message-system aloud me(the zip file is 640kb).
Quote:

Btw. do you have all necessary libs with standalone binary of your game?
Yes 2 tries, I put the exe in the same folder as your working app (love-0.7.2-win-x86) and a second try with making a folder with the exe and copy the libs from C:\Program\Love.

I guess the only reason to do a stand-alone app is that you don't have to update it if the Löve or the dependent libs gets updated.

So don't spend so much time and effort on that(as it can be hard to detect ugliness of character-sets/path/case/name-mangling/... between Löve/Lua/Linux/Windows and DOS?).
the ("copy /b love.exe+game.love game.exe") looks like DOS (not expert there), did you use that for your example-app

I rather see that you try to get the wave/audio implemented.

delirius 12-05-2011 05:53 PM

new version with tables:
- audio
- wav
and resource bin support for loading images

delirius 12-05-2011 06:22 PM

Quote:

Originally Posted by Kalle Kula (Post 586360)
I have been able to do a love-version of my chess app and the speed improvements compared to the ADK simulator is amazing.

The standalone app fails and maybe It's not necessary to have that, anyway if you got some clue how to solve it.
I get the same errors in Linux, Linux-Wine and Windows XP:

And as I said the love-version working fine. :)

Found solution on love forum.
When you want to distribute app as exe you have to manually set identity in conf.lua. I tested it and it works.

Kalle Kula 02-01-2012 05:16 AM

I do a repost in the right thread. My original question was this:
Quote:

Have you tested your app on the player?
I hear no sound from your app on my player. I have done som tries to get my app working with sounds and löve and have got the sounds work on player but not in löve ?!
And found a solution for your app by changing the call to wav.play()
Code:

if love then
wav.play(0)
else
wav.play()
end

And also resampling the click.wav from 24 bit mono to 16 bit stereo or else the player do a hardcrash (rebuilding).
And this things also solves things for my app:)

delirius 02-05-2012 09:53 AM

i did some changes so you dont have to longer do:
Quote:

if love then wav.play(0) else wav.play() end
But i have problem converting click.wav. Audacity crashes every time.
Could you please send me converted wav. Thank you in advance.

Kalle Kula 02-06-2012 06:31 AM

The message system don't aloud me to send a wav file. I guess you could use any short sound from apps in Application folder. If you have my BC Forest you can use the on.wav in the snd folder, Laserstrike also have a click sound. Using your app on the player the sound fades away slowly(volume gets lower with every click). See: http://www.anythingbutipod.com/forum...ghlight=volume Another quick and dirty solution is; as you have os.wait(200); in the while loop
Code:

mysound:close();
mysound = wav.load(wavFile);
mysound:play()

In love, using windows(minimize/maximize), I think developer have to do a full screen redraw in some short cycle as you have done.

delirius 08-07-2012 04:50 PM

Added second Zip with new updated version for compatibility with Lova2d 0.8.0.
Thanks to new version of love2d i have solved redrawing screen problem caused by buffering.

Kalle Kula 08-16-2012 03:33 AM

touch messages
 
I have tested your work and it seems to handle touch messages differently.
No touch move or hold and always get a click message then the mouse has moved.

I have used the creatives TouchDemo that is included in the simulator download for testing.

delirius 08-16-2012 07:15 AM

Quote:

Originally Posted by Kalle Kula (Post 619001)
I have tested your work and it seems to handle touch messages differently.
No touch move or hold and always get a click message then the mouse has moved.

I have used the creatives TouchDemo that is included in the simulator download for testing.

I will look into it. Have you used previous version of this lib? Is it different?

Kalle Kula 08-16-2012 11:06 AM

Using the same TouchDemo app with Love 0.7.2 and your earlier lib working fine (tested with Windows Vista). The new lib was tested using Windows XP and linux-fedora

delirius 08-18-2012 03:11 AM

update uploaded (version 1.1.1)
I hope i fixed move and hold messages. It works for me now.

Kalle Kula 09-06-2012 05:46 AM

button.hold()
 
Touch messages working fine. Would be nice if you can do the same with button messages. I always get a button.click() and no button.hold()

delirius 09-16-2012 03:59 PM

Quote:

Originally Posted by Kalle Kula (Post 620626)
Touch messages working fine. Would be nice if you can do the same with button messages. I always get a button.click() and no button.hold()

ok, i will look into that.


All times are GMT -5. The time now is 05:25 AM.