message("* qt/osd")
-SET(THIS_LIB_VERSION 3.7.0)
+SET(THIS_LIB_VERSION 3.8.0)
set(s_qt_osd_headers
osd_base.h
message("* qt/avio")
-SET(THIS_LIB_VERSION 3.4.0)
+SET(THIS_LIB_VERSION 3.4.1)
set(s_qt_avio_headers
movie_saver.h
movie_loader.h
void EmuThreadClassBase::moved_mouse(double x, double y, double globalx, double globaly)
{
if(using_flags->is_use_one_board_computer() || (using_flags->get_max_button() > 0)) {
- mouse_x = (int)floor(x);
- mouse_y = (int)floor(y);
+ mouse_x = x;
+ mouse_y = y;
// bool flag = p_osd->is_mouse_enabled();
// if(!flag) return;
// printf("Mouse Moved: %g, %g\n", x, y);
// p_osd->set_mouse_pointer(floor(x), floor(y));
} else if(using_flags->is_use_mouse()) {
- double factor = (double)(p_config->mouse_sensitivity & ((1 << 16) - 1));
- mouse_x = (int)(floor((x * factor) / 8192.0));
- mouse_y = (int)(floor((y * factor) / 8192.0));
+// double factor = (double)(p_config->mouse_sensitivity & ((1 << 16) - 1));
+// mouse_x = (int)(floor((globalx * factor) / 8192.0));
+// mouse_y = (int)(floor((globaly * factor) / 8192.0));
+ mouse_x = globalx;
+ mouse_y = globaly;
//printf("Moved Mouse %d, %d\n", x, y);
bool flag = p_osd->is_mouse_enabled();
if(!flag) return;
message("* qt/gui")
-set(THIS_LIB_VERSION 3.7.0)
+set(THIS_LIB_VERSION 3.8.0)
set(s_qt_gui_headers
qt_dialogs.h
vMovieQueue.clear();
drawCond = new QWaitCondition();
- keyMutex = new QMutex(QMutex::Recursive);
+// keyMutex = new QMutex(QMutex::Recursive);
+
mouse_x = 0;
mouse_y = 0;
if(using_flags->is_use_tape() && !using_flags->is_tape_binary_only()) {
p_config->sound_volume_l[i]) / 2;
}
}
- keyMutex->lock();
+ QMutexLocker _n(&keyMutex);
+
key_fifo = new FIFO(512 * 6);
key_fifo->clear();
- keyMutex->unlock();
+
};
if(using_flags->get_max_button() > 0) {
button_desc_t *vm_buttons_d = using_flags->get_vm_buttons();
if(vm_buttons_d == NULL) return;
+ int _x = (int)rint(mouse_x);
+ int _y = (int)rint(mouse_y);
switch(button) {
case Qt::LeftButton:
// case Qt::RightButton:
for(int i = 0; i < using_flags->get_max_button(); i++) {
- if((mouse_x >= vm_buttons_d[i].x) &&
- (mouse_x < (vm_buttons_d[i].x + vm_buttons_d[i].width))) {
- if((mouse_y >= vm_buttons_d[i].y) &&
- (mouse_y < (vm_buttons_d[i].y + vm_buttons_d[i].height))) {
+ if((_x >= vm_buttons_d[i].x) &&
+ (_x < (vm_buttons_d[i].x + vm_buttons_d[i].width))) {
+ if((_y >= vm_buttons_d[i].y) &&
+ (_y < (vm_buttons_d[i].y + vm_buttons_d[i].height))) {
if(vm_buttons_d[i].code != 0x00) {
key_queue_t sp;
sp.code = vm_buttons_d[i].code;
if(using_flags->get_max_button() > 0) {
button_desc_t *vm_buttons_d = using_flags->get_vm_buttons();
if(vm_buttons_d == NULL) return;
-
+ int _x = (int)rint(mouse_x);
+ int _y = (int)rint(mouse_y);
switch(button) {
case Qt::LeftButton:
// case Qt::RightButton:
for(int i = 0; i < using_flags->get_max_button(); i++) {
- if((mouse_x >= vm_buttons_d[i].x) &&
- (mouse_x < (vm_buttons_d[i].x + vm_buttons_d[i].width))) {
- if((mouse_y >= vm_buttons_d[i].y) &&
- (mouse_y < (vm_buttons_d[i].y + vm_buttons_d[i].height))) {
+ if((_x >= vm_buttons_d[i].x) &&
+ (_x < (vm_buttons_d[i].x + vm_buttons_d[i].width))) {
+ if((_y >= vm_buttons_d[i].y) &&
+ (_y < (vm_buttons_d[i].y + vm_buttons_d[i].height))) {
if(vm_buttons_d[i].code != 0x00) {
key_queue_t sp;
sp.code = vm_buttons_d[i].code;
#include <QString>
#include <QStringList>
#include <QElapsedTimer>
+#include <QRecursiveMutex>
+#include <QMutexLocker>
#include "fifo.h"
#include "common.h"
config_t *p_config;
QWaitCondition *drawCond;
- QMutex *keyMutex;
+ QRecursiveMutex keyMutex;
+ QRecursiveMutex mouseMutex;
//class META_MainWindow *MainWindow;
Ui_MainWindowBase *MainWindow;
QString sStateFile;
QString lStateFile;
- QMutex uiMutex;
+ QRecursiveMutex uiMutex;
char dbg_prev_command[MAX_COMMAND_LEN];
int fd_open_wait_count[8];
QString fd_reserved_path[8];
virtual void saveState() { }
void enqueue_key_up(key_queue_t s) {
- keyMutex->lock();
+ QMutexLocker n(&keyMutex);
key_fifo->write(KEY_QUEUE_UP);
key_fifo->write(s.code);
key_fifo->write(s.mod);
key_fifo->write(s.repeat? 1 : 0);
- keyMutex->unlock();
};
void enqueue_key_down(key_queue_t s) {
- keyMutex->lock();
+ QMutexLocker n(&keyMutex);
key_fifo->write(KEY_QUEUE_DOWN);
key_fifo->write(s.code);
key_fifo->write(s.mod);
key_fifo->write(s.repeat? 1 : 0);
- keyMutex->unlock();
};
void dequeue_key(key_queue_t *s) {
- keyMutex->lock();
+ QMutexLocker n(&keyMutex);
uint32_t _type = (uint32_t)key_fifo->read();
if(_type == KEY_QUEUE_DOWN) {
s->type = _type;
s->mod = 0;
s->repeat = false;
}
- keyMutex->unlock();
};
bool is_empty_key() {
- keyMutex->lock();
+ QMutexLocker n(&keyMutex);
bool f = key_fifo->empty();
- keyMutex->unlock();
return f;
};
void clear_key_queue() {
- keyMutex->lock();
+ QMutexLocker n(&keyMutex);
key_fifo->clear();
- keyMutex->unlock();
};
public:
}
}
QPointF pos;
- if(using_flags->is_use_one_board_computer() || (using_flags->get_max_button() > 0)) {
+// if(using_flags->is_use_one_board_computer() || (using_flags->get_max_button() > 0)) {
pos = event->localPos();
- } else {
- pos = event->screenPos();
- }
+// } else {
+// pos = event->screenPos();
+// }
double xpos = (double)(pos.x()) / (double)width();
double ypos = (double)(pos.y()) / (double)height();
double gxpos = (double)(event->globalPos().x()) / (double)width();
double gypos = (double)(event->globalPos().y()) / (double)height();
- //printf("@@ %d %d\n", pos.x(), pos.y());
+
if(using_flags->is_use_one_board_computer() || using_flags->is_use_mouse() || (using_flags->get_max_button() > 0)) {
if(!enable_mouse) return;
//if(QApplication::overrideCursor() == NULL) {
gyy = gypos * (double)d_hh;
}
- //csp_logger->debug_log(CSP_LOG_DEBUG, CSP_LOG_TYPE_GENERAL, "Mouse Move: (%f,%f) -> (%d, %d)\n", xpos, ypos, (int)xx, (int)yy);
+ //csp_logger->debug_log(CSP_LOG_DEBUG, CSP_LOG_TYPE_GENERAL, "Mouse Move: (%f,%f) : (%f,%f) -> (%g, %g)(%g, %g)", pos.x(), pos.y(), xpos, ypos, xx, yy, gxx, gyy);
emit sig_notify_move_mouse(xx, yy, gxx, gyy);
}
int32_t mouse_status[3]; // x, y, button (b0 = left, b1 = right)
bool mouse_enabled;
- int mouse_ptrx;
- int mouse_ptry;
- int mouse_button;
- int mouse_oldx;
- int mouse_oldy;
+ double mouse_ptrx;
+ double mouse_ptry;
+ int32_t mouse_button;
+ double mouse_oldx;
+ double mouse_oldy;
//Qt::CursorShape mouse_shape;
QImage background_image;
void toggle_mouse();
bool is_mouse_enabled();
//QImage *getPseudoVramClass(void) { return pPseudoVram;}
- void set_mouse_pointer(int x, int y);
+ void set_mouse_pointer(double x, double y);
void set_mouse_button(int button);
void modify_key_buffer(int code, uint8_t val);
uint8_t* get_key_buffer();
mouse_enabled = false;
}
- mouse_ptrx = mouse_oldx = get_screen_width() / 2;
- mouse_ptry = mouse_oldy = get_screen_height() / 2;
+ mouse_ptrx = mouse_oldx = (double)(get_screen_width() / 2);
+ mouse_ptry = mouse_oldy = (double)(get_screen_height() / 2);
// initialize keycode convert table
FILEIO* fio = new FILEIO();
if(fio->Fopen(bios_path(_T("keycode.cfg")), FILEIO_READ_BINARY)) {
memset(mouse_status, 0, sizeof(mouse_status));
//bool hid = false;
if(mouse_enabled) {
- int xx = mouse_ptrx;
- int yy = mouse_ptry;
- mouse_status[0] = xx - mouse_oldx;
- mouse_status[1] = yy - mouse_oldy;
+ double diffx = mouse_ptrx - mouse_oldx;
+ double diffy = mouse_ptry - mouse_oldy;
+ double factor = (double)(p_config->mouse_sensitivity & ((1 << 16) - 1));
+ diffx = (diffx * factor) / 8192.0;
+ diffy = (diffy * factor) / 8192.0;
+
+ mouse_status[0] = (int32_t)rint(diffx);
+ mouse_status[1] = (int32_t)rint(diffy);
mouse_status[2] = mouse_button;
//printf("Mouse delta(%d, %d)\n", delta_x, delta_y);
- mouse_oldx = xx;
- mouse_oldy = yy;
+ mouse_oldx = mouse_ptrx;
+ mouse_oldy = mouse_ptry;
}
}
int32_t* OSD_BASE::get_mouse_buffer()
{
+ QMutexLocker n(mouse_mutex);
update_input_mouse();
return mouse_status;
}
// enable mouse emulation
if(!mouse_enabled) {
QMutexLocker n(mouse_mutex);
- int xx = get_screen_width() / 2;
- int yy = get_screen_height() / 2;
+ double xx = (double)(get_screen_width() / 2);
+ double yy = (double)(get_screen_height() / 2);
mouse_oldx = xx;
mouse_oldy = yy;
return mouse_enabled;
}
-void OSD_BASE::set_mouse_pointer(int x, int y)
+void OSD_BASE::set_mouse_pointer(double x, double y)
{
if((mouse_enabled)) {
QMutexLocker n(mouse_mutex);
mouse_ptrx = x;
mouse_ptry = y;
-
-// mouse_oldx = mouse_ptrx;
-// mouse_oldy = mouse_ptry;
-// printf("Mouse Moved: (%d, %d)\n", mouse_ptrx, mouse_ptry);
}
}
message("* vm/common_vm")
-SET(THIS_LIB_VERSION 3.9.0)
+SET(THIS_LIB_VERSION 3.9.1)
#include(cotire)
set(s_vm_common_vm_srcs