Allegro for PSP
Allegro for PSP
Hi all,
I would like to share my Allegro PSP WIP :)
A simple graphic driver and the a mini keyboard driver using the PSP controller are implemented by now. It compiles and links with success some Allegro examples and the excellent Humphrey remake (the main reason for converting the library :P )
Two Allegro examples:
http://album.miarroba.com/diedel/0/6/
http://album.miarroba.com/diedel/0/7/
The Humphrey remake:
http://retrospec.sgn.net/users/ignacio/humpi.htm
In PSP:
http://album.miarroba.com/diedel/0/8/
http://album.miarroba.com/diedel/0/9/
Greetings!
I would like to share my Allegro PSP WIP :)
A simple graphic driver and the a mini keyboard driver using the PSP controller are implemented by now. It compiles and links with success some Allegro examples and the excellent Humphrey remake (the main reason for converting the library :P )
Two Allegro examples:
http://album.miarroba.com/diedel/0/6/
http://album.miarroba.com/diedel/0/7/
The Humphrey remake:
http://retrospec.sgn.net/users/ignacio/humpi.htm
In PSP:
http://album.miarroba.com/diedel/0/8/
http://album.miarroba.com/diedel/0/9/
Greetings!
-
- Posts: 3
- Joined: Mon Sep 29, 2008 7:41 pm
- Location: Australia
- Contact:
Great job, I know how much work it is. (Well, I had no prior PSP programming experience)
You don't seem to have an IR keyboard driver, you can use mine if you want ( Shouldn't be too hard to fix up. Requires kernel mode :( ) - http://tehsausage.com/allegro-psp/download
I think I've pretty much given up on mine now, too lazy to implement scaling etc.
Edit: You could use the timer (and possibly analog mouse) driver from there too, they're not perfect (thread synchronization mainly) but better than nothing.
You don't seem to have an IR keyboard driver, you can use mine if you want ( Shouldn't be too hard to fix up. Requires kernel mode :( ) - http://tehsausage.com/allegro-psp/download
I think I've pretty much given up on mine now, too lazy to implement scaling etc.
Edit: You could use the timer (and possibly analog mouse) driver from there too, they're not perfect (thread synchronization mainly) but better than nothing.
This is my first PSP programming experience too.
As you say it gets much time but actually I have enough of it to spend :) I like this project.
Greetings!
As you say it gets much time but actually I have enough of it to spend :) I like this project.
You know the projects are never finished :) so you can continue anytime.I think I've pretty much given up on mine now, too lazy to implement scaling etc.
You don't seem to have an IR keyboard driver, you can use mine if you want ( Shouldn't be too hard to fix up. Requires kernel mode :( ) - http://tehsausage.com/allegro-psp/download
Thanks man, I appreciate your friendly help. Technically, joining our codes the port is near complete :)Edit: You could use the timer (and possibly analog mouse) driver from there too, they're not perfect (thread synchronization mainly) but better than nothing.
Greetings!
Allegro 4.3.10plus PSP port
Finally the PSP port of the Allegro library (4.3.10plus version) is ready:
http://diedel.blogcindario.com/2009/01/ ... rsion.html
Feedback is welcome.
http://diedel.blogcindario.com/2009/01/ ... rsion.html
Feedback is welcome.
Great!!!
Now, I need to ask you a question... Can you work a porting of your library for Nanodesktop? I hope that you accept... You can contact me at [email protected] for further informations...
Now, I need to ask you a question... Can you work a porting of your library for Nanodesktop? I hope that you accept... You can contact me at [email protected] for further informations...
Nanodesktop is an SDK for PSP. More info here: http://visilab.unime.it/~filippo/Nanode ... esktop.htmdiedel wrote:What's Nanodesktop?
this if the official forum: http://www.psp-ita.com/forum/viewforum.php?f=23
you can see from http://visilab.unime.it/~filippo/Nanode ... shoots.htm some screenshots of some nd features: as you can see, nanodesktop is a very very good SDK, and his developer (Filippo Battaglia aka "pegasus2000") wants to port Allegro library on his library: can you help him?
For my PSP project, visit my web site: www.gefa.altervista.org
PaintMIXER v2.6.0 released: http://www.neoflash.com/forum/index.php ... 253.0.html
PaintMIXER v2.6.0 released: http://www.neoflash.com/forum/index.php ... 253.0.html
Exact! Nanodesktop is the most important PSPSDK... your Allegro Library is very very important... if you accept, we can create all what we want... scientific application, games, emulators :)Gefa wrote:Nanodesktop is an SDK for PSP. More info here: http://visilab.unime.it/~filippo/Nanode ... esktop.htmdiedel wrote:What's Nanodesktop?
this if the official forum: http://www.psp-ita.com/forum/viewforum.php?f=23
you can see from http://visilab.unime.it/~filippo/Nanode ... shoots.htm some screenshots of some nd features: as you can see, nanodesktop is a very very good SDK, and his developer (Filippo Battaglia aka "pegasus2000") wants to port Allegro library on his library: can you help him?
-
- Posts: 203
- Joined: Sat Jul 05, 2008 8:03 am
Just done the mouse driver for the psp allegro port
available at: http://fileupload.filetac.com/file/82b0 ... 8f12943be2
and here http://online-sharing.net/5w2ogfwx5f2f/allegro.tgz.html
file modified makefile.lst
src/psp/pdriver.c
new file src/psp/pmouse.c
available at: http://fileupload.filetac.com/file/82b0 ... 8f12943be2
and here http://online-sharing.net/5w2ogfwx5f2f/allegro.tgz.html
file modified makefile.lst
src/psp/pdriver.c
new file src/psp/pmouse.c
-
- Posts: 203
- Joined: Sat Jul 05, 2008 8:03 am
Re: Allegro 4.3.10plus PSP port
Download link on the above page no longer works.diedel wrote:Finally the PSP port of the Allegro library (4.3.10plus version) is ready:
http://diedel.blogcindario.com/2009/01/ ... rsion.html
Feedback is welcome.
-
- Posts: 203
- Joined: Sat Jul 05, 2008 8:03 am
Just a little correction in de mouse driver.
it limit the mouse correctly to 0..479 and 0.271
Code: Select all
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* PSP mouse driver.
* TODO:.
*
* By sauron_le_noir some part of psp_mouse_timer_poll based on
* the sdl code of Nekuz0r
*
* See readme.txt for copyright information.
*/
#include "allegro.h"
#include "allegro/internal/aintern.h"
#include "allegro/platform/aintpsp.h"
#include "math.h"
#include <pspctrl.h>
#ifndef ALLEGRO_PSP
#error something is wrong with the makefile
#endif
static int psp_mouse_init(void);
static void psp_mouse_exit(void);
static void psp_mouse_position(int, int);
static void psp_mouse_set_range(int, int, int, int);
static void psp_mouse_get_mickeys(int *, int *);
static void psp_mouse_timer_poll(void);
MOUSE_DRIVER mouse_psp =
{
MOUSE_PSP,
empty_string,
empty_string,
"psp mouse",
psp_mouse_init,
psp_mouse_exit,
NULL, // AL_METHOD(void, poll, (void));
psp_mouse_timer_poll, // AL_METHOD(void, timer_poll, (void));
psp_mouse_position,
psp_mouse_set_range,
NULL, // AL_METHOD(void, set_speed, (int xspeed, int yspeed));
psp_mouse_get_mickeys,
NULL, // AL_METHOD(int, analyse_data, (AL_CONST char *buffer, int size));
NULL, // AL_METHOD(void, enable_hardware_cursor, (AL_CONST int mode));
NULL // AL_METHOD(int, select_system_cursor, (AL_CONST int cursor));
};
static int mouse_minx = 0;
static int mouse_miny = 0;
static int mouse_maxx = 479; /* 0 to 479 = 480 */
static int mouse_maxy = 271; /* 0 to 272 = 272 */ /* 480x272 is the resolution of the psp display */
static int mymickey_x = 0;
static int mymickey_y = 0;
static SceCtrlData pad;
static int aStickX = 0;
static int aStickY = 0;
static float aStickR;
static float aStickA;
static int x,y;
static float Precision = 360.0f;
static int getSqrRadius(int X, int Y)
{
return sqrt((X * X) + (Y * Y));
}
static int psp_mouse_init(void)
{
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
}
static void psp_mouse_timer_poll(void)
{
sceCtrlPeekBufferPositive(&pad, 1);
if (pad.Buttons != 0)
{
sceCtrlReadBufferPositive(&pad, 1);
_mouse_b = 0;
if (pad.Buttons & PSP_CTRL_LTRIGGER) _mouse_b = 1;
if (pad.Buttons & PSP_CTRL_RTRIGGER) _mouse_b = 2;
if ( (pad.Buttons & PSP_CTRL_LTRIGGER) && (pad.Buttons & PSP_CTRL_RTRIGGER)) _mouse_b = 4;
}
aStickX = pad.Ly - 128;
aStickY = pad.Lx - 128;
aStickR = getSqrRadius(aStickX, aStickY);
if (aStickR > 100) {
if (getSqrRadius(aStickX, aStickY) > 30) {
aStickA = ((atan2f(aStickX, -aStickY) + M_PI) / (M_PI * 2)) * Precision;
} else {
aStickA = -1;
}
//1° a 89°
if (aStickA >= 1 && aStickA <= (89 * (Precision / 360.0f))) {
x += (10 * (1 - (aStickA / (Precision / 360.0f) / 90)));
y -= (10 * (0 + (aStickA / (Precision / 360.0f) / 90)));
}
else if (aStickA >= (91 * (Precision / 360.0f)) && aStickA <= (179 * (Precision / 360.0f))) {
x -= (10 * (0 + (((aStickA / (Precision / 360.0f)) - 89) / 90)));
y -= (10 * (1 - (((aStickA / (Precision / 360.0f)) - 89) / 90)));
}
else if (aStickA >= (181 * (Precision / 360.0f)) && aStickA <= (269 * (Precision / 360.0f))) {
x -= (10 * (1 - (((aStickA / (Precision / 360.0f)) - 179) / 90)));
y += (10 * (0 + (((aStickA / (Precision / 360.0f)) - 179) / 90)));
}
else if (aStickA >= (271 * (Precision / 360.0f)) && aStickA <= (359 * (Precision / 360.0f))) {
x += (10 * (0 + (((aStickA / (Precision / 360.0f)) - 269) / 90)));
y += (10 * (1 - (((aStickA / (Precision / 360.0f)) - 269) / 90)));
}
else if (aStickA == 0) {
x += 10;
}
else if (aStickA == (90 * (Precision / 360.0f))) {
y -= 10;
}
else if (aStickA == (180 * (Precision / 360.0f))) {
x -= 10;
}
else if (aStickR == (270 * (Precision / 360.0f))) {
y += 10;
}
}
if (x < 0)
x = 0;
if (x > 479)
x = 479;
if (y < 0)
y = 0;
if (y > 271)
y = 271;
_mouse_x = x;
_mouse_y = y;
}
static void psp_mouse_position(int x, int y)
{
_mouse_x = x;
if (_mouse_x < mouse_minx) _mouse_x = 0;
if (_mouse_x > mouse_maxx) _mouse_x = mouse_maxx;
_mouse_y = y;
if (_mouse_y < mouse_miny) _mouse_y = 0;
if (_mouse_y > mouse_maxy) _mouse_y = mouse_maxy;
}
static void psp_mouse_set_range(int x1, int y1, int x2, int y2)
{
}
static void psp_mouse_get_mickeys(int *mickeyx, int *mickeyy)
{
*mickeyx = 0;
*mickeyy = 0;
}
static void psp_mouse_exit(void)
{
}
Sorry if this is off topic, but i'm just curious...
Is this in anyway related to the legendary Allegro graphics/gaming library from back in the MS-DOS days (which is still maintained today)? Or is the same name purely coincedental..?
EDIT: Sorry, you failed to mention that this is a port of THE Allegro library. WOW. Well done! Very awesome!
Is this in anyway related to the legendary Allegro graphics/gaming library from back in the MS-DOS days (which is still maintained today)? Or is the same name purely coincedental..?
EDIT: Sorry, you failed to mention that this is a port of THE Allegro library. WOW. Well done! Very awesome!
Regards,
Daniel C
Daniel C
-
- Posts: 160
- Joined: Wed Jul 12, 2006 7:09 am
@diedel:
In any case, I'm writing a new version of Nanodesktop that shall
support sprites. I thought that this can be useful in an Allegro
porting. I've open a thread in this forum for the proof of concept.
Here a screenshot:
http://img82.imageshack.us/img82/6527/screenshotftk.png
I hope that you can create a version of ndAllegro in the future...
:)
In any case, I'm writing a new version of Nanodesktop that shall
support sprites. I thought that this can be useful in an Allegro
porting. I've open a thread in this forum for the proof of concept.
Here a screenshot:
http://img82.imageshack.us/img82/6527/screenshotftk.png
I hope that you can create a version of ndAllegro in the future...
:)
-
- Posts: 203
- Joined: Sat Jul 05, 2008 8:03 am
-
- Posts: 91
- Joined: Sun Feb 22, 2009 8:32 am
- Location: Melbourne Australia ZOMG
- Josh1billion
- Posts: 32
- Joined: Tue Jul 12, 2005 8:45 am
- Location: Wisconsin, USA
- Contact:
Is it possible to install this on Windows alongside MinPSPW?
Josh1billion - PHP, C++, PSP programmer.