#include <unistd.h>
#include <hildon/hildon.h>
#include "plugin_lib.h"
+
#include "main.h"
#include "../libpcsxcore/psemu_plugin_defs.h"
+#include "common/readpng.h"
#define X_RES 800
#define Y_RES 480
static HildonAnimationActor *actor;
static GtkWidget *window, *drawing;
+extern int g_opts;
+extern char * file_name;
+static int pl_buf_w, pl_buf_h;
+static int sens, y_def;
static int keymap[65536];
// map psx4m compatible keymap to PSX keys
break;
case 19:
if (event->type == GDK_KEY_PRESS)
- emu_set_action(SACTION_SAVE_STATE);
+ {
+ emu_save_state(state_slot);
+ char buf[MAXPATHLEN];
+ sprintf (buf,"/opt/maemo/usr/games/screenshots%s.%3.3d",file_name,state_slot);
+ writepng(buf, image->mem, pl_buf_w,pl_buf_h);
+ }
return;
case 20:
if (event->type == GDK_KEY_PRESS)
- emu_set_action(SACTION_LOAD_STATE);
+ emu_load_state(state_slot);
+ return;
+ case 21:
+ if (event->type == GDK_KEY_PRESS)
+ state_slot=(state_slot<9)?state_slot+1:0;
+ return;
+ case 22:
+ if (event->type == GDK_KEY_PRESS)
+ state_slot=(state_slot>0)?state_slot-1:8;
return;
}
fclose(pFile);
}
+ pFile = fopen("/opt/psx4m/config", "r");
+ if (NULL != pFile) {
+ fscanf(pFile, "%d %d",&sens,&y_def);
+ fclose(pFile);
+ } else {
+ sens=150;
+ y_def=500; //near 45 degrees =)
+ }
+
gtk_init (argc, argv);
window = hildon_stackable_window_new ();
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
actor = HILDON_ANIMATION_ACTOR (hildon_animation_actor_new());
- hildon_animation_actor_set_position (actor, (X_RES - D_WIDTH)/2, (Y_RES - D_HEIGHT)/2 );
+ if (g_opts & 2)
+ hildon_animation_actor_set_position (actor, 0, 0 );
+ else
+ hildon_animation_actor_set_position (actor, (X_RES - D_WIDTH)/2, (Y_RES - D_HEIGHT)/2 );
hildon_animation_actor_set_parent (actor, GTK_WINDOW (window));
drawing = gtk_image_new ();
gtk_image_set_from_image (GTK_IMAGE(drawing), image, NULL);
gtk_window_resize (GTK_WINDOW (actor), w, h);
- hildon_animation_actor_set_scale (actor,
+ if (g_opts & 2)
+ hildon_animation_actor_set_scale (actor,
+ (gdouble)800 / (gdouble)w,
+ (gdouble)480 / (gdouble)h
+ );
+ else
+ hildon_animation_actor_set_scale (actor,
(gdouble)D_WIDTH / (gdouble)w,
(gdouble)D_HEIGHT / (gdouble)h
- );
-
+ );
+ pl_buf_w=w;pl_buf_h=h;
return pl_vout_buf;
}
{
gtk_widget_queue_draw (drawing);
+ // process accelometer
+ if (g_opts & 4) {
+ int x, y, z;
+ FILE* f = fopen( "/sys/class/i2c-adapter/i2c-3/3-001d/coord", "r" );
+ if( !f ) {printf ("err in accel"); exit(1);}
+ fscanf( f, "%d %d %d", &x, &y, &z );
+ fclose( f );
+
+ if( x > sens ) keystate |= 1 << DKEY_LEFT;
+ else if( x < -sens ) keystate |= 1 << DKEY_RIGHT;
+ else {keystate &= ~(1 << DKEY_LEFT);keystate &= ~(1 << DKEY_RIGHT);}
+
+ y+=y_def;
+ if( y > sens )keystate |= 1 << DKEY_UP;
+ else if( y < -sens ) keystate |= 1 << DKEY_DOWN;
+ else {keystate &= ~(1 << DKEY_DOWN);keystate &= ~(1 << DKEY_UP);}
+
+ }
+
/* process GTK+ events */
while (gtk_events_pending())
gtk_main_iteration();
enum sched_action emu_action;
void do_emu_action(void);
+char* file_name;
static void ChangeWorkingDirectory(char *exe)
{
else if (!strcmp(argv[i], "-load")) loadst = atol(argv[++i]);
else if (!strcmp(argv[i], "-cdfile")) {
char isofilename[MAXPATHLEN];
-
if (i+1 >= argc) break;
strncpy(isofilename, argv[++i], MAXPATHLEN);
if (isofilename[0] != '/') {
} else
isofilename[0] = 0;
}
-
cdfile = isofilename;
}
else if (!strcmp(argv[i],"-frameskip")) {
-
int tv_reg = atol(argv[++i]);
if (tv_reg > 0)
- pl_rearmed_cbs.frameskip = 1;
- }
- else if (!strcmp(argv[i],"-sputhreaded")) {
- iUseTimer=1;
- }
- else if (!strcmp(argv[i],"-nosound")) {
- strcpy(Config.Spu, "spunull.so");
- }
- else if(!strcmp(argv[i], "-bdir")) sprintf(Config.BiosDir, "%s", argv[++i]);
- else if(!strcmp(argv[i], "-bios")) sprintf(Config.Bios, "%s", argv[++i]);
- else if (!strcmp(argv[i],"-gles")){
- strcpy(Config.Gpu, "gpuGLES.so");
+ pl_rearmed_cbs.frameskip = -1;
}
+ else if (!strcmp(argv[i],"-fullscreen")) g_opts |= 2;
+ else if (!strcmp(argv[i],"-accel")) g_opts |= 4;
+ else if (!strcmp(argv[i],"-sputhreaded")) iUseTimer=1;
+ else if (!strcmp(argv[i],"-nosound")) strcpy(Config.Spu, "spunull.so");
+ /* unworking with r10
+ else if(!strcmp(argv[i], "-bdir")) sprintf(Config.BiosDir, "%s", argv[++i]);
+ else if(!strcmp(argv[i], "-bios")) sprintf(Config.Bios, "%s", argv[++i]);
+ else if (!strcmp(argv[i],"-gles")) strcpy(Config.Gpu, "gpuGLES.so");
+ */
else if (!strcmp(argv[i], "-cdda")) Config.Cdda = 1;
else if (!strcmp(argv[i], "-xa")) Config.Xa = 1;
else if (!strcmp(argv[i], "-rcnt")) Config.RCntFix = 1 ;
else if (!strcmp(argv[i], "-sio")) Config.Sio = 1;
else if (!strcmp(argv[i], "-spuirq")) Config.SpuIrq = 1;
else if (!strcmp(argv[i], "-vsync")) Config.VSyncWA = 1;
- else if (!strcmp(argv[i], "-h") ||
- !strcmp(argv[i], "-help") ||
- !strcmp(argv[i], "--help")) {
- printf(PACKAGE_NAME " " PACKAGE_VERSION "\n");
- printf("%s\n", _(
- " pcsx [options] [file]\n"
- "\toptions:\n"
- "\t-cdfile FILE\tRuns a CD image file\n"
- "\t-psxout\t\tEnable PSX output\n"
- "\t-nosound\t\tDisable sound using spunull plugin\n"
- "\t-sputhreaded\t\tMove sound to separate thread\n"
- "\t-frameskip\t\tEnable frameskip\n"
- "\t-load STATENUM\tLoads savestate STATENUM (1-5)\n"
- "\t-h -help\tDisplay this message\n"
- "\tfile\t\tLoads file\n"));
- return 0;
- } else {
- strncpy(file, argv[i], MAXPATHLEN);
- if (file[0] != '/') {
- getcwd(path, MAXPATHLEN);
- if (strlen(path) + strlen(file) + 1 < MAXPATHLEN) {
- strcat(path, "/");
- strcat(path, file);
- strcpy(file, path);
- } else
- file[0] = 0;
- }
- }
}
pl_rearmed_cbs.gpu_peops.dwActFixes = 1<<7;
hildon_init(&argc, &argv);
+ char f_name[MAXPATHLEN];
+ strcpy(f_name, strrchr(cdfile,'/'));
+ file_name=f_name;
+
if (cdfile)
set_cd_image(cdfile);