#include <SDL.h>
-#include "./emu_thread_tmpl.h"
+#include "emu_thread_tmpl.h"
#include "qt_gldraw.h"
#include "csp_logger.h"
#include "dock_disks.h"
#include "menu_metaclass.h"
-
-void EmuThreadClassBase::do_start_auto_key(QString ctext)
-{
- //QMutexLocker _locker(&uiMutex);
- if(p_emu == nullptr) return;
- std::shared_ptr<USING_FLAGS> p = using_flags;
- if(p.get() == nullptr) return;
-
- if(p->is_use_auto_key()) {
- QTextCodec *codec = QTextCodec::codecForName("Shift-Jis");
- QByteArray array;
- QVector<uint> ucs4_src = ctext.toUcs4();
- QString dst;
- dst.clear();
- uint32_t pool[8] = {0};
- for(auto itr = ucs4_src.constBegin(); itr != ucs4_src.constEnd(); ++itr) {
- uint val = (*itr);
- int chrs = ucs4_kana_zenkaku_to_hankaku((const uint32_t)val, pool, sizeof(pool) / sizeof(uint32_t));
- if(chrs > 0) {
- #if QT_VERSION >= 0x060000
- dst.append(QString::fromUcs4((char32_t*)pool, chrs));
- #else
- dst.append(QString::fromUcs4((uint*)pool, chrs));
- #endif
- }
- }
- clipBoardText = dst;
- //printf("%s\n", clipBoardText.toLocal8Bit().constData());
- array = codec->fromUnicode(clipBoardText);
- //printf("Array is:");
- //for(int l = 0; l < array.size(); l++) {
- // printf("%02X ", array.at(l));
- //}
- //printf("\n");
- if(clipBoardText.size() > 0) {
- int size = array.size();
- const char *buf = (char *)(array.constData());
- p_emu->stop_auto_key();
- p_emu->set_auto_key_list((char *)buf, size);
- p_emu->start_auto_key();
- }
- }
-
-}
-
-void EmuThreadClassBase::do_stop_auto_key(void)
-{
- //QMutexLocker _locker(&uiMutex);
- //csp_logger->debug_log(CSP_LOG_DEBUG, CSP_LOG_TYPE_GENERAL,
- // "AutoKey: stop\n");
- if(p_emu == nullptr) return;
- std::shared_ptr<USING_FLAGS> p = using_flags;
- if(p.get() == nullptr) return;
-
- if(p->is_use_auto_key()) {
- p_emu->stop_auto_key();
- }
-}
-
void EmuThreadClassBase::do_write_protect_floppy_disk(int drv, bool flag)
{
if(drv < 0) return;
}
}
-void EmuThreadClassBase::moved_mouse(double x, double y, double globalx, double globaly)
-{
- if(p_osd == nullptr) return;
- std::shared_ptr<USING_FLAGS> p = using_flags;
- if(p.get() == nullptr) return;
-
- if(p->is_use_one_board_computer() || (p->get_max_button() > 0)) {
- 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(p->is_use_mouse()) {
-// 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;
- //printf("Mouse Moved: %d, %d\n", x, y);
- p_osd->set_mouse_pointer(mouse_x, mouse_y);
- }
-}
-
-void EmuThreadClassBase::button_pressed_mouse_sub(Qt::MouseButton button)
-{
-
- if(p_osd == nullptr) return;
- std::shared_ptr<USING_FLAGS> p = using_flags;
- if(p.get() == nullptr) return;
-
- if(p->is_use_one_board_computer() || p->is_use_mouse() || (p->get_max_button() > 0)) {
- int stat = p_osd->get_mouse_button();
- bool flag = (p_osd->is_mouse_enabled() || p->is_use_one_board_computer() || (p->get_max_button() > 0));
- switch(button) {
- case Qt::LeftButton:
- stat |= 0x01;
- break;
- case Qt::RightButton:
- stat |= 0x02;
- break;
- case Qt::MiddleButton:
- flag = !flag;
- emit sig_mouse_enable(flag);
- return;
- break;
- default:
- break;
- }
- if(!flag) return;
- p_osd->set_mouse_button(stat);
- }
-}
-
-void EmuThreadClassBase::button_released_mouse_sub(Qt::MouseButton button)
-{
-
- if(p_osd == nullptr) return;
- std::shared_ptr<USING_FLAGS> p = using_flags;
- if(p.get() == nullptr) return;
-
- if(p->is_use_one_board_computer() || p->is_use_mouse() || (p->get_max_button() > 0)) {
- int stat = p_osd->get_mouse_button();
- switch(button) {
- case Qt::LeftButton:
- stat &= 0x7ffffffe;
- break;
- case Qt::RightButton:
- stat &= 0x7ffffffd;
- break;
- case Qt::MiddleButton:
- //emit sig_mouse_enable(false);
- break;
- default:
- break;
- }
- p_osd->set_mouse_button(stat);
- }
-}
-
void EmuThreadClassBase::do_notify_power_off()
{
poweroff_notified = true;
#include <QWidget>
#include <QOpenGLContext>
-#include <SDL.h>
+//#include <SDL.h>
#include "emu_thread_tmpl.h"
#include "mainwidget_base.h"
#include "dock_disks.h"
#include "../../osdcall_types.h"
-#include "./virtualfileslist.h"
+#include "virtualfileslist.h"
#include "menu_metaclass.h"
//#include "../../romakana.h"
delete key_fifo;
};
-void EmuThreadClassBase::calc_volume_from_balance(int num, int balance)
-{
- int level = volume_avg[num];
- int right;
- int left;
- volume_balance[num] = balance;
- right = level + balance;
- left = level - balance;
- p_config->sound_volume_l[num] = left;
- p_config->sound_volume_r[num] = right;
-}
-
-void EmuThreadClassBase::calc_volume_from_level(int num, int level)
-{
- int balance = volume_balance[num];
- int right,left;
- volume_avg[num] = level;
- right = level + balance;
- left = level - balance;
- p_config->sound_volume_l[num] = left;
- p_config->sound_volume_r[num] = right;
-}
void EmuThreadClassBase::doExit(void)
{
bRunThread = false;
}
-void EmuThreadClassBase::button_pressed_mouse(Qt::MouseButton button)
-{
- std::shared_ptr<USING_FLAGS> up = using_flags;
- if(up.get() == nullptr) return;
- if(up->is_use_mouse()) {
- button_pressed_mouse_sub(button);
- } else {
- if(up->get_max_button() > 0) {
- button_desc_t *vm_buttons_d = up->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 < up->get_max_button(); i++) {
- 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;
- sp.mod = key_mod;
- sp.repeat = false;
- enqueue_key_down(sp);
- } else {
- bResetReq = true;
- }
- }
- }
- }
- break;
- default:
- break;
- }
- }
- }
-}
-
-void EmuThreadClassBase::button_released_mouse(Qt::MouseButton button)
-{
- std::shared_ptr<USING_FLAGS> up = using_flags;
- if(up.get() == nullptr) return;
- if(up->is_use_mouse()) {
- button_released_mouse_sub(button);
- } else {
- if(up->get_max_button() > 0) {
- button_desc_t *vm_buttons_d = up->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 < up->get_max_button(); i++) {
- 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;
- sp.mod = key_mod;
- sp.repeat = false;
- enqueue_key_up(sp);
- }
- }
- }
- }
- break;
- default:
- break;
- }
- }
- }
-}
-
-// New UI
-void EmuThreadClassBase::do_key_down(uint32_t vk, uint32_t mod, bool repeat)
-{
- key_queue_t sp;
- sp.code = vk;
- sp.mod = mod;
- sp.repeat = repeat;
- //key_changed = true;
- enqueue_key_down(sp);
- key_mod = mod;
-}
-
-void EmuThreadClassBase::do_key_up(uint32_t vk, uint32_t mod)
-{
- key_queue_t sp;
- sp.code = vk;
- sp.mod = mod;
- sp.repeat = false;
- enqueue_key_up(sp);
- key_mod = mod;
-}
-
void EmuThreadClassBase::set_tape_play(bool flag)
{
tape_play_flag = flag;
emit sig_resize_osd(screen_width);
}
-void EmuThreadClassBase::sample_access_drv(void)
-{
- if(p_emu == nullptr) return;
-
- std::shared_ptr<USING_FLAGS> up = using_flags;
- if(up.get() == nullptr) return;
- if(up->is_use_qd()) get_qd_string();
- if(up->is_use_fd()) get_fd_string();
- if(up->is_use_hdd()) get_hdd_string();
- if(up->is_use_tape() && !(up->is_tape_binary_only())) get_tape_string();
- if(up->is_use_compact_disc()) get_cd_string();
- if(up->is_use_bubble()) get_bubble_string();
-}
-
-
-
-
void EmuThreadClassBase::do_update_config()
{
bUpdateConfigReq = true;
}
-const _TCHAR *EmuThreadClassBase::get_device_name(void)
-{
- return (const _TCHAR *)_T("TEST");
-}
-
void EmuThreadClassBase::print_framerate(int frames)
{
if(frames >= 0) draw_frames += frames;
return QString::fromUtf8("");
}
-
-#if defined(Q_OS_LINUX)
-//#define _GNU_SOURCE
-#include <unistd.h>
-#include <sched.h>
-#include <pthread.h>
-#endif
-
-void EmuThreadClassBase::do_set_emu_thread_to_fixed_cpu_from_action(void)
-{
- QAction *cp = qobject_cast<QAction*>(QObject::sender());
- if(cp == nullptr) return;
- int cpunum = cp->data().value<int>();
- set_emu_thread_to_fixed_cpu(cpunum);
-}
-
-void EmuThreadClassBase::set_emu_thread_to_fixed_cpu(int cpunum)
+void EmuThreadClassBase::sample_access_drv(void)
{
-#if defined(Q_OS_LINUX)
- if(thread_id == (Qt::HANDLE)nullptr) {
- queue_fixed_cpu = cpunum;
- return;
- }
+ if(p_emu == nullptr) return;
- long cpus = sysconf(_SC_NPROCESSORS_ONLN);
- cpu_set_t *mask;
- mask = CPU_ALLOC(cpus);
- CPU_ZERO_S(CPU_ALLOC_SIZE(cpus), mask);
- if((cpunum < 0) || (cpunum >= cpus)) {
- for(int i = 0; i < cpus; i++ ) {
- CPU_SET(i, mask);
- }
- } else {
- CPU_SET(cpunum, mask);
- }
-// sched_setaffinity((pid_t)thread_id, CPU_ALLOC_SIZE(cpus), (const cpu_set_t*)mask);
- pthread_setaffinity_np(*((pthread_t*)thread_id), CPU_ALLOC_SIZE(cpus),(const cpu_set_t *)mask);
- CPU_FREE(mask);
-#else
- return;
-#endif
- return;
+ std::shared_ptr<USING_FLAGS> up = using_flags;
+ if(up.get() == nullptr) return;
+ if(up->is_use_qd()) get_qd_string();
+ if(up->is_use_fd()) get_fd_string();
+ if(up->is_use_hdd()) get_hdd_string();
+ if(up->is_use_tape() && !(up->is_tape_binary_only())) get_tape_string();
+ if(up->is_use_compact_disc()) get_cd_string();
+ if(up->is_use_bubble()) get_bubble_string();
}
void EmuThreadClassBase::get_fd_string(void)
--- /dev/null
+/*
+ Skelton for retropc emulator
+ Author : Takeda.Toshiya
+ Port to Qt : K.Ohta <whatisthis.sowhat _at_ gmail.com>
+ Date : 2015.11.10
+ History: 2023.02.24 Split from emu_thread_tmpl.cpp
+ Note: This class must be compiled per VM, must not integrate shared units.
+ [ win32 main ] -> [ Qt main ] -> [Emu Thread] -> [Input around KEYBOARD/MOUSE// ]
+// */
+
+// #include <QString>
+// #include <QWidget>
+// #include <QMouseEvent>
+#include <QTextCodec>
+
+#include "config.h"
+#include "emu_thread_tmpl.h"
+#include "mainwidget_base.h"
+#include "common.h"
+#include "osd_base.h"
+#include "../../osdcall_types.h"
+
+#include "virtualfileslist.h"
+#include "menu_metaclass.h"
+
+#include "menu_flags.h"
+
+
+void EmuThreadClassBase::moved_mouse(double x, double y, double globalx, double globaly)
+{
+ if(p_osd == nullptr) return;
+ std::shared_ptr<USING_FLAGS> p = using_flags;
+ if(p.get() == nullptr) return;
+
+ if(p->is_use_one_board_computer() || (p->get_max_button() > 0)) {
+ 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(p->is_use_mouse()) {
+// 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;
+ //printf("Mouse Moved: %d, %d\n", x, y);
+ p_osd->set_mouse_pointer(mouse_x, mouse_y);
+ }
+}
+
+void EmuThreadClassBase::button_pressed_mouse_sub(Qt::MouseButton button)
+{
+
+ if(p_osd == nullptr) return;
+ std::shared_ptr<USING_FLAGS> p = using_flags;
+ if(p.get() == nullptr) return;
+
+ if(p->is_use_one_board_computer() || p->is_use_mouse() || (p->get_max_button() > 0)) {
+ int stat = p_osd->get_mouse_button();
+ bool flag = (p_osd->is_mouse_enabled() || p->is_use_one_board_computer() || (p->get_max_button() > 0));
+ switch(button) {
+ case Qt::LeftButton:
+ stat |= 0x01;
+ break;
+ case Qt::RightButton:
+ stat |= 0x02;
+ break;
+ case Qt::MiddleButton:
+ flag = !flag;
+ emit sig_mouse_enable(flag);
+ return;
+ break;
+ default:
+ break;
+ }
+ if(!flag) return;
+ p_osd->set_mouse_button(stat);
+ }
+}
+
+void EmuThreadClassBase::button_released_mouse_sub(Qt::MouseButton button)
+{
+
+ if(p_osd == nullptr) return;
+ std::shared_ptr<USING_FLAGS> p = using_flags;
+ if(p.get() == nullptr) return;
+
+ if(p->is_use_one_board_computer() || p->is_use_mouse() || (p->get_max_button() > 0)) {
+ int stat = p_osd->get_mouse_button();
+ switch(button) {
+ case Qt::LeftButton:
+ stat &= 0x7ffffffe;
+ break;
+ case Qt::RightButton:
+ stat &= 0x7ffffffd;
+ break;
+ case Qt::MiddleButton:
+ //emit sig_mouse_enable(false);
+ break;
+ default:
+ break;
+ }
+ p_osd->set_mouse_button(stat);
+ }
+}
+
+void EmuThreadClassBase::button_pressed_mouse(Qt::MouseButton button)
+{
+ std::shared_ptr<USING_FLAGS> up = using_flags;
+ if(up.get() == nullptr) return;
+ if(up->is_use_mouse()) {
+ button_pressed_mouse_sub(button);
+ } else {
+ if(up->get_max_button() > 0) {
+ button_desc_t *vm_buttons_d = up->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 < up->get_max_button(); i++) {
+ 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;
+ sp.mod = key_mod;
+ sp.repeat = false;
+ enqueue_key_down(sp);
+ } else {
+ bResetReq = true;
+ }
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+}
+
+void EmuThreadClassBase::button_released_mouse(Qt::MouseButton button)
+{
+ std::shared_ptr<USING_FLAGS> up = using_flags;
+ if(up.get() == nullptr) return;
+ if(up->is_use_mouse()) {
+ button_released_mouse_sub(button);
+ } else {
+ if(up->get_max_button() > 0) {
+ button_desc_t *vm_buttons_d = up->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 < up->get_max_button(); i++) {
+ 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;
+ sp.mod = key_mod;
+ sp.repeat = false;
+ enqueue_key_up(sp);
+ }
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+}
+
+// New UI
+void EmuThreadClassBase::do_key_down(uint32_t vk, uint32_t mod, bool repeat)
+{
+ key_queue_t sp;
+ sp.code = vk;
+ sp.mod = mod;
+ sp.repeat = repeat;
+ //key_changed = true;
+ enqueue_key_down(sp);
+ key_mod = mod;
+}
+
+void EmuThreadClassBase::do_key_up(uint32_t vk, uint32_t mod)
+{
+ key_queue_t sp;
+ sp.code = vk;
+ sp.mod = mod;
+ sp.repeat = false;
+ enqueue_key_up(sp);
+ key_mod = mod;
+}
+
+void EmuThreadClassBase::do_start_auto_key(QString ctext)
+{
+ //QMutexLocker _locker(&uiMutex);
+ if(p_emu == nullptr) return;
+ std::shared_ptr<USING_FLAGS> p = using_flags;
+ if(p.get() == nullptr) return;
+
+ if(p->is_use_auto_key()) {
+ QTextCodec *codec = QTextCodec::codecForName("Shift-Jis");
+ QByteArray array;
+ QVector<uint> ucs4_src = ctext.toUcs4();
+ QString dst;
+ dst.clear();
+ uint32_t pool[8] = {0};
+ for(auto itr = ucs4_src.constBegin(); itr != ucs4_src.constEnd(); ++itr) {
+ uint val = (*itr);
+ int chrs = ucs4_kana_zenkaku_to_hankaku((const uint32_t)val, pool, sizeof(pool) / sizeof(uint32_t));
+ if(chrs > 0) {
+ #if QT_VERSION >= 0x060000
+ dst.append(QString::fromUcs4((char32_t*)pool, chrs));
+ #else
+ dst.append(QString::fromUcs4((uint*)pool, chrs));
+ #endif
+ }
+ }
+ clipBoardText = dst;
+ //printf("%s\n", clipBoardText.toLocal8Bit().constData());
+ array = codec->fromUnicode(clipBoardText);
+ //printf("Array is:");
+ //for(int l = 0; l < array.size(); l++) {
+ // printf("%02X ", array.at(l));
+ //}
+ //printf("\n");
+ if(clipBoardText.size() > 0) {
+ int size = array.size();
+ const char *buf = (char *)(array.constData());
+ p_emu->stop_auto_key();
+ p_emu->set_auto_key_list((char *)buf, size);
+ p_emu->start_auto_key();
+ }
+ }
+
+}
+
+void EmuThreadClassBase::do_stop_auto_key(void)
+{
+ //QMutexLocker _locker(&uiMutex);
+ //csp_logger->debug_log(CSP_LOG_DEBUG, CSP_LOG_TYPE_GENERAL,
+ // "AutoKey: stop\n");
+ if(p_emu == nullptr) return;
+ std::shared_ptr<USING_FLAGS> p = using_flags;
+ if(p.get() == nullptr) return;
+
+ if(p->is_use_auto_key()) {
+ p_emu->stop_auto_key();
+ }
+}
--- /dev/null
+/*
+ Skelton for retropc emulator
+ Author : Takeda.Toshiya
+ Port to Qt : K.Ohta <whatisthis.sowhat _at_ gmail.com>
+ Date : 2015.11.10
+ History: 2023.02.24 Split from emu_thread_tmpl.cpp
+ Note: This class must be compiled per VM, must not integrate shared units.
+ [ win32 main ] -> [ Qt main ] -> [Emu Thread] -> [Utilities]
+*/
+
+#include <QWidget>
+
+#include "config.h"
+#include "emu_thread_tmpl.h"
+#include "mainwidget_base.h"
+#include "common.h"
+#include "../../osdcall_types.h"
+
+#include "virtualfileslist.h"
+#include "menu_metaclass.h"
+
+#include "menu_flags.h"
+
+void EmuThreadClassBase::calc_volume_from_balance(int num, int balance)
+{
+ int level = volume_avg[num];
+ int right;
+ int left;
+ volume_balance[num] = balance;
+ right = level + balance;
+ left = level - balance;
+ p_config->sound_volume_l[num] = left;
+ p_config->sound_volume_r[num] = right;
+}
+
+void EmuThreadClassBase::calc_volume_from_level(int num, int level)
+{
+ int balance = volume_balance[num];
+ int right,left;
+ volume_avg[num] = level;
+ right = level + balance;
+ left = level - balance;
+ p_config->sound_volume_l[num] = left;
+ p_config->sound_volume_r[num] = right;
+}
+
+
+const _TCHAR *EmuThreadClassBase::get_device_name(void)
+{
+ return (const _TCHAR *)_T("TEST");
+}
+
+#if defined(Q_OS_LINUX)
+//#define _GNU_SOURCE
+#include <unistd.h>
+#include <sched.h>
+#include <pthread.h>
+#endif
+
+void EmuThreadClassBase::do_set_emu_thread_to_fixed_cpu_from_action(void)
+{
+ QAction *cp = qobject_cast<QAction*>(QObject::sender());
+ if(cp == nullptr) return;
+ int cpunum = cp->data().value<int>();
+ set_emu_thread_to_fixed_cpu(cpunum);
+}
+
+void EmuThreadClassBase::set_emu_thread_to_fixed_cpu(int cpunum)
+{
+#if defined(Q_OS_LINUX)
+ if(thread_id == (Qt::HANDLE)nullptr) {
+ queue_fixed_cpu = cpunum;
+ return;
+ }
+
+ long cpus = sysconf(_SC_NPROCESSORS_ONLN);
+ cpu_set_t *mask;
+ mask = CPU_ALLOC(cpus);
+ CPU_ZERO_S(CPU_ALLOC_SIZE(cpus), mask);
+ if((cpunum < 0) || (cpunum >= cpus)) {
+ for(int i = 0; i < cpus; i++ ) {
+ CPU_SET(i, mask);
+ }
+ } else {
+ CPU_SET(cpunum, mask);
+ }
+// sched_setaffinity((pid_t)thread_id, CPU_ALLOC_SIZE(cpus), (const cpu_set_t*)mask);
+ pthread_setaffinity_np(*((pthread_t*)thread_id), CPU_ALLOC_SIZE(cpus),(const cpu_set_t *)mask);
+ CPU_FREE(mask);
+#else
+ return;
+#endif
+ return;
+}
util_hdd2.cpp
../emu_thread/emu_thread_tmpl.cpp
+ ../emu_thread/utils.cpp
+ ../emu_thread/inputs.cpp
../emu_thread/emu_thread_slots.cpp
)
add_definitions(-D__GUI_LIBRARY_NAME=\"libCSPgui.${THIS_LIB_VERSION}\")