unsigned long gpuDisp;
char cfgfile_basename[MAXPATHLEN];
static char *(*real_getenv)(const char *name);
+int state_slot;
+enum sched_action emu_action, emu_action_old;
+char hud_msg[64];
+int hud_new_msg;
+
+// from softgpu plugin
+extern int UseFrameSkip;
static void make_path(char *buf, size_t size, const char *dir, const char *fname)
{
snprintf(Config.PatchesDir, sizeof(Config.PatchesDir), "." PATCHES_DIR);
}
+void do_emu_action(void)
+{
+ int ret;
+
+ emu_action_old = emu_action;
+
+ switch (emu_action) {
+ case SACTION_NONE:
+ return;
+ case SACTION_ENTER_MENU:
+ menu_loop();
+ return;
+ case SACTION_LOAD_STATE:
+ ret = emu_load_state(state_slot);
+ snprintf(hud_msg, sizeof(hud_msg), ret == 0 ? "LOADED" : "FAIL!");
+ break;
+ case SACTION_SAVE_STATE:
+ ret = emu_save_state(state_slot);
+ snprintf(hud_msg, sizeof(hud_msg), ret == 0 ? "SAVED" : "FAIL!");
+ break;
+ case SACTION_NEXT_SSLOT:
+ state_slot++;
+ if (state_slot > 9)
+ state_slot = 0;
+ goto do_state_slot;
+ case SACTION_PREV_SSLOT:
+ state_slot--;
+ if (state_slot < 0)
+ state_slot = 9;
+ goto do_state_slot;
+ case SACTION_TOGGLE_FSKIP:
+ UseFrameSkip ^= 1;
+ snprintf(hud_msg, sizeof(hud_msg), "FRAMESKIP %s",
+ UseFrameSkip ? "ON" : "OFF");
+ break;
+ }
+ hud_new_msg = 3;
+ return;
+
+do_state_slot:
+ snprintf(hud_msg, sizeof(hud_msg), "STATE SLOT %d [%s]", state_slot,
+ emu_check_state(state_slot) == 0 ? "USED" : "FREE");
+ hud_new_msg = 3;
+}
+
int main(int argc, char *argv[])
{
void *tmp;
// If a state has been specified, then load that
if (loadst) {
- char state_filename[MAXPATHLEN];
- int ret = get_state_filename(state_filename, sizeof(state_filename), loadst - 1);
- if (ret == 0)
- ret = LoadState(state_filename);
- printf("%s state %s\n", ret ? "failed to load" : "loaded", state_filename);
+ int ret = emu_load_state(loadst - 1);
+ printf("%s state %d\n", ret ? "failed to load" : "loaded", loadst);
}
if (ready_to_go)
while (1)
{
stop = 0;
+ emu_action = SACTION_NONE;
+
psxCpu->Execute();
- menu_loop();
+ if (emu_action != SACTION_NONE)
+ do_emu_action();
}
return 0;
return 0;
}
+int emu_check_state(int slot)
+{
+ char fname[MAXPATHLEN];
+ int ret;
+
+ ret = get_state_filename(fname, sizeof(fname), slot);
+ if (ret != 0)
+ return ret;
+
+ return CheckState(fname);
+}
+
+int emu_save_state(int slot)
+{
+ char fname[MAXPATHLEN];
+ int ret;
+
+ ret = get_state_filename(fname, sizeof(fname), slot);
+ if (ret != 0)
+ return ret;
+
+ return SaveState(fname);
+}
+
+int emu_load_state(int slot)
+{
+ char fname[MAXPATHLEN];
+ int ret;
+
+ ret = get_state_filename(fname, sizeof(fname), slot);
+ if (ret != 0)
+ return ret;
+
+ return LoadState(fname);
+}
+
void SysPrintf(const char *fmt, ...) {
va_list list;
char msg[512];
extern char cfgfile_basename[MAXPATHLEN];
+extern int state_slot;
int get_state_filename(char *buf, int size, int i);
+int emu_check_state(int slot);
+int emu_save_state(int slot);
+int emu_load_state(int slot);
+
void set_cd_image(const char *fname);
extern unsigned long gpuDisp;
extern int ready_to_go;
+extern char hud_msg[64];
+extern int hud_new_msg;
+
+enum sched_action {
+ SACTION_NONE,
+ SACTION_ENTER_MENU,
+ SACTION_LOAD_STATE,
+ SACTION_SAVE_STATE,
+ SACTION_NEXT_SSLOT,
+ SACTION_PREV_SSLOT,
+ SACTION_TOGGLE_FSKIP,
+};
+
+static inline void emu_set_action(enum sched_action action_)
+{
+ extern enum sched_action emu_action, emu_action_old;
+ extern int stop;
+
+ if (action_ == SACTION_NONE)
+ emu_action_old = 0;
+ else if (action_ != emu_action_old)
+ stop = 1;
+ emu_action = action_;
+}
+
#endif /* __LINUX_H__ */
};
static int last_psx_w, last_psx_h, last_psx_bpp;
-static int scaling, filter, state_slot, cpu_clock, cpu_clock_st;
+static int scaling, filter, cpu_clock, cpu_clock_st;
static char rom_fname_reload[MAXPATHLEN];
static char last_selected_fname[MAXPATHLEN];
static int region, in_type_sel;
static int emu_check_save_file(int slot)
{
- char fname[MAXPATHLEN];
- int ret;
-
- ret = get_state_filename(fname, sizeof(fname), slot);
- if (ret != 0)
- return 0;
-
- ret = CheckState(fname);
+ int ret = emu_check_state(slot);
return ret == 0 ? 1 : 0;
}
-static int emu_save_load_game(int load, int sram)
+static int emu_save_load_game(int load, int unused)
{
- char fname[MAXPATHLEN];
int ret;
- ret = get_state_filename(fname, sizeof(fname), state_slot);
- if (ret != 0)
- return 0;
-
if (load) {
- ret = LoadState(fname);
+ ret = emu_load_state(state_slot);
// reflect hle/bios mode from savestate
if (Config.HLE)
bios_sel = 1;
}
else
- ret = SaveState(fname);
+ ret = emu_save_state(state_slot);
return ret;
}
me_bind_action emuctrl_actions[] =
{
-/*
- { "Load State ", PEV_STATE_LOAD },
- { "Save State ", PEV_STATE_SAVE },
- { "Prev Save Slot ", PEV_SSLOT_PREV },
- { "Next Save Slot ", PEV_SSLOT_NEXT },
-*/
- { "Enter Menu ", PEV_MENU },
+ { "Save State ", 1 << SACTION_SAVE_STATE },
+ { "Load State ", 1 << SACTION_LOAD_STATE },
+ { "Prev Save Slot ", 1 << SACTION_PREV_SSLOT },
+ { "Next Save Slot ", 1 << SACTION_NEXT_SSLOT },
+ { "Toggle Frameskip ", 1 << SACTION_TOGGLE_FSKIP },
+ { "Enter Menu ", 1 << SACTION_ENTER_MENU },
{ NULL, 0 }
};
bind = parse_bind_val(act, &bindtype);
if (bind != -1 && bind != 0) {
- printf("bind #%d '%s' %08x (%s)\n", dev_id, key, bind, act);
+ //printf("bind #%d '%s' %08x (%s)\n", dev_id, key, bind, act);
in_config_bind_key(dev_id, key, bind, bindtype);
}
else
// ------------ adv options menu ------------
-static const char h_cfg_cpul[] = "Shows CPU usage in %%";
+static const char h_cfg_cpul[] = "Shows CPU usage in %";
static const char h_cfg_fl[] = "Frame Limiter keeps the game from running too fast";
static const char h_cfg_xa[] = "Disables XA sound, which can sometimes improve performance";
static const char h_cfg_cdda[] = "Disable CD Audio for a performance boost\n"
#include "common/input.h"
#include "plugin_lib.h"
+#include "main.h"
static int fdnub[2];
static int analog_init_done;
{ KEY_DOWN, IN_BINDTYPE_PLAYER12, DKEY_DOWN },
{ KEY_LEFT, IN_BINDTYPE_PLAYER12, DKEY_LEFT },
{ KEY_RIGHT, IN_BINDTYPE_PLAYER12, DKEY_RIGHT },
- { KEY_SPACE, IN_BINDTYPE_EMU, PEVB_MENU },
{ KEY_PAGEUP, IN_BINDTYPE_PLAYER12, DKEY_TRIANGLE },
{ KEY_PAGEDOWN, IN_BINDTYPE_PLAYER12, DKEY_CROSS },
{ KEY_END, IN_BINDTYPE_PLAYER12, DKEY_CIRCLE },
{ KEY_RIGHTCTRL, IN_BINDTYPE_PLAYER12, DKEY_R1 },
{ KEY_Q, IN_BINDTYPE_PLAYER12, DKEY_L2 },
{ KEY_P, IN_BINDTYPE_PLAYER12, DKEY_R2 },
+ { KEY_SPACE, IN_BINDTYPE_EMU, SACTION_ENTER_MENU },
+ { KEY_1, IN_BINDTYPE_EMU, SACTION_SAVE_STATE },
+ { KEY_2, IN_BINDTYPE_EMU, SACTION_LOAD_STATE },
+ { KEY_3, IN_BINDTYPE_EMU, SACTION_PREV_SSLOT },
+ { KEY_4, IN_BINDTYPE_EMU, SACTION_NEXT_SSLOT },
+ { KEY_5, IN_BINDTYPE_EMU, SACTION_TOGGLE_FSKIP },
{ 0, 0, 0 }
};
/*
- * (C) notaz, 2010
+ * (C) notaz, 2010-2011
*
* This work is licensed under the terms of the GNU GPLv2 or later.
* See the COPYING file in the top-level directory.
#include "common/input.h"
#include "omap.h"
#include "menu.h"
+#include "main.h"
#include "pcnt.h"
#include "../libpcsxcore/new_dynarec/new_dynarec.h"
#include "../libpcsxcore/psemu_plugin_defs.h"
return ret;
}
+static void print_hud(void)
+{
+ if (pl_fbdev_bpp == 16)
+ pl_text_out16(2, pl_fbdev_h - 10, "%s", hud_msg);
+}
+
static void print_fps(void)
{
if (pl_fbdev_bpp == 16)
flip_cnt++;
if (pl_fbdev_buf != NULL) {
- if (g_opts & OPT_SHOWFPS)
+ if (hud_msg[0] != 0)
+ print_hud();
+ else if (g_opts & OPT_SHOWFPS)
print_fps();
+
if (g_opts & OPT_SHOWCPU)
print_cpu_usage();
}
static void update_input(void)
{
int actions[IN_BINDTYPE_COUNT] = { 0, };
+ unsigned int emu_act;
in_update(actions);
if (in_type == PSE_PAD_TYPE_ANALOGPAD)
in_update_analogs();
- if (actions[IN_BINDTYPE_EMU] & PEV_MENU)
- stop = 1;
+ emu_act = actions[IN_BINDTYPE_EMU];
+ if (emu_act) {
+ int which = 0;
+ for (; !(emu_act & 1); emu_act >>= 1, which++)
+ ;
+ emu_act = which;
+ }
+ emu_set_action(emu_act);
+
in_keystate = actions[IN_BINDTYPE_PLAYER12];
#ifdef X11
tv_old = now;
if (g_opts & OPT_SHOWCPU)
tick_per_sec = get_cpu_ticks();
+
+ if (hud_new_msg > 0) {
+ hud_new_msg--;
+ if (hud_new_msg == 0)
+ hud_msg[0] = 0;
+ }
}
#ifdef PCNT
static int ya_vsync_count;
#include <unistd.h>
#include <hildon/hildon.h>
#include "plugin_lib.h"
+#include "main.h"
#include "../libpcsxcore/psemu_plugin_defs.h"
#define X_RES 800
psxkey2 = DKEY_RIGHT;
break;
case 19:
- //SaveState(cfile);
+ if (event->type == GDK_KEY_PRESS)
+ emu_set_action(SACTION_SAVE_STATE);
return;
case 20:
- //LoadState(cfile);
+ if (event->type == GDK_KEY_PRESS)
+ emu_set_action(SACTION_LOAD_STATE);
return;
}
in_keystate &= ~(1 << psxkey1);
if (psxkey2 >= 0)
in_keystate &= ~(1 << psxkey2);
+
+ emu_set_action(SACTION_NONE);
}
}
gtk_widget_show_all (GTK_WIDGET (window));
}
+void menu_loop(void)
+{
+}
+
void *pl_fbdev_set_mode(int w, int h, int bpp)
{
if (w <= 0 || h <= 0)
// If a state has been specified, then load that
if (loadst) {
- char state_filename[MAXPATHLEN];
- int ret = get_state_filename(state_filename, sizeof(state_filename), loadst - 1);
- if (ret == 0)
- ret = LoadState(state_filename);
- printf("%s state %s\n", ret ? "failed to load" : "loaded", state_filename);
+ int ret = emu_load_state(loadst - 1);
+ printf("%s state %d\n", ret ? "failed to load" : "loaded", loadst);
}
if (ready_to_go)