static void addCrosshair(int port, int crosshair_color, unsigned short *buffer, int bufferStride, int pos_x, int pos_y, int thickness, int size_x, int size_y) {
for (port = 0; port < 2; port++) {
// Draw the horizontal line of the crosshair
- for (int i = pos_y - thickness / 2; i <= pos_y + thickness / 2; i++) {
- for (int j = pos_x - size_x / 2; j <= pos_x + size_x / 2; j++) {
+ int i, j;
+ for (i = pos_y - thickness / 2; i <= pos_y + thickness / 2; i++) {
+ for (j = pos_x - size_x / 2; j <= pos_x + size_x / 2; j++) {
if ((i + vout_height) >= 0 && (i + vout_height) < bufferStride && j >= 0 && j < bufferStride && in_enable_crosshair[port] > 0)
buffer[i * bufferStride + j] = crosshair_color;
- }
}
+ }
// Draw the vertical line of the crosshair
- for (int i = pos_x - thickness / 2; i <= pos_x + thickness / 2; i++) {
- for (int j = pos_y - size_y / 2; j <= pos_y + size_y / 2; j++) {
+ for (i = pos_x - thickness / 2; i <= pos_x + thickness / 2; i++) {
+ for (j = pos_y - size_y / 2; j <= pos_y + size_y / 2; j++) {
if (i >= 0 && i < bufferStride && (j + vout_height) >= 0 && (j + vout_height) < bufferStride && in_enable_crosshair[port] > 0)
buffer[j * bufferStride + i] = crosshair_color;
}
for (port = 0; port < 2; port++) {
if (in_enable_crosshair[port] > 0 && (in_type[port] == PSE_PAD_TYPE_GUNCON || in_type[port] == PSE_PAD_TYPE_GUN))
{
- struct CrosshairInfo crosshairInfo;
- CrosshairDimensions(port, &crosshairInfo);
+ struct CrosshairInfo crosshairInfo;
+ CrosshairDimensions(port, &crosshairInfo);
addCrosshair(port, in_enable_crosshair[port], dest, dstride, crosshairInfo.pos_x, crosshairInfo.pos_y, crosshairInfo.thickness, crosshairInfo.size_x, crosshairInfo.size_y);
}
}
"pcsx_rearmed_negcon_deadzone",
"pcsx_rearmed_negcon_response",
"pcsx_rearmed_input_sensitivity",
- "pcsx_rearmed_crosshair1",
- "pcsx_rearmed_crosshair2",
+ "pcsx_rearmed_crosshair1",
+ "pcsx_rearmed_crosshair2",
"pcsx_rearmed_konamigunadjustx",
"pcsx_rearmed_konamigunadjusty",
"pcsx_rearmed_gunconadjustx",
#ifdef HAVE_CDROM
static long CALLBACK rcdrom_open(void);
static long CALLBACK rcdrom_close(void);
+static void rcdrom_stop_thread(void);
#endif
static bool disk_set_eject_state(bool ejected)
{
- // weird PCSX API..
+ if (ejected != disk_ejected)
+ SysPrintf("new eject_state: %d\n", ejected);
+
+ // weird PCSX API...
SetCdOpenCaseTime(ejected ? -1 : (time(NULL) + 2));
LidInterrupt();
#ifdef HAVE_CDROM
- if (CDR_open == rcdrom_open) {
- // likely the real cd was also changed - rescan
- rcdrom_close();
- if (!ejected)
+ if (CDR_open == rcdrom_open && ejected != disk_ejected) {
+ rcdrom_stop_thread();
+ if (!ejected) {
+ // likely the real cd was also changed - rescan
+ rcdrom_close();
rcdrom_open();
+ }
}
#endif
disk_ejected = ejected;
struct cached_buf *buf;
unsigned int buf_cnt, thread_exit, do_prefetch;
unsigned int total_lba, prefetch_lba;
+ int check_eject_delay;
} rcdrom;
static void lbacache_do(unsigned int lba)
if (ret) {
rcdrom.do_prefetch = 0;
slock_unlock(rcdrom.buf_lock);
- LogErr("cdrom_read_sector failed for lba %d\n", ret, lba);
+ LogErr("prefetch: cdrom_read_sector failed for lba %d\n", lba);
return;
}
+ rcdrom.check_eject_delay = 100;
if (lba != rcdrom.buf[i].lba) {
memcpy(rcdrom.buf[i].buf, buf, sizeof(rcdrom.buf[i].buf));
rcdrom.do_prefetch = 0;
if (lock)
slock_lock(lock);
- if (rcdrom.h)
+ if (rcdrom.h) {
ret = cdrom_read_sector(rcdrom.h, lba, buf);
+ if (ret)
+ LogErr("cdrom_read_sector failed for lba %d\n", lba);
+ }
if (lock)
slock_unlock(lock);
}
else
ret = 0;
+ rcdrom.check_eject_delay = ret ? 0 : 100;
//printf("%s %d:%02d:%02d -> %d hit %d\n", func, m, s, f, ret, hit);
return ret;
}
stat->Type = toc->track[0].audio ? 2 : 1;
return 0;
}
+
+static void rcdrom_check_eject(void)
+{
+ bool media_inserted;
+ if (!rcdrom.h || rcdrom.do_prefetch || rcdrom.check_eject_delay-- > 0)
+ return;
+ rcdrom.check_eject_delay = 100;
+ media_inserted = cdrom_is_media_inserted(rcdrom.h); // 1-2ms
+ if (!media_inserted != disk_ejected)
+ disk_set_eject_state(!media_inserted);
+}
#endif // HAVE_CDROM
#if defined(__QNX__) || defined(_WIN32)
video_cb((vout_fb_dirty || !vout_can_dupe) ? vout_buf_ptr : NULL,
vout_width, vout_height, vout_pitch * 2);
vout_fb_dirty = 0;
+
+#ifdef HAVE_CDROM
+ if (CDR_open == rcdrom_open)
+ rcdrom_check_eject();
+#endif
}
static bool try_use_bios(const char *path, bool preferred_only)