*/
-#define CALC_DEBUG 0
+#define CALC_DEBUG 1
#if CALC_DEBUG
#define calc_log(x) do { write_log x; } while(0)
cfgfile_dwrite_bool (f, _T("clipboard_sharing"), p->clipboard_sharing);
cfgfile_dwrite_bool (f, _T("native_code"), p->native_code);
- cfgfile_write (f, _T("gfx_display"), _T("%d"), p->gfx_display);
- cfgfile_dwrite_str (f, _T("gfx_display_name"), p->gfx_display_name);
+ cfgfile_write (f, _T("gfx_display"), _T("%d"), p->gfx_apmode[APMODE_NATIVE].gfx_display);
+ cfgfile_dwrite_str (f, _T("gfx_display_name"), p->gfx_apmode[APMODE_NATIVE].gfx_display_name);
+ if (p->gfx_apmode[APMODE_NATIVE].gfx_display != p->gfx_apmode[APMODE_RTG].gfx_display || p->gfx_apmode[APMODE_RTG].gfx_display_name[0]) {
+ cfgfile_write (f, _T("gfx_display_rtg"), _T("%d"), p->gfx_apmode[APMODE_RTG].gfx_display);
+ cfgfile_dwrite_str (f, _T("gfx_display_name_rtg"), p->gfx_apmode[APMODE_RTG].gfx_display_name);
+ }
cfgfile_write (f, _T("gfx_framerate"), _T("%d"), p->gfx_framerate);
cfgfile_write (f, _T("gfx_width"), _T("%d"), p->gfx_size_win.width); /* compatibility with old versions */
cfgfile_write (f, _T("gfx_height"), _T("%d"), p->gfx_size_win.height); /* compatibility with old versions */
cfgfile_write (f, _T("chipmem_size"), _T("%d"), p->chipmem_size == 0x20000 ? -1 : (p->chipmem_size == 0x40000 ? 0 : p->chipmem_size / 0x80000));
cfgfile_dwrite (f, _T("megachipmem_size"), _T("%d"), p->z3chipmem_size / 0x100000);
- if (p->m68k_speed > 0)
+ if (p->m68k_speed > 0) {
cfgfile_write (f, _T("finegrain_cpu_speed"), _T("%d"), p->m68k_speed);
- else
+ } else {
cfgfile_write_str (f, _T("cpu_speed"), p->m68k_speed < 0 ? _T("max") : _T("real"));
+ }
+ cfgfile_write (f, _T("cpu_throttle"), _T("%d"), p->m68k_speed_throttle);
/* do not reorder start */
write_compatibility_cpu(f, p);
|| cfgfile_intval (option, value, _T("sound_stereo_separation"), &p->sound_stereo_separation, 1)
|| cfgfile_intval (option, value, _T("sound_stereo_mixing_delay"), &p->sound_mixed_stereo_delay, 1)
- || cfgfile_intval (option, value, _T("gfx_display"), &p->gfx_display, 1)
|| cfgfile_intval (option, value, _T("gfx_framerate"), &p->gfx_framerate, 1)
|| cfgfile_intval (option, value, _T("gfx_width_windowed"), &p->gfx_size_win.width, 1)
|| cfgfile_intval (option, value, _T("gfx_height_windowed"), &p->gfx_size_win.height, 1)
|| cfgfile_intval (option, value, _T("gfx_left_windowed"), &p->gfx_size_win.y, 1)
|| cfgfile_intval (option, value, _T("gfx_width_fullscreen"), &p->gfx_size_fs.width, 1)
|| cfgfile_intval (option, value, _T("gfx_height_fullscreen"), &p->gfx_size_fs.height, 1)
- || cfgfile_intval (option, value, _T("gfx_refreshrate"), &p->gfx_apmode[0].gfx_refreshrate, 1)
- || cfgfile_intval (option, value, _T("gfx_refreshrate_rtg"), &p->gfx_apmode[1].gfx_refreshrate, 1)
+ || cfgfile_intval (option, value, _T("gfx_refreshrate"), &p->gfx_apmode[APMODE_NATIVE].gfx_refreshrate, 1)
+ || cfgfile_intval (option, value, _T("gfx_refreshrate_rtg"), &p->gfx_apmode[APMODE_RTG].gfx_refreshrate, 1)
|| cfgfile_yesno (option, value, _T("gfx_autoresolution"), &p->gfx_autoresolution)
- || cfgfile_intval (option, value, _T("gfx_backbuffers"), &p->gfx_apmode[0].gfx_backbuffers, 1)
- || cfgfile_intval (option, value, _T("gfx_backbuffers_rtg"), &p->gfx_apmode[1].gfx_backbuffers, 1)
- || cfgfile_yesno (option, value, _T("gfx_interlace"), &p->gfx_apmode[0].gfx_interlaced)
+ || cfgfile_intval (option, value, _T("gfx_backbuffers"), &p->gfx_apmode[APMODE_NATIVE].gfx_backbuffers, 1)
+ || cfgfile_intval (option, value, _T("gfx_backbuffers_rtg"), &p->gfx_apmode[APMODE_RTG].gfx_backbuffers, 1)
+ || cfgfile_yesno (option, value, _T("gfx_interlace"), &p->gfx_apmode[APMODE_NATIVE].gfx_interlaced)
|| cfgfile_intval (option, value, _T("gfx_center_horizontal_position"), &p->gfx_xcenter_pos, 1)
|| cfgfile_intval (option, value, _T("gfx_center_vertical_position"), &p->gfx_ycenter_pos, 1)
|| cfgfile_path (option, value, _T("floppy1soundext"), p->floppyslots[1].dfxclickexternal, sizeof p->floppyslots[1].dfxclickexternal / sizeof (TCHAR))
|| cfgfile_path (option, value, _T("floppy2soundext"), p->floppyslots[2].dfxclickexternal, sizeof p->floppyslots[2].dfxclickexternal / sizeof (TCHAR))
|| cfgfile_path (option, value, _T("floppy3soundext"), p->floppyslots[3].dfxclickexternal, sizeof p->floppyslots[3].dfxclickexternal / sizeof (TCHAR))
- || cfgfile_string (option, value, _T("gfx_display_name"), p->gfx_display_name, sizeof p->gfx_display_name / sizeof (TCHAR))
|| cfgfile_string (option, value, _T("config_window_title"), p->config_window_title, sizeof p->config_window_title / sizeof (TCHAR))
|| cfgfile_string (option, value, _T("config_info"), p->info, sizeof p->info / sizeof (TCHAR))
|| cfgfile_string (option, value, _T("config_description"), p->description, sizeof p->description / sizeof (TCHAR)))
|| cfgfile_strval (option, value, _T("gfx_resolution"), &p->gfx_resolution, lorestype1, 0)
|| cfgfile_strval (option, value, _T("gfx_lores"), &p->gfx_resolution, lorestype2, 0)
|| cfgfile_strval (option, value, _T("gfx_lores_mode"), &p->gfx_lores_mode, loresmode, 0)
- || cfgfile_strval (option, value, _T("gfx_fullscreen_amiga"), &p->gfx_apmode[0].gfx_fullscreen, fullmodes, 0)
- || cfgfile_strval (option, value, _T("gfx_fullscreen_picasso"), &p->gfx_apmode[1].gfx_fullscreen, fullmodes, 0)
+ || cfgfile_strval (option, value, _T("gfx_fullscreen_amiga"), &p->gfx_apmode[APMODE_NATIVE].gfx_fullscreen, fullmodes, 0)
+ || cfgfile_strval (option, value, _T("gfx_fullscreen_picasso"), &p->gfx_apmode[APMODE_RTG].gfx_fullscreen, fullmodes, 0)
|| cfgfile_strval (option, value, _T("gfx_center_horizontal"), &p->gfx_xcenter, centermode1, 1)
|| cfgfile_strval (option, value, _T("gfx_center_vertical"), &p->gfx_ycenter, centermode1, 1)
|| cfgfile_strval (option, value, _T("gfx_center_horizontal"), &p->gfx_xcenter, centermode2, 0)
|| cfgfile_strval (option, value, _T("absolute_mouse"), &p->input_tablet, abspointers, 0))
return 1;
+
+ if (cfgfile_intval (option, value, _T("gfx_display"), &p->gfx_apmode[APMODE_NATIVE].gfx_display, 1)) {
+ p->gfx_apmode[APMODE_RTG].gfx_display = p->gfx_apmode[APMODE_NATIVE].gfx_display;
+ return 1;
+ }
+ if (cfgfile_intval (option, value, _T("gfx_display_rtg"), &p->gfx_apmode[APMODE_RTG].gfx_display, 1)) {
+ return 1;
+ }
+ if (cfgfile_string (option, value, _T("gfx_display_name"), p->gfx_apmode[APMODE_NATIVE].gfx_display_name, sizeof p->gfx_apmode[APMODE_NATIVE].gfx_display_name / sizeof (TCHAR))) {
+ _tcscpy (p->gfx_apmode[APMODE_RTG].gfx_display_name, p->gfx_apmode[APMODE_NATIVE].gfx_display_name);
+ return 1;
+ }
+ if (cfgfile_string (option, value, _T("gfx_display_name_rtg"), p->gfx_apmode[APMODE_RTG].gfx_display_name, sizeof p->gfx_apmode[APMODE_RTG].gfx_display_name / sizeof (TCHAR))) {
+ return 1;
+ }
+
if (_tcscmp (option, _T("gfx_linemode")) == 0) {
int v;
p->gfx_vresolution = VRES_DOUBLE;
return 1;
}
if (_tcscmp (option, _T("gfx_vsync")) == 0) {
- if (cfgfile_strval (option, value, _T("gfx_vsync"), &p->gfx_apmode[0].gfx_vsync, vsyncmodes, 0) >= 0)
+ if (cfgfile_strval (option, value, _T("gfx_vsync"), &p->gfx_apmode[APMODE_NATIVE].gfx_vsync, vsyncmodes, 0) >= 0)
return 1;
- return cfgfile_yesno (option, value, _T("gfx_vsync"), &p->gfx_apmode[0].gfx_vsync);
+ return cfgfile_yesno (option, value, _T("gfx_vsync"), &p->gfx_apmode[APMODE_NATIVE].gfx_vsync);
}
if (_tcscmp (option, _T("gfx_vsync_picasso")) == 0) {
- if (cfgfile_strval (option, value, _T("gfx_vsync_picasso"), &p->gfx_apmode[1].gfx_vsync, vsyncmodes, 0) >= 0)
+ if (cfgfile_strval (option, value, _T("gfx_vsync_picasso"), &p->gfx_apmode[APMODE_RTG].gfx_vsync, vsyncmodes, 0) >= 0)
return 1;
- return cfgfile_yesno (option, value, _T("gfx_vsync_picasso"), &p->gfx_apmode[1].gfx_vsync);
+ return cfgfile_yesno (option, value, _T("gfx_vsync_picasso"), &p->gfx_apmode[APMODE_RTG].gfx_vsync);
}
- if (cfgfile_strval (option, value, _T("gfx_vsyncmode"), &p->gfx_apmode[0].gfx_vsyncmode, vsyncmodes2, 0))
+ if (cfgfile_strval (option, value, _T("gfx_vsyncmode"), &p->gfx_apmode[APMODE_NATIVE].gfx_vsyncmode, vsyncmodes2, 0))
return 1;
- if (cfgfile_strval (option, value, _T("gfx_vsyncmode_picasso"), &p->gfx_apmode[1].gfx_vsyncmode, vsyncmodes2, 0))
+ if (cfgfile_strval (option, value, _T("gfx_vsyncmode_picasso"), &p->gfx_apmode[APMODE_RTG].gfx_vsyncmode, vsyncmodes2, 0))
return 1;
if (cfgfile_yesno (option, value, _T("show_leds"), &vb)) {
p->m68k_speed *= CYCLE_UNIT;
return 1;
}
-
+ if (cfgfile_intval (option, value, _T("cpu_throttle"), &p->m68k_speed_throttle, 1)) {
+ return 1;
+ }
if (cfgfile_intval (option, value, _T("finegrain_cpu_speed"), &p->m68k_speed, 1)) {
if (OFFICIAL_CYCLE_UNIT > CYCLE_UNIT) {
int factor = OFFICIAL_CYCLE_UNIT / CYCLE_UNIT;
alloc_cycle (hpos, type);
}
-void alloc_cycle_ext(int hpos, int type)
+void alloc_cycle_ext (int hpos, int type)
{
alloc_cycle (hpos, type);
}
static int rpt_vsync (void)
{
- int v = read_processor_time () - vsyncmaxtime;
+ int v = read_processor_time () - vsyncwaittime;
if (v > (int)syncbase || v < -((int)syncbase)) {
- vsyncmintime = vsyncmaxtime = read_processor_time ();
+ vsyncmintime = vsyncmaxtime = vsyncwaittime = read_processor_time ();
v = 0;
}
return v;
if (vs > 0) {
curr_time = read_processor_time ();
- vsyncmaxtime = curr_time + vsynctimebase;
+ vsyncwaittime = vsyncmaxtime = curr_time + vsynctimebase;
render_screen ();
show_screen ();
frame_shown = true;
vsync_busywait_end ();
vsync_busywait_do (NULL, (bplcon0 & 4) != 0 && !lof_changed && !lof_changing, lof_store != 0);
vsync_busywait_start ();
+
vsyncmintime = curr_time;
- vsyncmaxtime = curr_time + vsynctimebase * (100 - currprefs.m68k_speed_throttle) / 100;
+ vsyncwaittime = curr_time + vsynctimebase;
+ vsyncmaxtime = curr_time + vsynctimebase * (1000 + currprefs.m68k_speed_throttle) / 1000;
} else {
vsync_busywait_do (&freetime, (bplcon0 & 4) != 0 && !lof_changed && !lof_changing, lof_store != 0);
curr_time = read_processor_time ();
vsyncmintime = curr_time;
+ vsyncwaittime = curr_time + vsynctimebase;
vsyncmaxtime = curr_time + vsynctimebase;
if (!show) {
show_screen ();
}
return;
}
+
if (currprefs.m68k_speed < 0) {
+
+ for (;;) {
+ double v = rpt_vsync () / (syncbase / 1000.0);
+ if (v >= -4)
+ break;
+ rtg_vsynccheck ();
+ sleep_millis_main (2);
+ }
+ while (rpt_vsync () < 0)
+ rtg_vsynccheck ();
curr_time = read_processor_time ();
- if (curr_time - vsyncmaxtime >= 0 && curr_time - vsyncmaxtime < vsynctimebase) {
- vsyncmaxtime = curr_time + vsynctimebase * (100 - currprefs.m68k_speed_throttle) / 100 - (curr_time - vsyncmaxtime);
+ if ((int)curr_time - (int)vsyncwaittime > 0 && (int)curr_time - (int)vsyncwaittime < vsynctimebase / 2) {
+ int adjust = curr_time - vsyncmaxtime;
+ vsyncmaxtime = curr_time + vsynctimebase * (1000 + currprefs.m68k_speed_throttle) / 1000 - adjust;
+ vsyncwaittime = curr_time + vsynctimebase - adjust;
} else {
- vsyncmaxtime = curr_time + vsynctimebase * (100 - currprefs.m68k_speed_throttle) / 100;
+ vsyncmaxtime = curr_time + vsynctimebase * (1000 + currprefs.m68k_speed_throttle) / 1000;
+ vsyncwaittime = curr_time + vsynctimebase;
}
vsyncmintime = curr_time;
- return;
- }
+
+ } else {
- bool didrender = false;
- if (!picasso_on)
- didrender = render_screen ();
- for (;;) {
- double v = rpt_vsync () / (syncbase / 1000.0);
- if (v >= -4)
- break;
- rtg_vsynccheck ();
- sleep_millis_main (2);
- }
- curr_time = start = read_processor_time ();
- while (rpt_vsync () < 0)
- rtg_vsynccheck ();
- idletime += read_processor_time() - start;
- curr_time = read_processor_time ();
- vsyncmintime = curr_time;
- vsyncmaxtime = curr_time + vsynctimebase;
- if (didrender)
- show_screen ();
- frame_shown = true;
+ bool didrender = false;
+ if (!picasso_on)
+ didrender = render_screen ();
+ for (;;) {
+ double v = rpt_vsync () / (syncbase / 1000.0);
+ if (v >= -4)
+ break;
+ rtg_vsynccheck ();
+ sleep_millis_main (2);
+ }
+ curr_time = start = read_processor_time ();
+ while (rpt_vsync () < 0)
+ rtg_vsynccheck ();
+ idletime += read_processor_time() - start;
+ curr_time = read_processor_time ();
+ vsyncmintime = curr_time;
+ vsyncmaxtime = vsyncwaittime = curr_time + vsynctimebase;
+ if (didrender)
+ show_screen ();
+ frame_shown = true;
+
+ }
}
static frame_time_t frametime2;
#endif
events_dmal_hsync ();
-
+#if 0
+ static int cnt = 0;
+ cnt++;
+ if (cnt == 500) {
+ int port_insert_custom (int inputmap_port, int devicetype, DWORD flags, const TCHAR *custom);
+ port_insert_custom (0, 0, 0, L"Left=0xC8 Right=0xD0 Up=0xCB Down=0xCD Fire=0x39");
+ port_insert_custom (1, 0, 0, L"Left=0x48 Right=0x50 Up=0x4B Down=0x4D Fire=0x4C");
+ } else if (cnt == 1000) {
+ TCHAR out[256];
+ bool port_get_custom (int inputmap_port, TCHAR *out);
+ port_get_custom (0, out);
+ port_get_custom (1, out);
+ }
+#endif
if (currprefs.m68k_speed < 0) {
if (vpos + 1 == maxvpos + lof_store) {
/* really last line, just run the cpu emulation until whole vsync time has been used */
vsyncmintime = vsyncmaxtime; /* emulate if still time left */
} else {
/* end of scanline, run cpu emulation as long as we still have time */
- vsyncmintime += (vsynctimebase * (100 - currprefs.m68k_speed_throttle)) / (maxvpos_nom * 100);
+ vsyncmintime += (vsynctimebase * (1000 + currprefs.m68k_speed_throttle)) / (maxvpos_nom * 1000);
if (!vblank_found_chipset && (int)vsyncmaxtime - (int)vsyncmintime > 0) {
is_syncline = -1;
frame_time_t rpt = read_processor_time ();
}
}
} else {
-#if 0
- if (vpos + 1 < maxvpos + lof_store) {
- int mult = 90;
+ if (vpos + 1 < maxvpos + lof_store && (vpos == maxvpos_nom * 1 / 3 || vpos == maxvpos_nom * 2 / 3)) {
frame_time_t rpt = read_processor_time ();
- vsyncmintime += (vsynctimebase * mult) / (maxvpos_nom * 100);
- if ((int)vsyncmintime - (int)vsyncmaxtime > 0)
- vsyncmintime = vsyncmaxtime;
+ vsyncmintime += vsynctimebase / 3;
// sleep if more than 2ms "free" time
if (!vblank_found_chipset && (int)vsyncmintime - (int)(rpt + vsynctimebase / 10) > 0) {
sleep_millis_main (1);
}
}
-#endif
}
long cycles_to_hsync_event;
unsigned long start_cycles;
-frame_time_t vsynctimebase, vsyncmintime, vsyncmaxtime;
+frame_time_t vsynctimebase, vsyncmintime, vsyncmaxtime, vsyncwaittime;
void events_schedule (void)
{
if (unit->volflags & MYVOLUMEINFO_ARCHIVE)
zfile_stat_archive (aino->nname, &statbuf);
else if (unit->volflags & MYVOLUMEINFO_CDFS)
- isofs_stat (unit->cdfs_superblock, aino->uniq_external, &statbuf);
+ isofs_stat (unit->ui.cdfs_superblock, aino->uniq_external, &statbuf);
else
stat (aino->nname, &statbuf);
#include "machdep/rpt.h"
-extern frame_time_t vsynctimebase, vsyncmintime, vsyncmaxtime;
+extern frame_time_t vsynctimebase, vsyncmintime, vsyncmaxtime, vsyncwaittime;
extern void reset_frame_rate_hack (void);
extern frame_time_t syncbase;
extern unsigned long int vsync_cycles;
int (*get_widget_first)(int,int);
int (*get_flags)(int);
};
-extern struct inputdevice_functions idev[3];
extern struct inputdevice_functions inputdevicefunc_joystick;
extern struct inputdevice_functions inputdevicefunc_mouse;
extern struct inputdevice_functions inputdevicefunc_keyboard;
#define ID_AXIS_TOTAL 32
extern int inputdevice_iterate (int devnum, int num, TCHAR *name, int *af);
-extern bool inputdevice_set_gameports_mapping (struct uae_prefs *prefs, int devnum, int num, const TCHAR *name, int port);
+extern bool inputdevice_set_gameports_mapping (struct uae_prefs *prefs, int devnum, int num, int evtnum, int port);
extern int inputdevice_set_mapping (int devnum, int num, const TCHAR *name, TCHAR *custom, int flags, int port, int sub);
extern int inputdevice_get_mapping (int devnum, int num, int *pflags, int *port, TCHAR *name, TCHAR *custom, int sub);
extern void inputdevice_copyconfig (const struct uae_prefs *src, struct uae_prefs *dst);
extern void inputdevice_testrecord (int type, int num, int wtype, int wnum, int state);
extern int inputdevice_get_compatibility_input (struct uae_prefs*, int, int*, int**, int**);
extern struct inputevent *inputdevice_get_eventinfo (int evt);
-extern void inputdevice_get_eventname (const struct inputevent *ie, TCHAR *out);
-extern void inputdevice_compa_prepare_custom (struct uae_prefs *prefs, int index);
+extern bool inputdevice_get_eventname (const struct inputevent *ie, TCHAR *out);
+extern void inputdevice_compa_prepare_custom (struct uae_prefs *prefs, int index, int mode);
extern void inputdevice_compa_clear (struct uae_prefs *prefs, int index);
extern int intputdevice_compa_get_eventtype (int evt, int **axistable);
TCHAR commands[256];
};
+#define APMODE_NATIVE 0
+#define APMODE_RTG 1
+
struct apmode
{
int gfx_fullscreen;
+ int gfx_display;
+ TCHAR gfx_display_name[256];
int gfx_vsync;
// 0 = immediate flip
// -1 = wait for flip, before frame ends
bool avoid_cmov;
- int gfx_display;
- TCHAR gfx_display_name[256];
int gfx_framerate, gfx_autoframerate;
struct wh gfx_size_win;
struct wh gfx_size_fs;
static int handle_input_event (int nr, int state, int max, int autofire, bool canstoprecord, bool playbackevent);
+static struct inputdevice_functions idev[3];
static int isdevice (struct uae_input_device *id)
{
#define INPUT_QUEUE_SIZE 16
struct input_queue_struct {
- int event, storedstate, state, max, linecnt, nextlinecnt;
+ int evt, storedstate, state, max, linecnt, nextlinecnt;
+ TCHAR *custom;
};
static struct input_queue_struct input_queue[INPUT_QUEUE_SIZE];
}
return false;
}
+ if (custom)
+ ie = &events[INPUTEVENT_SPC_CUSTOM_EVENT];
+
if (joystick < 0) {
if (!(ie->allow_mask & AM_K))
return false;
} while (handle_msgpump ());
}
+static int handle_custom_event (TCHAR *custom)
+{
+ TCHAR *p, *buf, *nextp;
+
+ if (custom == NULL)
+ return 0;
+ //write_log (_T("%s\n"), custom);
+ p = buf = my_strdup (custom);
+ while (p && *p) {
+ TCHAR *p2;
+ if (*p != '\"')
+ break;
+ p++;
+ p2 = p;
+ while (*p2 != '\"' && *p2 != 0)
+ p2++;
+ if (*p2 == '\"') {
+ *p2++ = 0;
+ nextp = p2 + 1;
+ while (*nextp == ' ')
+ nextp++;
+ }
+ cfgfile_parse_line (&changed_prefs, p, 0);
+ p = nextp;
+ }
+ xfree (buf);
+ config_changed = 1;
+ return 0;
+}
+
void inputdevice_hsync (void)
{
static int cnt;
iq->state = 0;
else
iq->state = iq->storedstate;
- handle_input_event (iq->event, iq->state, iq->max, 0, false, true);
+ if (iq->custom)
+ handle_custom_event (iq->custom);
+ if (iq->evt)
+ handle_input_event (iq->evt, iq->state, iq->max, 0, false, true);
iq->linecnt = iq->nextlinecnt;
}
}
return v;
}
-static int check_input_queue (int event)
+static int check_input_queue (int evt)
{
struct input_queue_struct *iq;
int i;
for (i = 0; i < INPUT_QUEUE_SIZE; i++) {
iq = &input_queue[i];
- if (iq->event == event)
+ if (iq->evt == evt)
return i;
}
return -1;
}
-static void queue_input_event (int event, int state, int max, int linecnt, int autofire)
+static void queue_input_event (int evt, const TCHAR *custom, int state, int max, int linecnt, int autofire)
{
struct input_queue_struct *iq;
- int i = check_input_queue (event);
+ int idx = check_input_queue (evt);
- if (event <= 0)
- return;
- if (state < 0 && i >= 0) {
- iq = &input_queue[i];
+ if (state < 0 && idx >= 0) {
+ iq = &input_queue[idx];
iq->nextlinecnt = -1;
iq->linecnt = -1;
- iq->event = 0;
- if (iq->state == 0)
- handle_input_event (event, 0, 1, 0, false, false);
- } else if (state >= 0 && i < 0) {
- for (i = 0; i < INPUT_QUEUE_SIZE; i++) {
- iq = &input_queue[i];
+ iq->evt = 0;
+ if (iq->state == 0 && evt > 0)
+ handle_input_event (evt, 0, 1, 0, false, false);
+ } else if (state >= 0 && idx < 0) {
+ if (evt == 0 && custom == NULL)
+ return;
+ for (idx = 0; idx < INPUT_QUEUE_SIZE; idx++) {
+ iq = &input_queue[idx];
if (iq->linecnt < 0)
break;
}
- if (i == INPUT_QUEUE_SIZE) {
+ if (idx == INPUT_QUEUE_SIZE) {
write_log (_T("input queue overflow\n"));
return;
}
- iq->event = event;
+ xfree (iq->custom);
+ iq->custom = NULL;
+ if (custom)
+ iq->custom = my_strdup (custom);
+ iq->evt = evt;
iq->state = iq->storedstate = state;
iq->max = max;
iq->linecnt = linecnt;
}
}
-static int handle_custom_event (TCHAR *custom)
-{
- TCHAR *p, *buf, *nextp;
-
- if (custom == NULL)
- return 0;
- //write_log (_T("%s\n"), custom);
- p = buf = my_strdup (custom);
- while (p && *p) {
- TCHAR *p2;
- if (*p != '\"')
- break;
- p++;
- p2 = p;
- while (*p2 != '\"' && *p2 != 0)
- p2++;
- if (*p2 == '\"') {
- *p2++ = 0;
- nextp = p2 + 1;
- while (*nextp == ' ')
- nextp++;
- }
- cfgfile_parse_line (&changed_prefs, p, 0);
- p = nextp;
- }
- xfree (buf);
- config_changed = 1;
- return 0;
-}
-
static int isqual (int evt)
{
if (evt > INPUTEVENT_SPC_QUALIFIER_START && evt < INPUTEVENT_SPC_QUALIFIER_END)
write_log (_T("STATE=%05d MAX=%05d AF=%d QUAL=%08x '%s' \n"), state, max, autofire, qualifiers, ie->name);
if (autofire) {
if (state)
- queue_input_event (nr, state, max, currprefs.input_autofire_linecnt, 1);
+ queue_input_event (nr, NULL, state, max, currprefs.input_autofire_linecnt, 1);
else
- queue_input_event (nr, -1, 0, 0, 1);
+ queue_input_event (nr, NULL, -1, 0, 0, 1);
}
switch (ie->unit)
{
return mask;
}
-static void process_custom_event (struct uae_input_device *id, int offset, int state, int qualmask)
+static void process_custom_event (struct uae_input_device *id, int offset, int state, int qualmask, int autofire)
{
int idx, slotoffset, flags, custompos;
TCHAR *custom;
handle_custom_event (custom);
+ if (autofire)
+ queue_input_event (-1, custom, 1, 1, currprefs.input_autofire_linecnt, 1);
+ if (!state)
+ queue_input_event (-1, NULL, -1, 0, 0, 1);
+
+
id->flags[offset][slotoffset] &= ~ID_FLAG_CUSTOMEVENT_TOGGLED;
id->flags[offset][slotoffset] |= custompos ? ID_FLAG_CUSTOMEVENT_TOGGLED : 0;
}
if (!checkqualifiers (evt, flags, qualmask))
continue;
handle_input_event (evt, 1, 1, 0, true, false);
- queue_input_event (evt, 0, 1, 1, 0); /* send release event next frame */
- if (i == 0)
- process_custom_event (id, ID_BUTTON_OFFSET + button, state, qualmask);
+ queue_input_event (evt, NULL, 0, 1, 1, 0); /* send release event next frame */
+ process_custom_event (id, ID_BUTTON_OFFSET + button, state, qualmask, 0);
} else if (inverttoggle) {
/* pressed = firebutton, not pressed = autofire */
if (state) {
- queue_input_event (evt, -1, 0, 0, 1);
+ queue_input_event (evt, NULL, -1, 0, 0, 1);
handle_input_event (evt, 1, 1, 0, true, false);
} else {
handle_input_event (evt, 1, 1, autofire, true, false);
}
if (i == 0)
- process_custom_event (id, ID_BUTTON_OFFSET + button, 1, qualmask);
+ process_custom_event (id, ID_BUTTON_OFFSET + button, 1, qualmask, autofire);
} else if (toggle) {
if (!state)
continue;
int toggled = (*flagsp & ID_FLAG_TOGGLED) ? 1 : 0;
handle_input_event (evt, toggled, 1, autofire, true, false);
if (i == 0)
- process_custom_event (id, ID_BUTTON_OFFSET + button, toggled, qualmask);
+ process_custom_event (id, ID_BUTTON_OFFSET + button, toggled, qualmask, autofire);
} else {
if (!checkqualifiers (evt, flags, qualmask)) {
if (!state && !(flags & ID_FLAG_CANRELEASE))
if ((omask ^ nmask) & mask) {
handle_input_event (evt, state, 1, autofire, true, false);
if (i == 0)
- process_custom_event (id, ID_BUTTON_OFFSET + button, state, qualmask);
+ process_custom_event (id, ID_BUTTON_OFFSET + button, state, qualmask, autofire);
}
}
}
int inputdevice_get_compatibility_input (struct uae_prefs *prefs, int index, int *typelist, int **inputlist, int **at)
{
+ //write_log (L"index=%d joymodes=%d\n", index, joymodes[index]);
if (index >= MAX_JPORTS || joymodes[index] < 0)
return 0;
*typelist = joymodes[index];
}
// prepare port for custom mapping, remove all current Amiga side device mappings
-void inputdevice_compa_prepare_custom (struct uae_prefs *prefs, int index)
+void inputdevice_compa_prepare_custom (struct uae_prefs *prefs, int index, int newmode)
{
int mode = prefs->jports[index].mode;
freejport (prefs, index);
resetjport (prefs, index);
- if (mode == 0)
+ if (newmode >= 0) {
+ mode = newmode;
+ } else if (mode == 0) {
mode = index == 0 ? JSEM_MODE_MOUSE : (prefs->cs_cd32cd ? JSEM_MODE_JOYSTICK_CD32 : JSEM_MODE_JOYSTICK);
+ }
prefs->jports[index].mode = mode;
prefs->jports[index].id = -2;
}
}
-bool inputdevice_set_gameports_mapping (struct uae_prefs *prefs, int devnum, int num, const TCHAR *name, int port)
+bool inputdevice_set_gameports_mapping (struct uae_prefs *prefs, int devnum, int num, int evtnum, int port)
{
+ TCHAR name[256];
+ struct inputevent *ie;
+
+ ie = inputdevice_get_eventinfo (evtnum);
+ if (!inputdevice_get_eventname (ie, name))
+ return false;
joysticks = prefs->joystick_settings[GAMEPORT_INPUT_SETTINGS];
mice = prefs->mouse_settings[GAMEPORT_INPUT_SETTINGS];
keyboards = prefs->keyboard_settings[GAMEPORT_INPUT_SETTINGS];
if (inverttoggle) {
na->flags[j][sublevdir[state == 0 ? 1 : 0][k]] &= ~ID_FLAG_TOGGLED;
if (state) {
- queue_input_event (evt, -1, 0, 0, 1);
+ queue_input_event (evt, NULL, -1, 0, 0, 1);
handled |= handle_input_event (evt, 1, 1, 0, true, false);
} else {
handled |= handle_input_event (evt, 1, 1, autofire, true, false);
}
+ if (k == 0)
+ process_custom_event (na, j, state, qualmask, autofire);
} else if (toggle) {
if (!state)
continue;
*flagsp ^= ID_FLAG_TOGGLED;
toggled = (*flagsp & ID_FLAG_TOGGLED) ? 1 : 0;
handled |= handle_input_event (evt, toggled, 1, autofire, true, false);
+ if (k == 0)
+ process_custom_event (na, j, state, qualmask, autofire);
} else {
if (!checkqualifiers (evt, flags, qualmask)) {
if (!state && !(flags & ID_FLAG_CANRELEASE))
else
*flagsp &= ~ID_FLAG_CANRELEASE;
handled |= handle_input_event (evt, state, 1, autofire, true, false);
-
+ if (k == 0)
+ process_custom_event (na, j, state, qualmask, autofire);
}
}
- process_custom_event (na, j, state, qualmask);
return handled;
}
j++;
inputdevice_translatekeycode_2 (keyboard, scancode, state, true);
}
-static struct inputdevice_functions idev[3];
-
void inputdevice_init (void)
{
idev[IDTYPE_JOYSTICK] = inputdevicefunc_joystick;
{
struct uae_input_device *uid = get_uid (id, devnum);
int type = id->get_widget_type (devnum, num, 0, 0);
- int i;
+ int i, ret;
+
+ ret = -1;
if (type == IDEV_WIDGET_BUTTON || type == IDEV_WIDGET_BUTTONAXIS) {
i = num - id->get_widget_first (devnum, IDEV_WIDGET_BUTTON) + ID_BUTTON_OFFSET;
uid->eventid[i][sub] = eventid;
uid->port[i][sub] = port;
xfree (uid->custom[i][sub]);
uid->custom[i][sub] = custom && _tcslen (custom) > 0 ? my_strdup (custom) : NULL;
- return i;
+ ret = i;
} else if (type == IDEV_WIDGET_AXIS) {
i = num - id->get_widget_first (devnum, type) + ID_AXIS_OFFSET;
uid->eventid[i][sub] = eventid;
uid->port[i][sub] = port;
xfree (uid->custom[i][sub]);
uid->custom[i][sub] = custom && _tcslen (custom) > 0 ? my_strdup (custom) : NULL;
- return i;
+ ret = i;
} else if (type == IDEV_WIDGET_KEY) {
i = num - id->get_widget_first (devnum, type);
uid->eventid[i][sub] = eventid;
uid->port[i][sub] = port;
xfree (uid->custom[i][sub]);
uid->custom[i][sub] = custom && _tcslen (custom) > 0 ? my_strdup (custom) : NULL;
- return i;
+ ret = i;
}
- return -1;
+ if (ret < 0)
+ return -1;
+ if (uid->custom[i][sub])
+ uid->eventid[i][sub] = INPUTEVENT_SPC_CUSTOM_EVENT;
+ return ret;
}
static int is_event_used (const struct inputdevice_functions *id, int devnum, int isnum, int isevent)
}
// return name of event, do not use ie->name directly
-void inputdevice_get_eventname (const struct inputevent *ie, TCHAR *out)
+bool inputdevice_get_eventname (const struct inputevent *ie, TCHAR *out)
{
if (!out)
- return;
+ return false;
_tcscpy (out, ie->name);
+ return true;
}
int inputdevice_iterate (int devnum, int num, TCHAR *name, int *af)
/* special */
+DEFEVENT(SPC_CUSTOM_EVENT,_T("<Custom Event>"),AM_K,0,0,0)
DEFEVENT(SPC_ENTERGUI,_T("Enter GUI"),AM_K,0,0,AKS_ENTERGUI)
DEFEVENT(SPC_SCREENSHOT,_T("Screenshot (file)"),AM_K,0,0,AKS_SCREENSHOT_FILE)
DEFEVENT(SPC_SCREENSHOT_CLIPBOARD,_T("Screenshot (clipboard)"),AM_K,0,0,AKS_SCREENSHOT_CLIPBOARD)
regs.irc = get_word (m68k_getpc () + 2);
}
-static unsigned long cycles_mask, cycles_val, cycles_shift;
+#define CYCLES_DIV 8192
+static unsigned long cycles_mult;
static void update_68k_cycles (void)
{
- cycles_mask = 0;
- cycles_shift = 0;
- cycles_val = currprefs.m68k_speed;
- if (currprefs.m68k_speed < 1) {
- cycles_mask = 0xFFFFFFFF;
- cycles_val = 0;
+ cycles_mult = 0;
+ if (currprefs.m68k_speed >= 0 && !currprefs.cpu_cycle_exact) {
+ if (currprefs.m68k_speed_throttle < 0) {
+ cycles_mult = CYCLES_DIV * 1000 / (1000 + currprefs.m68k_speed_throttle);
+ } else if (currprefs.m68k_speed_throttle > 0) {
+ cycles_mult = CYCLES_DIV * 1000 / (1000 + currprefs.m68k_speed_throttle);
+ }
}
if (currprefs.m68k_speed == 0 && currprefs.cpu_model >= 68020) {
- cycles_shift = 2;
- cycles_val = CYCLE_UNIT / 2;
- cycles_mask = ~((CYCLE_UNIT / 2) - 1);
+ if (!cycles_mult)
+ cycles_mult = CYCLES_DIV / 4;
+ else
+ cycles_mult /= 4;
}
+
currprefs.cpu_clock_multiplier = changed_prefs.cpu_clock_multiplier;
currprefs.cpu_frequency = changed_prefs.cpu_frequency;
}
if (changed
|| currprefs.m68k_speed != changed_prefs.m68k_speed
+ || currprefs.m68k_speed_throttle != changed_prefs.m68k_speed_throttle
|| currprefs.cpu_clock_multiplier != changed_prefs.cpu_clock_multiplier
|| currprefs.cpu_frequency != changed_prefs.cpu_frequency) {
currprefs.m68k_speed = changed_prefs.m68k_speed;
+ currprefs.m68k_speed_throttle = changed_prefs.m68k_speed_throttle;
update_68k_cycles ();
changed = true;
}
#endif
+STATIC_INLINE int adjust_cycles (int cycles)
+{
+ if (currprefs.m68k_speed < 0 || cycles_mult == 0)
+ return cycles;
+ cpu_cycles *= cycles_mult;
+ cpu_cycles /= CYCLES_DIV;
+ return cpu_cycles;
+}
+
#ifndef CPUEMU_11
static void m68k_run_1 (void)
#endif
do_cycles (cpu_cycles);
cpu_cycles = (*cpufunctbl[opcode])(opcode);
- cpu_cycles &= cycles_mask;
- cpu_cycles |= cycles_val;
+ cpu_cycles = adjust_cycles (cpu_cycles);
if (r->spcflags) {
if (do_specialties (cpu_cycles))
return;
{
uae_u16 opcode = get_iword (0);
cpu_cycles = (*cpufunctbl[opcode])(opcode);
-
- cpu_cycles &= cycles_mask;
- cpu_cycles |= cycles_val;
-
+ cpu_cycles = adjust_cycles (cpu_cycles);
do_cycles (cpu_cycles);
if (end_block (opcode) || r->spcflags || uae_int_requested)
pc_hist[blocklen].location = (uae_u16*)r->pc_p;
cpu_cycles = (*cpufunctbl[opcode])(opcode);
-
- cpu_cycles &= cycles_mask;
- cpu_cycles |= cycles_val;
+ cpu_cycles = adjust_cycles (cpu_cycles);
do_cycles (cpu_cycles);
total_cycles += cpu_cycles;
pc_hist[blocklen].specmem = special_mem;
count_instr (opcode);
do_cycles (cpu_cycles);
cpu_cycles = (*cpufunctbl[opcode])(opcode);
- cpu_cycles &= cycles_mask;
- cpu_cycles |= cycles_val;
+ cpu_cycles = adjust_cycles (cpu_cycles);
if (regs.spcflags) {
if (do_specialties (cpu_cycles))
return;
count_instr (opcode);
cpu_cycles = (*cpufunctbl[opcode])(opcode);
- cpu_cycles >>= cycles_shift;
- cpu_cycles &= cycles_mask;
- cpu_cycles |= cycles_val;
+ cpu_cycles = adjust_cycles (cpu_cycles);
if (r->spcflags) {
if (do_specialties (cpu_cycles))
return;
#endif
do_cycles (cpu_cycles);
cpu_cycles = (*cpufunctbl[opcode])(opcode);
- cpu_cycles >>= cycles_shift;
- cpu_cycles &= cycles_mask;
- cpu_cycles |= cycles_val;
+ cpu_cycles = adjust_cycles (cpu_cycles);
if (r->spcflags) {
if (do_specialties (cpu_cycles))
return;
do_cycles (cpu_cycles);
mmu_backup_regs = regs;
cpu_cycles = (*cpufunctbl[opcode])(opcode);
- cpu_cycles >>= cycles_shift;
- cpu_cycles &= cycles_mask;
- cpu_cycles |= cycles_val;
+ cpu_cycles = adjust_cycles (cpu_cycles);
if (mmu_triggered)
mmu_do_hit ();
if (regs.spcflags) {
regs.caar = restore_u32 ();
regs.cacr = restore_u32 ();
regs.msp = restore_u32 ();
- /* A500 speed in 68020 mode isn't too logical.. */
- if (changed_prefs.m68k_speed == 0 && !(currprefs.cpu_cycle_exact))
- currprefs.m68k_speed = changed_prefs.m68k_speed = -1;
}
if (model >= 68030) {
crp_030 = restore_u64 ();
Project : RetroPlatform Player
Client : Cloanto Italia srl
Support : http://www.retroplatform.com
- Legal : Copyright 2007-2011 Cloanto Italia srl - All rights reserved. This
- : file is made available under the terms of the GNU General Public
- : License version 2 as published by the Free Software Foundation.
+ Legal : Copyright 2007-2012 Cloanto Italia srl - All rights reserved. This
+ : file is made available under the terms of the Mozilla Public License
+ : version 2.0 as published by Mozilla Corporation.
Authors : os, mcb
Created : 2007-08-27 13:55:49
- Updated : 2011-08-02 16:52:00
+ Updated : 2012-03-27 16:00:00
Comment : RP Player interprocess communication include file
*****************************************************************************/
#include <windows.h>
-#define RETROPLATFORM_API_VER "3.0"
+#define RETROPLATFORM_API_VER "3.2"
#define RETROPLATFORM_API_VER_MAJOR 3
-#define RETROPLATFORM_API_VER_MINOR 0
+#define RETROPLATFORM_API_VER_MINOR 2
#define RPIPC_HostWndClass "RetroPlatformHost%s"
#define RPIPC_GuestWndClass "RetroPlatformGuest%d"
// Guest-to-Host Messages
// ****************************************************************************
-#define RPIPCGM_REGISTER (WM_APP + 0)
-#define RPIPCGM_FEATURES (WM_APP + 1)
-#define RPIPCGM_CLOSED (WM_APP + 2)
-#define RPIPCGM_ACTIVATED (WM_APP + 3)
-#define RPIPCGM_DEACTIVATED (WM_APP + 4)
-#define RPIPCGM_ENABLED (WM_APP + 5)
-#define RPIPCGM_DISABLED (WM_APP + 6)
-#define RPIPCGM_SCREENMODE (WM_APP + 9)
-#define RPIPCGM_POWERLED (WM_APP + 10)
-#define RPIPCGM_DEVICES (WM_APP + 11)
-#define RPIPCGM_DEVICEACTIVITY (WM_APP + 12)
-#define RPIPCGM_MOUSECAPTURE (WM_APP + 13)
-#define RPIPCGM_HOSTAPIVERSION (WM_APP + 14)
-#define RPIPCGM_PAUSE (WM_APP + 15)
-#define RPIPCGM_TURBO (WM_APP + 17)
-#define RPIPCGM_PING (WM_APP + 18)
-#define RPIPCGM_VOLUME (WM_APP + 19)
-#define RPIPCGM_ESCAPED (WM_APP + 20)
-#define RPIPCGM_PARENT (WM_APP + 21)
-#define RPIPCGM_DEVICESEEK (WM_APP + 22)
-#define RPIPCGM_CLOSE (WM_APP + 23)
-#define RPIPCGM_DEVICEREADWRITE (WM_APP + 24)
-#define RPIPCGM_HOSTVERSION (WM_APP + 25)
-#define RPIPCGM_INPUTDEVICE (WM_APP + 26) // introduced in RetroPlatform API 3.0
-#define RPIPCGM_DEVICECONTENT (WM_APP + 27) // extended in RetroPlatform API 3.0
+#define RP_IPC_TO_HOST_REGISTER (WM_APP + 0)
+#define RP_IPC_TO_HOST_FEATURES (WM_APP + 1)
+#define RP_IPC_TO_HOST_CLOSED (WM_APP + 2)
+#define RP_IPC_TO_HOST_ACTIVATED (WM_APP + 3)
+#define RP_IPC_TO_HOST_DEACTIVATED (WM_APP + 4)
+#define RP_IPC_TO_HOST_ENABLED (WM_APP + 5)
+#define RP_IPC_TO_HOST_DISABLED (WM_APP + 6)
+#define RP_IPC_TO_HOST_SCREENMODE (WM_APP + 9)
+#define RP_IPC_TO_HOST_POWERLED (WM_APP + 10)
+#define RP_IPC_TO_HOST_DEVICES (WM_APP + 11)
+#define RP_IPC_TO_HOST_DEVICEACTIVITY (WM_APP + 12)
+#define RP_IPC_TO_HOST_MOUSECAPTURE (WM_APP + 13)
+#define RP_IPC_TO_HOST_HOSTAPIVERSION (WM_APP + 14)
+#define RP_IPC_TO_HOST_PAUSE (WM_APP + 15)
+#define RP_IPC_TO_HOST_TURBO (WM_APP + 17)
+#define RP_IPC_TO_HOST_PING (WM_APP + 18)
+#define RP_IPC_TO_HOST_VOLUME (WM_APP + 19)
+#define RP_IPC_TO_HOST_ESCAPED (WM_APP + 20)
+#define RP_IPC_TO_HOST_PARENT (WM_APP + 21)
+#define RP_IPC_TO_HOST_DEVICESEEK (WM_APP + 22)
+#define RP_IPC_TO_HOST_CLOSE (WM_APP + 23)
+#define RP_IPC_TO_HOST_DEVICEREADWRITE (WM_APP + 24)
+#define RP_IPC_TO_HOST_HOSTVERSION (WM_APP + 25)
+#define RP_IPC_TO_HOST_INPUTDEVICE (WM_APP + 26) // introduced in RetroPlatform API 3.0
+#define RP_IPC_TO_HOST_DEVICECONTENT (WM_APP + 27) // extended in RetroPlatform API 3.0
// ****************************************************************************
// Host-to-Guest Messages
// ****************************************************************************
-#define RPIPCHM_CLOSE (WM_APP + 200)
-#define RPIPCHM_SCREENMODE (WM_APP + 202)
-#define RPIPCHM_SCREENCAPTURE (WM_APP + 203)
-#define RPIPCHM_PAUSE (WM_APP + 204)
-#define RPIPCHM_RESET (WM_APP + 206)
-#define RPIPCHM_TURBO (WM_APP + 207)
-#define RPIPCHM_PING (WM_APP + 208)
-#define RPIPCHM_VOLUME (WM_APP + 209)
-#define RPIPCHM_ESCAPEKEY (WM_APP + 210)
-#define RPIPCHM_EVENT (WM_APP + 211)
-#define RPIPCHM_MOUSECAPTURE (WM_APP + 212)
-#define RPIPCHM_SAVESTATE (WM_APP + 213)
-#define RPIPCHM_LOADSTATE (WM_APP + 214)
-#define RPIPCHM_FLUSH (WM_APP + 215)
-#define RPIPCHM_DEVICEREADWRITE (WM_APP + 216)
-#define RPIPCHM_QUERYSCREENMODE (WM_APP + 217)
-#define RPIPCHM_GUESTAPIVERSION (WM_APP + 218) // introduced in RetroPlatform API 3.0
-#define RPIPCHM_DEVICECONTENT (WM_APP + 219) // extended in RetroPlatform API 3.0
+#define RP_IPC_TO_GUEST_CLOSE (WM_APP + 200)
+#define RP_IPC_TO_GUEST_SCREENMODE (WM_APP + 202)
+#define RP_IPC_TO_GUEST_SCREENCAPTURE (WM_APP + 203)
+#define RP_IPC_TO_GUEST_PAUSE (WM_APP + 204)
+#define RP_IPC_TO_GUEST_RESET (WM_APP + 206)
+#define RP_IPC_TO_GUEST_TURBO (WM_APP + 207)
+#define RP_IPC_TO_GUEST_PING (WM_APP + 208)
+#define RP_IPC_TO_GUEST_VOLUME (WM_APP + 209)
+#define RP_IPC_TO_GUEST_ESCAPEKEY (WM_APP + 210)
+#define RP_IPC_TO_GUEST_EVENT (WM_APP + 211)
+#define RP_IPC_TO_GUEST_MOUSECAPTURE (WM_APP + 212)
+#define RP_IPC_TO_GUEST_SAVESTATE (WM_APP + 213)
+#define RP_IPC_TO_GUEST_LOADSTATE (WM_APP + 214)
+#define RP_IPC_TO_GUEST_FLUSH (WM_APP + 215)
+#define RP_IPC_TO_GUEST_DEVICEREADWRITE (WM_APP + 216)
+#define RP_IPC_TO_GUEST_QUERYSCREENMODE (WM_APP + 217)
+#define RP_IPC_TO_GUEST_GUESTAPIVERSION (WM_APP + 218) // introduced in RetroPlatform API 3.0
+#define RP_IPC_TO_GUEST_DEVICECONTENT (WM_APP + 219) // extended in RetroPlatform API 3.0
// ****************************************************************************
// Message Data Structures and Defines
#define RP_FEATURE_SCREEN3X 0x00000008 // 3x mode is available
#define RP_FEATURE_SCREEN4X 0x00000010 // 4x mode is available
#define RP_FEATURE_FULLSCREEN 0x00000020 // fullscreen display is available
-#define RP_FEATURE_SCREENCAPTURE 0x00000040 // screen capture functionality is available (see RPIPCHM_SCREENCAPTURE message)
-#define RP_FEATURE_PAUSE 0x00000080 // pause functionality is available (see RPIPCHM_PAUSE message)
-#define RP_FEATURE_TURBO 0x00000100 // turbo mode functionality is available (see RPIPCHM_TURBO message)
-#define RP_FEATURE_VOLUME 0x00000200 // volume adjustment is possible (see RPIPCHM_VOLUME message)
-#define RP_FEATURE_STATE 0x00000400 // loading and saving of emulation state is supported (see RPIPCHM_SAVESTATE/RPIPCHM_LOADSTATE message)
+#define RP_FEATURE_SCREENCAPTURE 0x00000040 // screen capture functionality is available (see RP_IPC_TO_GUEST_SCREENCAPTURE message)
+#define RP_FEATURE_PAUSE 0x00000080 // pause functionality is available (see RP_IPC_TO_GUEST_PAUSE message)
+#define RP_FEATURE_TURBO 0x00000100 // turbo mode functionality is available (see RP_IPC_TO_GUEST_TURBO message)
+#define RP_FEATURE_VOLUME 0x00000200 // volume adjustment is possible (see RP_IPC_TO_GUEST_VOLUME message)
+#define RP_FEATURE_STATE 0x00000400 // loading and saving of emulation state is supported (see RP_IPC_TO_GUEST_SAVESTATE/RP_IPC_TO_GUEST_LOADSTATE message)
#define RP_FEATURE_SCANLINES 0x00000800 // scan lines video effect is available
#define RP_FEATURE_DEVICEREADWRITE 0x00001000 // device read/write can be set at runtime on floppy and hard disks
#define RP_FEATURE_SCALING_SUBPIXEL 0x00002000 // supports sub-pixel scaling of windowed and fullscreen modes (i.e. not just integer multipliers like 1X, 2X, etc., but stretch to fill any desired pixel size)
LONG lClipTop; // in guest pixel units; -1 = ignore (0 is a valid value)
LONG lClipWidth; // in guest pixel units; -1 = ignore
LONG lClipHeight; // in guest pixel units; -1 = ignore
- HWND hGuestWindow; // only valid for RPIPCGM_SCREENMODE
+ HWND hGuestWindow; // only valid for RP_IPC_TO_HOST_SCREENMODE
DWORD dwClipFlags; // clip flags (or 0)
LONG lTargetWidth; // in exact host pixels; if set, must also set lTargetHeight; ignored unless RP_SCREENMODE_SCALE_TARGET is set (resulting size is result of clipping and scaling); RP_SCREENMODE_SCALING_SUBPIXEL and RP_SCREENMODE_SCALING_STRETCH are taken into account
LONG lTargetHeight; // in exact host pixels, used with lTargetWidth
#define RP_SCREENMODE_SCALE_3X 0x00000002 // 3x window or fullscreen mode ("triple CGA mode")
#define RP_SCREENMODE_SCALE_4X 0x00000003 // 4x window or fullscreen mode ("double VGA mode")
#define RP_SCREENMODE_SCALE_TARGET 0x000000FE // scale to maximum within lTargetWidth/lTargetHeight (default: maximum possible integer multiplication, no subpixel stretching, preserve ratio; may change to non-integer mode depending on RP_SCREENMODE_SCALING_SUBPIXEL and RP_SCREENMODE_SCALING_STRETCH)
-#define RP_SCREENMODE_SCALE_MAX 0x000000FF // scale to auto-determined maximum size (default: maximum possible nX integer multiplication, no subpixel stretching, preserve ratio; may change to non-integer mode depending on RP_SCREENMODE_SCALING_SUBPIXEL and RP_SCREENMODE_SCALING_STRETCH); must be set in fullscreen modes
+#define RP_SCREENMODE_SCALE_MAX 0x000000FF // scale to auto-determined maximum size (default: maximum possible nX integer multiplication, no subpixel stretching, preserve ratio; may change to non-integer mode depending on RP_SCREENMODE_SCALING_SUBPIXEL and RP_SCREENMODE_SCALING_STRETCH); must be set in fullscreen (shared or exclusive) modes
#define RP_SCREENMODE_SCALEMASK 0x000000FF
#define RP_SCREENMODE_SCALE(m) ((m) & RP_SCREENMODE_SCALEMASK) // returns the #X mode
//
// In window mode, if no lTargetWidth and lTargetHeight are set, when the host asks for a change in clipping (net content size), the host window size will be adjusted taking into account the current integer multiplication factor.
//
-// In window mode, after a change of clipping or size, the player may have to reset the visual hilight of the 1X, 2X etc. buttons according to new RPIPCGM_SCREENMODE data (setting a hilight if the correct scaling button is present in the user interface, or removing all hilights if the corresponding button is missing).
+// In window mode, after a change of clipping or size, the player may have to reset the visual hilight of the 1X, 2X etc. buttons according to new RP_IPC_TO_HOST_SCREENMODE data (setting a hilight if the correct scaling button is present in the user interface, or removing all hilights if the corresponding button is missing).
//
-// RPInputDeviceDescription (used by initial host device enumeration via RPIPCGM_INPUTDEVICE, right after RPIPCGM_FEATURES and before RPIPCGM_SCREENMODE)
+// RPInputDeviceDescription (used by initial host device enumeration via RP_IPC_TO_HOST_INPUTDEVICE, right after RP_IPC_TO_HOST_FEATURES and before RP_IPC_TO_HOST_SCREENMODE)
typedef struct RPInputDeviceDescription
{
DWORD dwHostInputType; // host-side input device type (RP_HOSTINPUT_MOUSE, RP_HOSTINPUT_JOYSTICK, etc.)
- WCHAR szHostInputID[260]; // host device "ProductGUID InstanceGUID", GUID, etc. (can be any format, as long as string is unique across all devices)
+ WCHAR szHostInputID[260]; // host device "ProductGUID InstanceGUID", GUID, etc. (can be any format, as long as string is unique across all devices; keyboard layout strings must not contain spaces)
WCHAR szHostInputName[260]; // host device product description string ("5-Axis,12-Button with POV", "HID keyboard device", etc.) as listed by Windows; identical devices will result in identical strings (it is up to the host to add " (2)" etc. to the display names)
DWORD dwHostInputVendorID; // host device Vendor ID (identification as issued by usb.org and found in USB and DirectInput device descriptors), or 0 if not available
DWORD dwHostInputProductID; // host device Product ID (identification as assigned by manufacturer and used in USB and DirectInput device descriptors), or 0 if not available
} RPINPUTDEVICEDESCRIPTION;
-
-// RPDeviceContent (used by RPIPCGM_DEVICECONTENT and RPIPCHM_DEVICECONTENT)
+// RPDeviceContent (used by RP_IPC_TO_HOST_DEVICECONTENT and RP_IPC_TO_GUEST_DEVICECONTENT)
typedef struct RPDeviceContent
{
BYTE btDeviceNumber; // device number (range 0..31), e.g. Amiga floppy drive unit 0, C64 disk unit 8 or 9, etc.
DWORD dwInputDevice; // (guest-side) input device type (RP_INPUTDEVICE_MOUSE, RP_INPUTDEVICE_JOYSTICK, etc.); currently set to 0 if not RP_DEVICE_INPUTPORT
DWORD dwFlags; // flags (or 0); e.g. see RP_DEVICEFLAGS_MOUSE_ (for "mouse hack"), RP_DEVICEFLAGS_RW_ (for read/write status)
- WCHAR szContent[260]; // if RP_DEVICECATEGORY_INPUTPORT, then host device ID, otherwise full path and name of the media image file to load, if file content (not used for input devices, which only use szHostInputID); szContent is ignored if btDeviceCategory == RP_DEVICECATEGORY_INPUTPORT and dwInputDevice == RP_INPUTDEVICE_EMPTY
+ WCHAR szContent[260]; // if RP_DEVICECATEGORY_INPUTPORT, then host device ID, otherwise full path and name of the media image file to load, if file content (not used for input devices, which only use szHostInputID); see comment for format of KeyboardCustom string; szContent is ignored if btDeviceCategory == RP_DEVICECATEGORY_INPUTPORT and dwInputDevice == RP_INPUTDEVICE_EMPTY
} RPDEVICECONTENT;
+//
+// Keyboard layouts for joystick emulation
+//
+// These are virtual devices enumerated and named by the guest, rather than by the operating system. Any device name set by the guest will do, as long as it does not contain space characters.
+//
+// In the initial device enumeration (guest to host), the szHostInputID strings are enumerated with names like
+// "KeyboardLayout1", "KeyboardLayout2", "KeyboardLayout3" and "KeyboardCustom"
+//
+// In dwHostInputType:
+// - "KeyboardLayout1", "KeyboardLayout2", "KeyboardLayout3" are flagged
+// RP_HOSTINPUT_KEYJOY_MAP1, RP_HOSTINPUT_KEYJOY_MAP2, RP_HOSTINPUT_KEYJOY_MAP3
+// - "KeyboardCustom" is flagged RP_HOSTINPUT_KEYJOY_CUSTOM
+//
+// In RP_IPC_TO_GUEST_DEVICECONTENT (host to guest) messages, the key code strings are appended to the device string in szContent.
+// For example:
+// "KeyboardCustom Left=0xC8 Right=0xD0 Up=0xCB Down=0xCD Fire=0x39"
+//
+
+
// Device Categories
#define RP_DEVICECATEGORY_FLOPPY 0 // floppy disk drive
#define RP_DEVICECATEGORY_HD 1 // hard disk drive
#define RP_DEVICECATEGORY_TAPE 4 // cassette tape drive
#define RP_DEVICECATEGORY_CARTRIDGE 5 // expansion cartridge
#define RP_DEVICECATEGORY_INPUTPORT 6 // input port (hosts an INPUTDEVICE: mouse, joystick, joystick emulated via keyboard, etc.)
-#define RP_DEVICECATEGORY_COUNT 7 // total number of device categories
+#define RP_DEVICECATEGORY_KEYBOARD 7 // keyboard
+#define RP_DEVICECATEGORY_COUNT 8 // total number of device categories
-#define RP_ALL_DEVICES 32 // constant for the RPIPCGM_DEVICEACTIVITY message (to turn on/off all LEDs for a device category)
+#define RP_ALL_DEVICES 32 // constant for the RP_IPC_TO_HOST_DEVICEACTIVITY message (to turn on/off all LEDs for a device category)
// Host Input Device Types (used to enumerate host devices)
-#define RP_HOSTINPUT_MOUSE 0 // Mouse/trackball (supports relative moves)
-#define RP_HOSTINPUT_TABLET 1 // Pen tablet (no relative moves, only absolute positions)
-#define RP_HOSTINPUT_JOYSTICK 2 // PC joystick, gamepad, trackball, etc.
-#define RP_HOSTINPUT_KEYJOY_MAP1 3 // Keyboard Layout 1; Amiga/C64: Keyboard Layout A for WinUAE/VICE (numeric keypad, 0 to fire, etc.)
-#define RP_HOSTINPUT_KEYJOY_MAP2 4 // Keyboard Layout 2; Amiga/C64: Keyboard Layout B for WinUAE/VICE (cursor keys, right Control to fire, etc.)
-#define RP_HOSTINPUT_KEYJOY_MAP3 5 // Keyboard Layout 3; Amiga/C64: Keyboard Layout C for WinUAE/VICE (W, S, A, D keys, left Alt to fire, etc.)
-#define RP_HOSTINPUT_ARCADE_LEFT 6 // Left part of arcade dual joystick input device ("player 1")
-#define RP_HOSTINPUT_ARCADE_RIGHT 7 // Right part of arcade dual joystick input device ("player 2")
-#define RP_HOSTINPUT_COUNT 8 // total number of device types
+#define RP_HOSTINPUT_MOUSE 0 // Mouse/trackball (supports relative moves)
+#define RP_HOSTINPUT_TABLET 1 // Pen tablet (no relative moves, only absolute positions)
+#define RP_HOSTINPUT_JOYSTICK 2 // PC joystick, gamepad, trackball, etc.
+#define RP_HOSTINPUT_KEYJOY_MAP1 3 // Keyboard Layout 1; Amiga/C64: Keyboard Layout A for WinUAE/VICE (8, 2, 4, 6 on keypad, 0 to fire, etc.)
+#define RP_HOSTINPUT_KEYJOY_MAP2 4 // Keyboard Layout 2; Amiga/C64: Keyboard Layout B for WinUAE/VICE (cursor keys, right Control to fire, etc.)
+#define RP_HOSTINPUT_KEYJOY_MAP3 5 // Keyboard Layout 3; Amiga/C64: Keyboard Layout C for WinUAE/VICE (W, S, A, D keys, left Alt to fire, etc.)
+#define RP_HOSTINPUT_ARCADE_LEFT 6 // Left part of arcade dual joystick input device ("player 1")
+#define RP_HOSTINPUT_ARCADE_RIGHT 7 // Right part of arcade dual joystick input device ("player 2")
+#define RP_HOSTINPUT_KEYJOY_CUSTOM 8 // Custom Keyboard Layout (e.g. "KeyboardCustom Left=0xC8 Right=0xD0 Up=0xCB Down=0xCD Fire=0x39" set in szContent)
+#define RP_HOSTINPUT_COUNT 9 // total number of device types
// Host Input Device Flags
-#define RP_HOSTINPUTFLAGS_MOUSE_RAW 0x00000000 // Individual raw mouse device with no acceleration
+#define RP_HOSTINPUTFLAGS_MOUSE_RAW 0x00000000 // Individual raw mouse device with no acceleration (multi-mouse warning: RAW and SMART devices cannot be used simultaneously)
#define RP_HOSTINPUTFLAGS_MOUSE_SMART 0x00000001 // System pointer mouse with acceleration and aggregation of multiple devices
#define RP_HOSTINPUTFLAGS_MOUSEMASK 0x00000001
-#define RP_HOSTINPUTFLAGS_MOUSE(m) ((m) & RP_DEVICEFLAGS_MOUSEMASK) // returns RP_HOSTINPUTFLAGS_MOUSE_RAW or RP_HOSTINPUTFLAGS_MOUSE_SMART
+#define RP_HOSTINPUTFLAGS_MOUSE(m) ((m) & RP_HOSTINPUTFLAGS_MOUSEMASK) // returns RP_HOSTINPUTFLAGS_MOUSE_RAW or RP_HOSTINPUTFLAGS_MOUSE_SMART
// Guest Input Device Types (used to describe what the host side device is mapped to on the guest side)
#define RP_INPUTDEVICE_TABLET 8 // [currently unused] Pen tablet (no relative moves, only absolute positions); on Amiga: pressure support as per Electronic Arts Tablet.library
#define RP_INPUTDEVICE_COUNT 9 // total number of device types
-// Device Read/Write status (used in RPIPCGM_DEVICECONTENT, RPIPCHM_DEVICECONTENT; used for device categories RP_DEVICECATEGORY_FLOPPY, RP_DEVICECATEGORY_HD, RP_DEVICECATEGORY_TAPE, RP_DEVICECATEGORY_CARTRIDGE)
+// Device Read/Write status (used in RP_IPC_TO_HOST_DEVICECONTENT, RP_IPC_TO_GUEST_DEVICECONTENT; used for device categories RP_DEVICECATEGORY_FLOPPY, RP_DEVICECATEGORY_HD, RP_DEVICECATEGORY_TAPE, RP_DEVICECATEGORY_CARTRIDGE)
#define RP_DEVICEFLAGS_RW_READONLY 0x00000000 // the medium is write-protected
#define RP_DEVICEFLAGS_RW_READWRITE 0x00000001 // the medium is read/write
#define RP_DEVICEFLAGS_RWMASK 0x00000001
#define RP_JOYSTICK_BUTTON7 0x00000400 // button 7 - CDTV/CD32 Forward
-// Device Read/Write status (used in RPIPCGM_DEVICEREADWRITE, RPIPCHM_DEVICEREADWRITE; used for device categories RP_DEVICECATEGORY_FLOPPY, RP_DEVICECATEGORY_HD, RP_DEVICECATEGORY_TAPE, RP_DEVICECATEGORY_CARTRIDGE)
+// Device Read/Write status (used in RP_IPC_TO_HOST_DEVICEREADWRITE, RP_IPC_TO_GUEST_DEVICEREADWRITE; used for device categories RP_DEVICECATEGORY_FLOPPY, RP_DEVICECATEGORY_HD, RP_DEVICECATEGORY_TAPE, RP_DEVICECATEGORY_CARTRIDGE)
#define RP_DEVICE_READONLY 0 // the medium is write-protected
#define RP_DEVICE_READWRITE 1 // the medium is read/write
#define RP_RESET_SOFT 0 // soft reset
#define RP_RESET_HARD 1 // hard reset
-// RPIPCGM_MOUSECAPTURE/RPIPCHM_MOUSECAPTURE
+// RP_IPC_TO_HOST_MOUSECAPTURE/RP_IPC_TO_GUEST_MOUSECAPTURE
#define RP_MOUSECAPTURE_CAPTURED 0x00000001
#define RP_MOUSECAPTURE_MAGICMOUSE 0x00000002
-// RPIPCGM_DEVICEACTIVITY
+// RP_IPC_TO_HOST_DEVICEACTIVITY
#define RP_DEVICEACTIVITY_GREEN 0x0000 // green led
#define RP_DEVICEACTIVITY_RED 0x0001 // red led
#define RP_DEVICEACTIVITY_READ RP_DEVICEACTIVITY_GREEN // device activity is a read operation
#define RP_DEVICEACTIVITY_WRITE RP_DEVICEACTIVITY_RED // device activity is a write operation
-// RPIPCGM_HOSTVERSION
+// RP_IPC_TO_HOST_HOSTVERSION
// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
// +-----------------------+-------------------+-------------------+
// Legacy Compatibility (pre-3.0)
-#define RPIPCGM_DEVICECONTENT_LEGACY (WM_APP + 16)
-#define RPIPCHM_DEVICECONTENT_LEGACY (WM_APP + 205)
+#define RP_IPC_TO_HOST_DEVICECONTENT_LEGACY (WM_APP + 16)
+#define RP_IPC_TO_GUEST_DEVICECONTENT_LEGACY (WM_APP + 205)
#define RPLATFORM_API_VER RETROPLATFORM_API_VER
#define RPLATFORM_API_VER_MAJOR RETROPLATFORM_API_VER_MAJOR
#define RPLATFORM_API_VER_MINOR RETROPLATFORM_API_VER_MINOR
#define RP_DEVICE_INPUTPORT RP_DEVICECATEGORY_INPUTPORT
#define RP_DEVICE_CATEGORIES RP_DEVICECATEGORY_COUNT
// Legacy Host Side Input Port Devices
-#define RP_IPD_MOUSE1 _T("Mouse1") // \0\0-terminated first mouse type ("Mouse1\0\0" = default Windows mouse, or exact mouse described as "Mouse1\\\?\HID#VID_046D&PID_C521&MI_00#8&3b7afb0d&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd\0\0")
-#define RP_IPD_JOYSTICK1 _T("Joystick1") // \0\0-terminated first joystick type (e.g. standard joystick for WinUAE, described as "Joystick1\0ProductGUID InstanceGUID\0ProductName\0\0"); ProductName must be stripped of trailing spaces, if any
-#define RP_IPD_JOYSTICK2 _T("Joystick2") // \0\0-terminated second joystick type (e.g. X-Arcade (Left) joystick for WinUAE, described as "Joystick2\0ProductGUID InstanceGUID\0ProductName\0\0"); ProductName must be stripped of trailing spaces, if any
-#define RP_IPD_JOYSTICK3 _T("Joystick3") // \0\0-terminated third joystick type (e.g. X-Arcade (Right) joystick for WinUAE, described as "Joystick3\0ProductGUID InstanceGUID\0ProductName\0\0"); ProductName must be stripped of trailing spaces, if any
-#define RP_IPD_KEYBDL1 _T("KeyboardLayout1") // \0\0-terminated first joystick emulation keyboard layout (e.g. Keyboard Layout A for WinUAE)
-#define RP_IPD_KEYBDL2 _T("KeyboardLayout2") // \0\0-terminated second joystick emulation keyboard layout (e.g. Keyboard Layout B for WinUAE)
-#define RP_IPD_KEYBDL3 _T("KeyboardLayout3") // \0\0-terminated third joystick emulation keyboard layout (e.g. Keyboard Layout C for WinUAE)
+#define RP_IPD_MOUSE1 L"Mouse1" // \0\0-terminated first mouse type ("Mouse1\0\0" = default Windows mouse, or exact mouse described as "Mouse1\\\?\HID#VID_046D&PID_C521&MI_00#8&3b7afb0d&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd\0\0")
+#define RP_IPD_JOYSTICK1 L"Joystick1" // \0\0-terminated first joystick type (e.g. standard joystick for WinUAE, described as "Joystick1\0ProductGUID InstanceGUID\0ProductName\0\0"); ProductName must be stripped of trailing spaces, if any
+#define RP_IPD_JOYSTICK2 L"Joystick2" // \0\0-terminated second joystick type (e.g. X-Arcade (Left) joystick for WinUAE, described as "Joystick2\0ProductGUID InstanceGUID\0ProductName\0\0"); ProductName must be stripped of trailing spaces, if any
+#define RP_IPD_JOYSTICK3 L"Joystick3" // \0\0-terminated third joystick type (e.g. X-Arcade (Right) joystick for WinUAE, described as "Joystick3\0ProductGUID InstanceGUID\0ProductName\0\0"); ProductName must be stripped of trailing spaces, if any
+#define RP_IPD_KEYBDL1 L"KeyboardLayout1" // \0\0-terminated first joystick emulation keyboard layout (e.g. Keyboard Layout A for WinUAE)
+#define RP_IPD_KEYBDL2 L"KeyboardLayout2" // \0\0-terminated second joystick emulation keyboard layout (e.g. Keyboard Layout B for WinUAE)
+#define RP_IPD_KEYBDL3 L"KeyboardLayout3" // \0\0-terminated third joystick emulation keyboard layout (e.g. Keyboard Layout C for WinUAE)
+// Messages
+#define RPIPCGM_REGISTER RP_IPC_TO_HOST_REGISTER
+#define RPIPCGM_FEATURES RP_IPC_TO_HOST_FEATURES
+#define RPIPCGM_CLOSED RP_IPC_TO_HOST_CLOSED
+#define RPIPCGM_ACTIVATED RP_IPC_TO_HOST_ACTIVATED
+#define RPIPCGM_DEACTIVATED RP_IPC_TO_HOST_DEACTIVATED
+#define RPIPCGM_ENABLED RP_IPC_TO_HOST_ENABLED
+#define RPIPCGM_DISABLED RP_IPC_TO_HOST_DISABLED
+#define RPIPCGM_SCREENMODE RP_IPC_TO_HOST_SCREENMODE
+#define RPIPCGM_POWERLED RP_IPC_TO_HOST_POWERLED
+#define RPIPCGM_DEVICES RP_IPC_TO_HOST_DEVICES
+#define RPIPCGM_DEVICEACTIVITY RP_IPC_TO_HOST_DEVICEACTIVITY
+#define RPIPCGM_MOUSECAPTURE RP_IPC_TO_HOST_MOUSECAPTURE
+#define RPIPCGM_HOSTAPIVERSION RP_IPC_TO_HOST_HOSTAPIVERSION
+#define RPIPCGM_PAUSE RP_IPC_TO_HOST_PAUSE
+#define RPIPCGM_TURBO RP_IPC_TO_HOST_TURBO
+#define RPIPCGM_PING RP_IPC_TO_HOST_PING
+#define RPIPCGM_VOLUME RP_IPC_TO_HOST_VOLUME
+#define RPIPCGM_ESCAPED RP_IPC_TO_HOST_ESCAPED
+#define RPIPCGM_PARENT RP_IPC_TO_HOST_PARENT
+#define RPIPCGM_DEVICESEEK RP_IPC_TO_HOST_DEVICESEEK
+#define RPIPCGM_CLOSE RP_IPC_TO_HOST_CLOSE
+#define RPIPCGM_DEVICEREADWRITE RP_IPC_TO_HOST_DEVICEREADWRITE
+#define RPIPCGM_HOSTVERSION RP_IPC_TO_HOST_HOSTVERSION
+#define RPIPCGM_INPUTDEVICE RP_IPC_TO_HOST_INPUTDEVICE
+#define RPIPCGM_DEVICECONTENT RP_IPC_TO_HOST_DEVICECONTENT
+#define RPIPCHM_CLOSE RP_IPC_TO_GUEST_CLOSE
+#define RPIPCHM_SCREENMODE RP_IPC_TO_GUEST_SCREENMODE
+#define RPIPCHM_SCREENCAPTURE RP_IPC_TO_GUEST_SCREENCAPTURE
+#define RPIPCHM_PAUSE RP_IPC_TO_GUEST_PAUSE
+#define RPIPCHM_RESET RP_IPC_TO_GUEST_RESET
+#define RPIPCHM_TURBO RP_IPC_TO_GUEST_TURBO
+#define RPIPCHM_PING RP_IPC_TO_GUEST_PING
+#define RPIPCHM_VOLUME RP_IPC_TO_GUEST_VOLUME
+#define RPIPCHM_ESCAPEKEY RP_IPC_TO_GUEST_ESCAPEKEY
+#define RPIPCHM_EVENT RP_IPC_TO_GUEST_EVENT
+#define RPIPCHM_MOUSECAPTURE RP_IPC_TO_GUEST_MOUSECAPTURE
+#define RPIPCHM_SAVESTATE RP_IPC_TO_GUEST_SAVESTATE
+#define RPIPCHM_LOADSTATE RP_IPC_TO_GUEST_LOADSTATE
+#define RPIPCHM_FLUSH RP_IPC_TO_GUEST_FLUSH
+#define RPIPCHM_DEVICEREADWRITE RP_IPC_TO_GUEST_DEVICEREADWRITE
+#define RPIPCHM_QUERYSCREENMODE RP_IPC_TO_GUEST_QUERYSCREENMODE
+#define RPIPCHM_GUESTAPIVERSION RP_IPC_TO_GUEST_GUESTAPIVERSION
+#define RPIPCHM_DEVICECONTENT RP_IPC_TO_GUEST_DEVICECONTENT
+// End of Legacy Compatibility
#endif // __CLOANTO_RETROPLATFORMIPC_H__
static LPDIRECTDRAWSURFACE7 getlocksurface (void)
{
- if (dxdata.backbuffers > 0 && currprefs.gfx_apmode[0].gfx_fullscreen > 0 && !WIN32GFX_IsPicassoScreen ())
+ if (dxdata.backbuffers > 0 && currprefs.gfx_apmode[APMODE_NATIVE].gfx_fullscreen > 0 && !WIN32GFX_IsPicassoScreen ())
return dxdata.flipping[0];
return dxdata.secondary;
}
guid = NULL;
if (isfullscreen () > 0) {
- int disp = currprefs.gfx_display - 1;
+ MultiDisplay *md = getdisplay (&currprefs);
+ int disp = md - Displays;
if (disp < 0)
disp = 0;
if (disp >= MAX_DISPLAYS)
#define IDC_FLUSHPRINTER 1510
#define IDC_MAPDRIVES_REMOVABLE 1510
#define IDC_PORT0_TEST 1510
+#define IDC_CACHETEXT2 1510
#define IDC_SCREENRESTEXT 1511
#define IDC_MAPDRIVES_AUTO 1511
#define IDC_PORT0_TEST2 1511
CONTROL "More compatible [] More compatible but slower FPU emulation.",IDC_COMPATIBLE_FPU,\r
"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,9,221,73,10\r
GROUPBOX "CPU Emulation Speed",IDC_STATIC,90,3,205,92\r
- CONTROL "Fastest possible, but maintain chipset timing",IDC_CS_HOST,\r
- "Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_GROUP | WS_TABSTOP,95,18,195,10\r
- CONTROL "Approximate A500 or A500/A1200 cycle-exact",IDC_CS_68000,\r
+ CONTROL "Fastest possible",IDC_CS_HOST,"Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_GROUP | WS_TABSTOP,95,18,195,10\r
+ CONTROL "Approximate A500/A1200 or cycle-exact",IDC_CS_68000,\r
"Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_TABSTOP,95,32,195,10\r
- CONTROL "Adjustable between CPU and chipset",IDC_CS_ADJUSTABLE,\r
- "Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_TABSTOP,95,46,195,10\r
- RTEXT "CPU",IDC_STATIC,96,77,17,10,SS_CENTERIMAGE\r
- CONTROL "Slider1",IDC_SPEED,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,114,71,67,20\r
- RTEXT "Chipset",IDC_STATIC,182,77,26,9,SS_CENTERIMAGE\r
+ CONTROL "Slider1",IDC_SPEED,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,96,51,192,20\r
CONTROL "",IDC_CPUIDLE,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,219,71,69,20\r
- RTEXT "CPU Idle",IDC_STATIC,231,60,47,9,SS_CENTERIMAGE\r
+ CTEXT "CPU Idle",IDC_STATIC,179,76,35,9,SS_CENTERIMAGE\r
GROUPBOX "Cycle-exact CPU Emulation Speed",IDC_STATIC,90,99,205,46\r
RTEXT "CPU Frequency",IDC_STATIC,105,119,51,10,SS_CENTERIMAGE\r
COMBOBOX IDC_CPU_FREQUENCY,165,118,46,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
GROUPBOX "Advanced JIT Settings",IDC_STATIC,90,147,205,91\r
RTEXT "Cache size:",IDC_STATIC,95,167,42,10,SS_CENTERIMAGE\r
CONTROL "Slider1",IDC_CACHE,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,140,161,115,20\r
- EDITTEXT IDC_CACHETEXT,255,166,30,12,ES_CENTER | ES_READONLY\r
+ EDITTEXT IDC_CPUTEXT,144,75,30,12,ES_CENTER | ES_READONLY\r
CONTROL "Hard flush",IDC_HARDFLUSH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,100,194,63,10\r
CONTROL "No flags",IDC_NOFLAGS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,194,62,10\r
CONTROL "Direct",IDC_TRUST0,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,235,194,52,10\r
CONTROL "Constant jump",IDC_CONSTJUMP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,100,208,63,10\r
CONTROL "FPU support",IDC_JITFPU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,100,222,62,10\r
CONTROL "Indirect",IDC_TRUST1,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,235,208,52,10\r
+ EDITTEXT IDC_CACHETEXT2,265,175,30,12,ES_CENTER | ES_READONLY\r
+ CTEXT "CPU Speed",IDC_STATIC,93,76,43,9,SS_CENTERIMAGE\r
END\r
\r
IDD_FLOPPY DIALOGEX 0, 0, 300, 240\r
0, 0,
};
-static int port_insert (int num, int devicetype, DWORD flags, const TCHAR *name)
+#define KEYBOARDCUSTOM _T("KeyboardCustom ")
+
+struct rp_customevent
+{
+ const TCHAR *name;
+ int evt;
+};
+
+static const TCHAR *customeventorder[] = {
+ _T("Left"),
+ _T("Right"),
+ _T("Up"),
+ _T("Down"),
+ _T("Fire"),
+ NULL
+};
+
+bool port_get_custom (int inputmap_port, TCHAR *out)
+{
+ int kb;
+ bool first = true;
+ TCHAR *p = out;
+ int mode, *events, *axistable;
+ int max;
+
+ max = inputdevice_get_compatibility_input (&currprefs, inputmap_port, &mode, &events, &axistable);
+ if (!max)
+ return false;
+
+ _tcscpy (p, KEYBOARDCUSTOM);
+ p += _tcslen (p);
+ kb = inputdevice_get_device_total (IDTYPE_JOYSTICK) + inputdevice_get_device_total (IDTYPE_MOUSE);
+ for (int i = 0; customeventorder[i]; i++) {
+ int evtnum = events[i];
+ for (int j = 0; j < inputdevicefunc_keyboard.get_widget_num (kb); j++) {
+ int flags, port;
+ if (inputdevice_get_mapping (kb, j, &flags, &port, NULL, NULL, 0) == evtnum) {
+ if (port == inputmap_port + 1) {
+ uae_u32 kc = 0;
+ inputdevicefunc_keyboard.get_widget_type (kb, j, NULL, &kc);
+ if (!first)
+ *p++ = ' ';
+ first = false;
+ _stprintf (p, _T("%s=0x%02X"), customeventorder[i], kc);
+ p += _tcslen (p);
+ break;
+ }
+ }
+ }
+ }
+ write_log (L"********* -> %s\n", out);
+ return true;
+}
+
+int port_insert_custom (int inputmap_port, int devicetype, DWORD flags, const TCHAR *custom)
+{
+ const TCHAR *p = custom;
+ int mode, *events, *axistable;
+ int max, evtnum;
+ int kb;
+
+ kb = inputdevice_get_device_total (IDTYPE_JOYSTICK) + inputdevice_get_device_total (IDTYPE_MOUSE);
+
+ inputdevice_updateconfig (&changed_prefs);
+ inputdevice_compa_prepare_custom (&changed_prefs, inputmap_port, JSEM_MODE_JOYSTICK);
+ inputdevice_updateconfig (&changed_prefs);
+ max = inputdevice_get_compatibility_input (&changed_prefs, inputmap_port, &mode, &events, &axistable);
+ write_log (L"custom='%s' max=%d port=%d\n", custom, max, inputmap_port);
+ if (!max)
+ return FALSE;
+
+ while (p && p[0]) {
+ int idx = -1, kc = -1;
+ int wdnum = -1;
+ const TCHAR *p2 = _tcschr (p, '=');
+ if (!p2)
+ break;
+ for (int i = 0; customeventorder[i]; i++) {
+ if (!_tcsncmp (p, customeventorder[i], p2 - p)) {
+ idx = i;
+ break;
+ }
+ }
+ if (idx < 0 || idx > 4)
+ break;
+ p2++;
+ if (p2[0] == '0' && (p2[1] == 'x' || p2[1] == 'X'))
+ kc = _tcstol (p2 + 2, NULL, 16);
+ else
+ kc = _tstol (p2);
+ p = _tcschr (p2, ' ');
+ if (p)
+ p++;
+ if (kc < 0)
+ break;
+ evtnum = events[idx];
+
+ write_log (L"evt=%d kc=%d\n", evtnum, kc);
+
+ for (int j = 0; j < inputdevice_get_device_total (IDTYPE_KEYBOARD); j++) {
+ for (int i = 0; i < inputdevicefunc_keyboard.get_widget_num (kb + j); i++) {
+ uae_u32 kc2 = 0;
+ inputdevicefunc_keyboard.get_widget_type (kb + j, i, NULL, &kc2);
+ if (kc == kc2) {
+ wdnum = i;
+ break;
+ }
+ }
+ if (wdnum >= 0)
+ inputdevice_set_gameports_mapping (&changed_prefs, kb + j, wdnum, evtnum, inputmap_port);
+ }
+ }
+
+ inputdevice_updateconfig (&changed_prefs);
+ return TRUE;
+}
+
+static int port_insert (int inputmap_port, int devicetype, DWORD flags, const TCHAR *name)
{
int devicetype2;
- if (num < 0 || num >= maxjports)
+ write_log (L"port_insert %d '%s'\n", inputmap_port, name);
+
+ if (inputmap_port < 0 || inputmap_port >= maxjports)
return FALSE;
+
+ inputdevice_compa_clear (&changed_prefs, inputmap_port);
+
if (_tcslen (name) == 0) {
- inputdevice_joyport_config (&changed_prefs, _T("none"), num, 0, 0);
+ inputdevice_joyport_config (&changed_prefs, _T("none"), inputmap_port, 0, 0);
return TRUE;
}
devicetype2 = -1;
if (devicetype2 < 0)
return FALSE;
+ if (!_tcsncmp (name, KEYBOARDCUSTOM, _tcslen (KEYBOARDCUSTOM))) {
+ return port_insert_custom (inputmap_port, devicetype, flags, name + _tcslen (KEYBOARDCUSTOM));
+ }
+
for (int i = 0; i < 10; i++) {
TCHAR tmp2[100];
_stprintf (tmp2, _T("KeyboardLayout%d"), i);
if (!_tcscmp (tmp2, name)) {
_stprintf (tmp2, _T("kbd%d"), i + 1);
- return inputdevice_joyport_config (&changed_prefs, tmp2, num, devicetype2, 0);
+ return inputdevice_joyport_config (&changed_prefs, tmp2, inputmap_port, devicetype2, 0);
}
}
- return inputdevice_joyport_config (&changed_prefs, name, num, devicetype2, 1);
+ return inputdevice_joyport_config (&changed_prefs, name, inputmap_port, devicetype2, 1);
}
static int cd_insert (int num, const TCHAR *name)
}
if (full) {
m &= ~RP_SCREENMODE_DISPLAYMASK;
- m |= p->gfx_display << 8;
+ m |= p->gfx_apmode[APMODE_NATIVE].gfx_display << 8;
}
if (full > 1)
m |= RP_SCREENMODE_FULLWINDOW;
if (log_rp)
write_log (_T("GET_RPSM: %08X %dx%d %dx%d hres=%d (%d) vres=%d (%d) disp=%d fs=%d\n"),
sm->dwScreenMode, sm->lClipLeft, sm->lClipTop, sm->lClipWidth, sm->lClipHeight,
- totalhdbl, hres, totalvdbl, vres, p->gfx_display, full);
+ totalhdbl, hres, totalvdbl, vres, p->gfx_apmode[APMODE_NATIVE].gfx_display, full);
}
static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p)
storeflags = sm->dwScreenMode;
minimized = 0;
if (display) {
- p->gfx_display = display;
- p->gfx_display_name[0] = 0;
+ p->gfx_apmode[APMODE_NATIVE].gfx_display = display;
+ p->gfx_apmode[APMODE_NATIVE].gfx_display_name[0] = 0;
+ p->gfx_apmode[APMODE_RTG].gfx_display = display;
+ p->gfx_apmode[APMODE_RTG].gfx_display_name[0] = 0;
if (sm->dwScreenMode & RP_SCREENMODE_FULLWINDOW)
fs = 2;
else
_stprintf (tmp2, _T("KeyboardLayout%d"), cnt);
_tcscpy (desc.szHostInputID, tmp2);
_tcscpy (desc.szHostInputName, p1);
- desc.dwHostInputType= RP_HOSTINPUT_KEYJOY_MAP1 + cnt;
+ desc.dwHostInputType= (RP_HOSTINPUT_KEYJOY_MAP1 + cnt);
desc.dwInputDeviceFeatures = RP_FEATURE_INPUTDEVICE_JOYSTICK;
if (cnt == 0)
desc.dwInputDeviceFeatures |= RP_FEATURE_INPUTDEVICE_JOYPAD;
break;
}
}
+ memset (&desc, 0, sizeof desc);
+ _tcscpy (desc.szHostInputID, _T("KeyboardCustom"));
+ _tcscpy (desc.szHostInputName, _T("KeyboardCustom"));
+ desc.dwHostInputType = RP_HOSTINPUT_KEYJOY_CUSTOM;
+ desc.dwInputDeviceFeatures = RP_FEATURE_INPUTDEVICE_JOYSTICK;
+ RPSendMessagex (RPIPCGM_INPUTDEVICE, 0, 0, &desc, sizeof desc, &guestinfo, NULL);
cnt = 0;
while ((cnt = rp_input_enum (&desc, cnt)) >= 0) {
if (log_rp)
return;
name[0] = 0;
- if (k >= 0) {
+ if (currprefs.jports[num].id == JPORT_CUSTOM) {
+ port_get_custom (num, name);
+ } else if (k >= 0) {
_stprintf (name, _T("KeyboardLayout%d"), k);
} else if (j >= 0) {
_tcscpy (name, inputdevice_get_device_unique_name (IDTYPE_JOYSTICK, j));
WIN32GUI_LoadUIString (IDS_INPUT_CUSTOM, buf, sizeof buf / sizeof (TCHAR));
for (int i = 0; i < GAMEPORT_INPUT_SETTINGS; i++)
_stprintf (p->input_config_name[i], buf, i + 1);
+
+ /* switch from 32 to 16 or vice versa if mode does not exist */
+ struct MultiDisplay *md = getdisplay (p);
+ int depth = currprefs.color_mode == 5 ? 4 : 2;
+ for (int i = 0; md->DisplayModes[i].depth >= 0; i++) {
+ if (md->DisplayModes[i].depth == depth) {
+ depth = 0;
+ break;
+ }
+ }
+ if (depth) {
+ currprefs.color_mode = currprefs.color_mode == 5 ? 2 : 5;
+ }
+
}
if (type == 1 || type == 0) {
p->win32_uaescsimode = UAESCSI_CDEMU;
#define LANG_DLL 1
//#define WINUAEBETA _T("")
-#define WINUAEBETA _T("Beta 0")
-#define WINUAEDATE MAKEBD(2012, 3, 29)
+#define WINUAEBETA _T("Beta 1")
+#define WINUAEDATE MAKEBD(2012, 3, 31)
#define WINUAEEXTRA _T("")
//#define WINUAEEXTRA _T("AmiKit Preview")
#define WINUAEREV _T("")
static uae_u8 scrlinebuf[4096 * 4]; /* this is too large, but let's rather play on the safe side here */
-struct MultiDisplay *getdisplay (struct uae_prefs *p)
-{
- int i;
- int display = p->gfx_display - 1;
-
- i = 0;
- while (Displays[i].monitorname) {
- struct MultiDisplay *md = &Displays[i];
- if (p->gfx_display_name[0] && !_tcscmp (md->adaptername, p->gfx_display_name))
- return md;
- if (p->gfx_display_name[0] && !_tcscmp (md->adaptername, p->gfx_display_name))
- return md;
- i++;
+static struct MultiDisplay *getdisplay2 (struct uae_prefs *p, int index)
+{
+ int max;
+ int display = index < 0 ? p->gfx_apmode[screen_is_picasso ? APMODE_RTG : APMODE_NATIVE].gfx_display - 1 : index;
+
+ max = 0;
+ while (Displays[max].monitorname) {
+ if (index < 0) {
+ struct MultiDisplay *md = &Displays[max];
+ if (screen_is_picasso) {
+ if (p->gfx_apmode[APMODE_RTG].gfx_display_name[0] && !_tcscmp (md->adaptername, p->gfx_apmode[APMODE_RTG].gfx_display_name))
+ return md;
+ } else {
+ if (p->gfx_apmode[APMODE_NATIVE].gfx_display_name[0] && !_tcscmp (md->adaptername, p->gfx_apmode[APMODE_NATIVE].gfx_display_name))
+ return md;
+ }
+ }
+ max++;
}
- if (i == 0) {
+ if (max == 0) {
gui_message (_T("no display adapters! Exiting"));
exit (0);
}
- if (display >= i)
+ if (index >= 0 && display >= max)
+ return NULL;
+ if (display >= max)
display = 0;
if (display < 0)
display = 0;
return &Displays[display];
}
+struct MultiDisplay *getdisplay (struct uae_prefs *p)
+{
+ return getdisplay2 (p, -1);
+}
void desktop_coords (int *dw, int *dh, int *ax, int *ay, int *aw, int *ah)
{
c |= currprefs.gfx_lores_mode != changed_prefs.gfx_lores_mode ? (2 | 8) : 0;
c |= currprefs.gfx_scandoubler != changed_prefs.gfx_scandoubler ? (2 | 8) : 0;
- c |= currprefs.gfx_display != changed_prefs.gfx_display ? (2|4|8) : 0;
- c |= _tcscmp (currprefs.gfx_display_name, changed_prefs.gfx_display_name) ? (2|4|8) : 0;
+ c |= currprefs.gfx_apmode[APMODE_NATIVE].gfx_display != changed_prefs.gfx_apmode[APMODE_NATIVE].gfx_display ? (2|4|8) : 0;
+ c |= currprefs.gfx_apmode[APMODE_RTG].gfx_display != changed_prefs.gfx_apmode[APMODE_RTG].gfx_display ? (2|4|8) : 0;
+ c |= _tcscmp (currprefs.gfx_apmode[APMODE_NATIVE].gfx_display_name, changed_prefs.gfx_apmode[APMODE_NATIVE].gfx_display_name) ? (2|4|8) : 0;
+ c |= _tcscmp (currprefs.gfx_apmode[APMODE_RTG].gfx_display_name, changed_prefs.gfx_apmode[APMODE_RTG].gfx_display_name) ? (2|4|8) : 0;
c |= currprefs.gfx_blackerthanblack != changed_prefs.gfx_blackerthanblack ? (2 | 8) : 0;
c |= currprefs.gfx_apmode[0].gfx_backbuffers != changed_prefs.gfx_apmode[0].gfx_backbuffers ? (2 | 8) : 0;
c |= currprefs.gfx_apmode[0].gfx_interlaced != changed_prefs.gfx_apmode[0].gfx_interlaced ? (2 | 8) : 0;
currprefs.gfx_lores_mode = changed_prefs.gfx_lores_mode;
currprefs.gfx_scandoubler = changed_prefs.gfx_scandoubler;
- currprefs.gfx_display = changed_prefs.gfx_display;
- _tcscpy (currprefs.gfx_display_name, changed_prefs.gfx_display_name);
+ currprefs.gfx_apmode[APMODE_NATIVE].gfx_display = changed_prefs.gfx_apmode[APMODE_NATIVE].gfx_display;
+ currprefs.gfx_apmode[APMODE_RTG].gfx_display = changed_prefs.gfx_apmode[APMODE_RTG].gfx_display;
+ _tcscpy (currprefs.gfx_apmode[APMODE_NATIVE].gfx_display_name, changed_prefs.gfx_apmode[APMODE_NATIVE].gfx_display_name);
+ _tcscpy (currprefs.gfx_apmode[APMODE_RTG].gfx_display_name, changed_prefs.gfx_apmode[APMODE_RTG].gfx_display_name);
currprefs.gfx_blackerthanblack = changed_prefs.gfx_blackerthanblack;
currprefs.gfx_apmode[0].gfx_backbuffers = changed_prefs.gfx_apmode[0].gfx_backbuffers;
currprefs.gfx_apmode[0].gfx_interlaced = changed_prefs.gfx_apmode[0].gfx_interlaced;
static int getbestmode (int nextbest)
{
- int i, startidx, disp;
- struct MultiDisplay *md = getdisplay (&currprefs);
+ int i, startidx;
+ struct MultiDisplay *md;
int ratio;
+ int index = -1;
- ratio = currentmode->native_width > currentmode->native_height ? 1 : 0;
- disp = currprefs.gfx_display;
- for (i = 0; md->DisplayModes[i].depth >= 0; i++) {
- struct PicassoResolution *pr = &md->DisplayModes[i];
- if (pr->res.width == currentmode->native_width && pr->res.height == currentmode->native_height)
- break;
- }
- if (md->DisplayModes[i].depth >= 0) {
- if (!nextbest)
- return 1;
- while (md->DisplayModes[i].res.width == currentmode->native_width && md->DisplayModes[i].res.height == currentmode->native_height)
- i++;
- } else {
- i = 0;
- }
- // first iterate only modes that have similar aspect ratio
- startidx = i;
- for (; md->DisplayModes[i].depth >= 0; i++) {
- struct PicassoResolution *pr = &md->DisplayModes[i];
- int r = pr->res.width > pr->res.height ? 1 : 0;
- if (pr->res.width >= currentmode->native_width && pr->res.height >= currentmode->native_height && r == ratio) {
- write_log (_T("FS: %dx%d -> %dx%d (%d)\n"), currentmode->native_width, currentmode->native_height,
- pr->res.width, pr->res.height, ratio);
- currentmode->native_width = pr->res.width;
- currentmode->native_height = pr->res.height;
- currentmode->current_width = currentmode->native_width;
- currentmode->current_height = currentmode->native_height;
- return 1;
+ for(;;) {
+ md = getdisplay2 (&currprefs, index);
+ if (!md)
+ return 0;
+ ratio = currentmode->native_width > currentmode->native_height ? 1 : 0;
+ for (i = 0; md->DisplayModes[i].depth >= 0; i++) {
+ struct PicassoResolution *pr = &md->DisplayModes[i];
+ if (pr->res.width == currentmode->native_width && pr->res.height == currentmode->native_height)
+ break;
}
- }
- // still not match? check all modes
- i = startidx;
- for (; md->DisplayModes[i].depth >= 0; i++) {
- struct PicassoResolution *pr = &md->DisplayModes[i];
- int r = pr->res.width > pr->res.height ? 1 : 0;
- if (pr->res.width >= currentmode->native_width && pr->res.height >= currentmode->native_height) {
- write_log (_T("FS: %dx%d -> %dx%d\n"), currentmode->native_width, currentmode->native_height,
- pr->res.width, pr->res.height);
- currentmode->native_width = pr->res.width;
- currentmode->native_height = pr->res.height;
- currentmode->current_width = currentmode->native_width;
- currentmode->current_height = currentmode->native_height;
- return 1;
+ if (md->DisplayModes[i].depth >= 0) {
+ if (!nextbest)
+ break;
+ while (md->DisplayModes[i].res.width == currentmode->native_width && md->DisplayModes[i].res.height == currentmode->native_height)
+ i++;
+ } else {
+ i = 0;
+ }
+ // first iterate only modes that have similar aspect ratio
+ startidx = i;
+ for (; md->DisplayModes[i].depth >= 0; i++) {
+ struct PicassoResolution *pr = &md->DisplayModes[i];
+ int r = pr->res.width > pr->res.height ? 1 : 0;
+ if (pr->res.width >= currentmode->native_width && pr->res.height >= currentmode->native_height && r == ratio) {
+ write_log (_T("FS: %dx%d -> %dx%d (%d)\n"), currentmode->native_width, currentmode->native_height,
+ pr->res.width, pr->res.height, ratio);
+ currentmode->native_width = pr->res.width;
+ currentmode->native_height = pr->res.height;
+ currentmode->current_width = currentmode->native_width;
+ currentmode->current_height = currentmode->native_height;
+ break;
+ }
}
+ // still not match? check all modes
+ i = startidx;
+ for (; md->DisplayModes[i].depth >= 0; i++) {
+ struct PicassoResolution *pr = &md->DisplayModes[i];
+ int r = pr->res.width > pr->res.height ? 1 : 0;
+ if (pr->res.width >= currentmode->native_width && pr->res.height >= currentmode->native_height) {
+ write_log (_T("FS: %dx%d -> %dx%d\n"), currentmode->native_width, currentmode->native_height,
+ pr->res.width, pr->res.height);
+ currentmode->native_width = pr->res.width;
+ currentmode->native_height = pr->res.height;
+ currentmode->current_width = currentmode->native_width;
+ currentmode->current_height = currentmode->native_height;
+ break;
+ }
+ }
+ index++;
}
- return 0;
+ if (index >= 0) {
+ currprefs.gfx_apmode[screen_is_picasso ? APMODE_RTG : APMODE_NATIVE].gfx_display =
+ changed_prefs.gfx_apmode[screen_is_picasso ? APMODE_RTG : APMODE_NATIVE].gfx_display = index;
+ currprefs.gfx_apmode[screen_is_picasso ? APMODE_RTG : APMODE_NATIVE].gfx_display_name[0] =
+ changed_prefs.gfx_apmode[screen_is_picasso ? APMODE_RTG : APMODE_NATIVE].gfx_display_name[0] = 0;
+ write_log (L"Monitor switched to '%s'\n", md->adaptername);
+ }
+ return 1;
}
static volatile frame_time_t vblank_prev_time, thread_vblank_time;
{
if (!create_windows_2 ())
return 0;
+
+
+
return set_ddraw ();
}
int displaynum;
int idx = 0;
- displaynum = workprefs.gfx_display - 1;
+ displaynum = workprefs.gfx_apmode[APMODE_NATIVE].gfx_display - 1;
if (displaynum < 0)
displaynum = 0;
SendDlgItemMessage (hDlg, IDC_DISPLAYSELECT, CB_RESETCONTENT, 0, 0);
if (posn == CB_ERR)
return;
- displaynum = workprefs.gfx_display - 1;
+ displaynum = workprefs.gfx_apmode[APMODE_NATIVE].gfx_display - 1;
if (displaynum < 0)
displaynum = 0;
while (md->monitorname) {
if (foundnum >= 0) {
if (foundnum == displaynum)
return;
- workprefs.gfx_display = foundnum + 1;
+ workprefs.gfx_apmode[APMODE_NATIVE].gfx_display = foundnum + 1;
+ workprefs.gfx_apmode[APMODE_RTG].gfx_display = foundnum + 1;
init_displays_combo (hDlg);
init_resolution_combo (hDlg);
init_display_mode (hDlg);
BOOL enable = FALSE, jitenable = FALSE;
BOOL cpu_based_enable = FALSE;
- /* These four items only get enabled when adjustable CPU style is enabled */
- ew (hDlg, IDC_SPEED, workprefs.m68k_speed > 0);
+ ew (hDlg, IDC_SPEED, !workprefs.cpu_cycle_exact);
ew (hDlg, IDC_COMPATIBLE24, workprefs.cpu_model == 68020);
ew (hDlg, IDC_CS_HOST, !workprefs.cpu_cycle_exact);
ew (hDlg, IDC_CS_68000, !workprefs.cpu_cycle_exact);
ew (hDlg, IDC_FPU2, TRUE);
ew (hDlg, IDC_FPU3, workprefs.cpu_model >= 68040);
ew (hDlg, IDC_MMUENABLE, workprefs.cpu_model == 68040 && workprefs.cachesize == 0);
+
+ SendDlgItemMessage (hDlg, IDC_SPEED, TBM_SETRANGE, TRUE, workprefs.m68k_speed < 0 ? MAKELONG(-9, 0) : MAKELONG (-9, 50));
+ SendDlgItemMessage (hDlg, IDC_SPEED, TBM_SETPAGESIZE, 0, 1);
}
static int getcpufreq (int m)
static void values_to_cpudlg (HWND hDlg)
{
- TCHAR cache[8] = _T("");
+ TCHAR buffer[8] = _T("");
int cpu;
- SendDlgItemMessage (hDlg, IDC_SPEED, TBM_SETPOS, TRUE, workprefs.m68k_speed <= 0 ? 1 : workprefs.m68k_speed / CYCLE_UNIT );
- SetDlgItemInt( hDlg, IDC_CPUTEXT, workprefs.m68k_speed <= 0 ? 1 : workprefs.m68k_speed / CYCLE_UNIT, FALSE );
+ SendDlgItemMessage (hDlg, IDC_SPEED, TBM_SETPOS, TRUE, workprefs.m68k_speed_throttle / 100);
+ _stprintf (buffer, _T("%+d%%"), workprefs.m68k_speed_throttle / 10);
+ SetDlgItemText (hDlg, IDC_CPUTEXT, buffer);
CheckDlgButton (hDlg, IDC_COMPATIBLE, workprefs.cpu_compatible);
CheckDlgButton (hDlg, IDC_COMPATIBLE24, workprefs.address_space_24);
CheckDlgButton (hDlg, IDC_COMPATIBLE_FPU, workprefs.fpu_strict);
if (workprefs.m68k_speed < 0)
CheckRadioButton(hDlg, IDC_CS_HOST, IDC_CS_ADJUSTABLE, IDC_CS_HOST);
- else if (workprefs.m68k_speed == 0)
+ else if (workprefs.m68k_speed >= 0)
CheckRadioButton(hDlg, IDC_CS_HOST, IDC_CS_ADJUSTABLE, IDC_CS_68000);
- else
- CheckRadioButton(hDlg, IDC_CS_HOST, IDC_CS_ADJUSTABLE, IDC_CS_ADJUSTABLE);
CheckRadioButton (hDlg, IDC_TRUST0, IDC_TRUST1, trust_ids[workprefs.comptrustbyte]);
SendDlgItemMessage (hDlg, IDC_CACHE, TBM_SETPOS, TRUE, workprefs.cachesize / 1024);
- _stprintf (cache, _T("%d MB"), workprefs.cachesize / 1024 );
- SetDlgItemText (hDlg, IDC_CACHETEXT, cache);
+ _stprintf (buffer, _T("%d MB"), workprefs.cachesize / 1024 );
+ SetDlgItemText (hDlg, IDC_CACHETEXT, buffer);
CheckDlgButton (hDlg, IDC_NOFLAGS, workprefs.compnf);
CheckDlgButton (hDlg, IDC_JITFPU, workprefs.compfpu);
workprefs.cpu_compatible = workprefs.cpu_cycle_exact | (ischecked (hDlg, IDC_COMPATIBLE) ? 1 : 0);
workprefs.fpu_strict = ischecked (hDlg, IDC_COMPATIBLE_FPU) ? 1 : 0;
workprefs.address_space_24 = ischecked (hDlg, IDC_COMPATIBLE24) ? 1 : 0;
- workprefs.m68k_speed = ischecked (hDlg, IDC_CS_HOST) ? -1
- : ischecked (hDlg, IDC_CS_68000) ? 0
- : SendMessage (GetDlgItem (hDlg, IDC_SPEED), TBM_GETPOS, 0, 0) * CYCLE_UNIT;
+ workprefs.m68k_speed = ischecked (hDlg, IDC_CS_HOST) ? -1 : 0;
+ workprefs.m68k_speed_throttle = SendMessage (GetDlgItem (hDlg, IDC_SPEED), TBM_GETPOS, 0, 0) * 100;
+ if (workprefs.m68k_speed_throttle > 0 && workprefs.m68k_speed < 0)
+ workprefs.m68k_speed_throttle = 0;
workprefs.mmu_model = ischecked (hDlg, IDC_MMUENABLE) ? 68040 : 0;
newcpu = ischecked (hDlg, IDC_CPU0) ? 68000
recursive++;
pages[CPU_ID] = hDlg;
currentpage = CPU_ID;
- SendDlgItemMessage (hDlg, IDC_SPEED, TBM_SETRANGE, TRUE, MAKELONG (MIN_M68K_PRIORITY, MAX_M68K_PRIORITY));
- SendDlgItemMessage (hDlg, IDC_SPEED, TBM_SETPAGESIZE, 0, 1);
SendDlgItemMessage (hDlg, IDC_CACHE, TBM_SETRANGE, TRUE, MAKELONG (MIN_CACHE_SIZE, MAX_CACHE_SIZE));
SendDlgItemMessage (hDlg, IDC_CACHE, TBM_SETPAGESIZE, 0, 1);
SendDlgItemMessage (hDlg, IDC_CPUIDLE, TBM_SETRANGE, TRUE, MAKELONG (0, 10));
case WM_USER:
recursive++;
- values_to_cpudlg (hDlg);
enable_for_cpudlg (hDlg);
+ values_to_cpudlg (hDlg);
recursive--;
return TRUE;
break;
recursive++;
values_from_cpudlg (hDlg);
- values_to_cpudlg (hDlg);
enable_for_cpudlg (hDlg);
+ values_to_cpudlg (hDlg);
recursive--;
break;
case WM_HSCROLL:
recursive++;
values_from_cpudlg( hDlg );
- values_to_cpudlg( hDlg );
enable_for_cpudlg( hDlg );
+ values_to_cpudlg( hDlg );
recursive--;
break;
}
HWND h = GetDlgItem (hDlg, IDC_INPUTMAPLIST);
int mode, *events, *axistable, *axistable2;
int cntadd = 1;
-
+
int max = inputdevice_get_compatibility_input (&workprefs, inputmap_port, &mode, &events, &axistable);
int evtnum = events[inputmap_remap_counter];
int type2 = intputdevice_compa_get_eventtype (evtnum, &axistable2);
}
}
- struct inputevent *ie = inputdevice_get_eventinfo (evtnum);
- TCHAR name[256];
- inputdevice_get_eventname (ie, name);
//write_log (_T("%d %d %d %s\n"), input_selected_device, input_selected_widget, evtnum, name);
- inputdevice_set_gameports_mapping (&workprefs, input_selected_device, input_selected_widget, name, inputmap_port);
+ inputdevice_set_gameports_mapping (&workprefs, input_selected_device, input_selected_widget, evtnum, inputmap_port);
InitializeListView (hDlg);
inputmap_remap_counter += cntadd;
ListView_EnsureVisible (h, inputmap_remap_counter, FALSE);
currentpage = INPUTMAP_ID;
inputdevice_updateconfig (&workprefs);
if (inputmap_remap_counter == 0) {
- inputdevice_compa_prepare_custom (&workprefs, inputmap_port);
+ inputdevice_compa_prepare_custom (&workprefs, inputmap_port, -1);
inputdevice_updateconfig (&workprefs);
}
InitializeListView (hDlg);
+- cpu throttling
+- custom event autofire
+- cycle exact mode scanline sync
+- restore only single input target to default.
+- hdd from command line
+
+Beta 1:
+
+- Input custom event autofire support.
+- Automatically switch to another monitor if current monitor does not support selected RTG mode.
+ (RTG mode list always lists all monitors' modes)
+- CDFS ACTION_EXAMINE_ALL crash. (It seems this was 2.4's most stupid bug)
+- Fastest possible CPU mode (including JIT) CPU speed throttle option.
+- Non fastest possible CPU mode CPU speed adjustment option. Currently GUI allows from -90% to 500%.
+- Removed Adjustable CPU/Chipset speed option, above option should be much better.
+- Switch from 16bit to 32bit (or vice versa) on startup if selected color depth does not exist.
+ (Beta Windows 8 + NVidia don't seem to have any 16bit modes)
+- Experimental sound sync update. Should increase stability of sound sync in non-fastest modes.
+ (Side-effects possible)
2.4.0