Note: See vm/fmtowns/joystick.cpp, FMTOWNS::JOYSTICK::update_config().
message("* common/common")
-#set(CMAKE_BUILD_SETTING_C_FLAGS "${CMAKE_C_FLAGS} -msse2 -msse -mmmx")
-
#add_library(common_emu
# emu.cpp
#)
config.numpad_enter_as_fullkey = true;
#endif
config.host_keyboard_type = CONFIG_HOST_KEYBOARD_AT_109JP;
-#endif
+ #endif
+ #if defined(USE_MACHINE_FEATURES)
+ for(int i = 0; i < 32; i++) {
+ config.machine_features[i] = 0;
+ }
+ #endif
}
void load_config(const _TCHAR *config_path)
#ifdef USE_DIPSWITCH
config.dipswitch = MyGetPrivateProfileInt(_T("Control"), _T("DipSwitch"), config.dipswitch, config_path);
#endif
+ #ifdef USE_MACHINE_FEATURES
+ for(int ii = 0; ii < USE_MACHINE_FEATURES; ii++) {
+ if(ii >= 32) break;
+ config.machine_features[ii] =
+ MyGetPrivateProfileInt(_T("Control"),
+ create_string(_T("MachineFeatures%d"), ii),
+ config.machine_features[ii], config_path);
+
+ }
+ #endif
#ifdef USE_DEVICE_TYPE
config.device_type = MyGetPrivateProfileInt(_T("Control"), _T("DeviceType"), config.device_type, config_path);
#endif
#ifdef USE_DIPSWITCH
MyWritePrivateProfileInt(_T("Control"), _T("DipSwitch"), config.dipswitch, config_path);
#endif
+ #ifdef USE_MACHINE_FEATURES
+ for(int ii = 0; ii < USE_MACHINE_FEATURES; ii++) {
+ if(ii >= 32) break;
+ MyWritePrivateProfileInt(_T("Control"),
+ create_string(_T("MachineFeatures%d"), ii),
+ config.machine_features[ii], config_path);
+
+ }
+ #endif
#ifdef USE_DEVICE_TYPE
MyWritePrivateProfileInt(_T("Control"), _T("DeviceType"), config.device_type, config_path);
#endif
int virtual_media_position; // -1 = none, 1, 2, 3, 4 = LRUD
#endif
-
+ // 20210728 K.O
+ // Belows are machine features config (without DIPSW. I.E. joystick ports
+#if defined(USE_FIXED_CONFIG) || defined(USE_MACHINE_FEATURES)
+ uint32_t machine_features[32];
+#endif
} config_t;
extern config_t DLL_PREFIX_I config;
message("* qt/osd")
-SET(THIS_LIB_VERSION 3.6.0)
+SET(THIS_LIB_VERSION 3.7.0)
set(s_qt_osd_headers
osd_base.h
message("* qt/avio")
-SET(THIS_LIB_VERSION 3.3.0)
+SET(THIS_LIB_VERSION 3.4.0)
set(s_qt_avio_headers
movie_saver.h
movie_loader.h
#if defined(USE_DIPSWITCH)
use_dipswitch = true;
#endif
+#if defined(USE_MACHINE_FEATURES)
+ use_machine_features = USE_MACHINE_FEATURES;
+#endif
#if defined(USE_DRIVE_TYPE)
use_drive_type = USE_DRIVE_TYPE;
#endif
message("* qt/emuutils")
-SET(THIS_LIB_VERSION 3.0.0)
+SET(THIS_LIB_VERSION 3.1.0)
set(s_qt_emuutils_headers
../gui/csp_logger.h
message("* qt/gui")
-set(THIS_LIB_VERSION 3.6.0)
+set(THIS_LIB_VERSION 3.7.0)
set(s_qt_gui_headers
qt_dialogs.h
void do_stop_saving_movie(void);
void do_set_monitor_type();
void do_select_fixed_cpu(void);
+
+ void do_select_machine_feature_single(void);
signals:
int on_boot_mode(int);
int sig_printer_device(int);
int sig_drive_type(int);
int sig_emu_update_config(void);
-
+ int sig_set_machine_feature(int, uint32_t);
+
int set_recent_quick_disk(int, int);
int sig_write_protect_Qd(int, bool);
int sig_eject_Qd(int);
int sig_screen_size(int, int);
int sig_screen_multiply(float);
int sig_screen_rotate(int);
-
+
int sig_monitor_type(int);
int sig_set_fixed_cpu(int);
class Action_Control *actionSoundDevice[32]; //
class Action_Control *actionPrintDevice[16];
class Action_Control *action_SetRenderPlatform[MAX_RENDER_PLATFORMS];
+
class Action_Control *actionStart_Record_Movie;
class Action_Control *actionStop_Record_Movie;
void _open_cart(int drv, const QString fname);
void eject_cmt(int drv);
+
void do_change_boot_mode(int mode);
void do_change_cpu_type(int mode);
+
void do_write_protect_cmt(int drv, bool flag);
int set_recent_cmt(int drv, int num);
void set_wave_shaper(int drive, bool f);
void do_show_ram_size_dialog(void);
void do_block_task();
void do_unblock_task();
-
+
+ void do_select_machine_feature(int devnum, uint32_t value);
+
void do_start_emu_thread();
void do_start_draw_thread();
signals:
}
}
+// Note: YOU MUST ADD OWN ACTION ENTRIES TO MENU; menuMachineFeatures[foo].
+void Ui_MainWindowBase::ConfigMachineFeatures(void)
+{
+ for(int i = 0; i < using_flags->get_use_machine_features(); i++) {
+
+ menuMachineFeatures[i] = new QMenu(menuMachine);
+ menuMachineFeatures[i]->setObjectName(QString::fromUtf8("menuMachineFeatures"));
+ menuMachine->addAction(menuMachineFeatures[i]->menuAction());
+ menuMachineFeatures[i]->setToolTipsVisible(true);
+ }
+}
+
void Ui_MainWindowBase::ConfigKeyboardType(void)
{
if(using_flags->get_use_keyboard_type() > 0) {
emit sig_set_fixed_cpu(getValue1());
}
+// ToDo: Call dialogs.
+void Object_Menu_Control::do_select_machine_feature_single(void)
+{
+ int devnum = getNumber();
+ uint32_t value = (uint32_t)getValue1();
+ emit sig_set_machine_feature(devnum, value);
+ // Not NEED to call sig_emu_update_config()
+}
+
void Object_Menu_Control::do_set_monitor_type()
{
emit sig_monitor_type(getValue1());
int use_device_type;
int use_mouse_type;
bool use_dipswitch;
-
+ int use_machine_features;
+
bool use_ram_size;
int max_ram_size;
int min_ram_size;
int get_use_device_type() { return use_device_type; }
int get_use_mouse_type() { return use_mouse_type; }
bool is_use_dipswitch() { return use_dipswitch; }
+ int get_use_machine_features() { return use_machine_features; }
+
int get_use_drive_type() { return use_drive_type; }
use_joystick_type = -1;
use_keyboard_type = -1;
use_dipswitch = false;
-
+ use_machine_features = 0;
use_drive_type = 0;
use_fd = false;
{
}
+
_TCHAR *USING_FLAGS::get_vm_node_name(int id)
{
return (_TCHAR *)"NODE";
}
}
+
void Ui_MainWindowBase::do_show_ram_size_dialog(void)
{
CSP_MemoryDialog *dlg = new CSP_MemoryDialog(using_flags, NULL);
}
}
+void Ui_MainWindowBase::do_set_machine_feature(int devnum, uint32_t value)
+{
+ if((devnum < 0) || (devnum >= using_flags->get_use_machine_features())) return;
+ p_config->machine_features[devnum] = value;
+ emit sig_emu_update_config();
+}
+
void Ui_MainWindowBase::set_dipsw(int num, bool flag)
{
if((num < 0) || (num >= 32)) return;
actionSpecial_Reset[10]->setToolTip(QApplication::translate("Machine", "Reset with boot from IC CARD #0", 0));
actionSpecial_Reset[11]->setText(QApplication::translate("Machine", "Reset with DEBUG", 0));
actionSpecial_Reset[11]->setToolTip(QApplication::translate("Machine", "Reset with DEBUGGING MODE", 0));
-# if defined(USE_MOUSE_TYPE)
- menuMouseType->setTitle(QApplication::translate("Machine", "Mouse", 0));
- menuMouseType->setToolTipsVisible(true);
- actionMouseType[0]->setText(QApplication::translate("Machine", "none", 0));
- actionMouseType[0]->setToolTip(QApplication::translate("Machine", "Not connect mouse.", 0));
- actionMouseType[1]->setText(QApplication::translate("Machine", "PAD port1", 0));
- actionMouseType[1]->setToolTip(QApplication::translate("Machine", "Connect mouse to PAD port #1.", 0));
- actionMouseType[2]->setText(QApplication::translate("Machine", "PAD port2", 0));
- actionMouseType[2]->setToolTip(QApplication::translate("Machine", "Connect mouse to PAD port #2.", 0));
-# endif
-#if defined(USE_JOYSTICK_TYPE)
- actionJoystickType[0]->setText(QApplication::translate("Machine", "None", 0));
- actionJoystickType[0]->setToolTip(QApplication::translate("Machine", "NotConnected.", 0));
- actionJoystickType[1]->setText(QApplication::translate("Machine", "2 buttons", 0));
- actionJoystickType[1]->setToolTip(QApplication::translate("Machine", "Connect 2 buttons Towns PAD to PORTs.", 0));
- actionJoystickType[2]->setText(QApplication::translate("Machine", "6 buttons", 0));
- actionJoystickType[2]->setToolTip(QApplication::translate("Machine", "Connect 6 buttons Towns PAD to PORTs.", 0));
- menuJoystickType->setTitle(QApplication::translate("Machine", "Towns PAD", 0));
+
+ menuMAchineFeatures[0]->setTitle(QApplication::translate("Machine", "Joystick Port #1", 0));
+ menuMAchineFeatures[1]->setTitle(QApplication::translate("Machine", "Joystick Port #2", 0));
+#if defined(USE_MACHINE_FEATURES)
+ for(int i = 0; i < 2; i++) {
+ actionJOYPORT_TYPE[i][0]->setText(QApplication::translate("Machine", "none", 0));
+ actionJOYPORT_TYPE[i][1]->setText(QApplication::translate("Machine", "2Buttons PAD", 0));
+ actionJOYPORT_TYPE[i][2]->setText(QApplication::translate("Machine", "6Buttons PAD", 0));
+ actionJOYPORT_TYPE[i][3]->setText(QApplication::translate("Machine", "Towns Mouse", 0));
+ actionJOYPORT_TYPE[i][4]->setText(QApplication::translate("Machine", "Analog Stick", 0));
+ actionJOYPORT_TYPE[i][5]->setText(QApplication::translate("Machine", "Joystick for Libble Rabble", 0));
+ for(int j = 0; j < 4; j++) {
+ actionJOYPORT_TYPE[i][j]->setEnabled(true);
+ }
+ for(int j = 4; j < 6; j++) {
+ actionJOYPORT_TYPE[i][j]->setEnabled(false);
+ }
+
+ actionJOYPORT_TYPE[i][0]->setToolTip(QApplication::translate("Machine", "No devices are connected to this port", 0));
+ actionJOYPORT_TYPE[i][1]->setToolTip(QApplication::translate("Machine", "Connect standard Towns PAD, 2Buttons.", 0));
+ actionJOYPORT_TYPE[i][2]->setToolTip(QApplication::translate("Machine", "Connect extended Towns PAD, 6Buttons.", 0));
+ actionJOYPORT_TYPE[i][3]->setToolTip(QApplication::translate("Machine", "Connect MOUSE", 0));
+ actionJOYPORT_TYPE[i][4]->setToolTip(QApplication::translate("Machine", "Connect analog joystick, this still be unimplemented", 0));
+ actionJOYPORT_TYPE[i][5]->setToolTip(QApplication::translate("Machine", "Connect hacked joystick for Libble Rabble, this still be unimplemented.", 0));
+
+ }
#endif
+
#if defined(USE_CART)
if(menu_Cart[0] != NULL) {
menu_Cart[0]->setTitle(QApplication::translate("MainWindow", "IC1", 0));
void META_MainWindow::setupUI_Emu(void)
{
+#if defined(USE_MACHINE_FEATURES)
+ // menuMachineFeatures[0] : Joystick Port #1
+ // menuMachineFeatures[1] : Joystick Port #2
+ // menuMachineFeatures[2] : Reserved
+ // menuMachineFeatures[3] : Reserved
+ // menuMachineFeatures[4] : Reserved
+ // menuMachineFeatures[5] : Reserved
+ for(int i = 0; i < 2; i++) {
+ actionGroup_JOYPortType[i] = new QActionGroup(this);
+ actionGroup_JOYPortType[i]->setExclusive(true);
+ actionGroup_JOYPortType[i]->setObjectName(QString("actionGroupJOYPort%1").arg(i + 1));
+ menuMachineFeatures[i]->addAction(actionGroup_JOYPortType[i]);
+ for(int j = 0; j < 8; j++) {
+ actionJOYPORT_TYPE[i][j] = new Action_Control(this, using_flags);
+ actionJOYPORT_TYPE[i][j]->setCheckable(true);
+ actionJOYPORT_TYPE[i][j]->setVisible(false);
+ if(p_config->machine_features[i] == (uint32_t)j) {
+ actionJOYPORT_TYPE[i][j]->setChecked(true);
+ } else {
+ actionJOYPORT_TYPE[i][j]->setChecked(false);
+ }
+ actionJOYPORT_TYPE[i][j]->binds->setNumber(i);
+ actionJOYPORT_TYPE[i][j]->binds->setValue1(j);
+ actionGroup_JOYPortType[i]->addAction(actionJOYPORT_TYPE[i][j]);
+ connect(actionJOYPORT_TYPE[i][j], SIGNAL(triggered()),
+ actionJOYPORT_TYPE[i][j]->binds, SLOT(do_select_machine_feature_single()));
+ connect(actionJOYPORT_TYPE[i][j]->binds,
+ SIGNAL(sig_set_machine_feature(int, uint32_t)),
+ this, SLOT(do_set_machine_feature(int, uint32_t)));
+ }
+ for(int j = 0; j < 6; j++) {
+ actionJOYPORT_TYPE[i][j]->setVisible(true);
+ }
+ }
+ for(int i = 2; i < 6; i++) {
+ menuMachineFeatures[i]->setVisible(false);
+ menuMachineFeatures[i]->setEnabled(false);
+ }
+#endif
}
class META_MainWindow : public Ui_MainWindow {
Q_OBJECT
protected:
+ QActionGroup *actionGroup_JOYPortType[2];
+ Action_Control *actionJOYPORT_TYPE[2][8];
+
void setupUI_Emu(void);
void retranslateUi(void);
public:
META_MainWindow(USING_FLAGS *p, CSP_Logger *logger, QWidget *parent = 0);
~META_MainWindow();
+
+public slots:
};
QT_END_NAMESPACE
message("* vm/common_vm")
-SET(THIS_LIB_VERSION 3.8.0)
+SET(THIS_LIB_VERSION 3.9.0)
#include(cotire)
set(s_vm_common_vm_srcs
cmake_minimum_required (VERSION 2.6)
message("* vm/fmgen")
-SET(THIS_LIB_VERSION 1.11.2)
+SET(THIS_LIB_VERSION 1.12.0)
add_definitions(-D__LIBFMGEN_VERSION=\"libCSPfmgen.${THIS_LIB_VERSION}\")
SET(s_vm_fmgen_srcs
timer->set_context_halt_line(cpu, SIG_CPU_HALTREQ, 0xffffffff);
for(int i = 0; i < 2; i++) {
+ // type =
+ // 0: Towns PAD 2buttons
+ // 1: Towns PAD 6buttons
+ // 2: Towns MOUSE
+ // 3: Analog Pad (reserved)
+ // 4: Libble Rabble stick (reserved)
joystick->set_context_joystick(i, joypad_2btn[i]);
joystick->set_context_joystick(i, joypad_6btn[i]);
+
}
// ToDo: Selective by config.
for(int i = 0; i < 2; i++) {
//#define _IO_DEBUG_LOG
// device informations for win32
-#define USE_CPU_TYPE 2
-#define USE_FLOPPY_DISK 4 // ??
-#define USE_CART 2
-#define USE_SPECIAL_RESET 12 /* 'CD' 'F0' - 'F3' 'H0' - 'H4' 'ICM' 'DEBUG' */
-#define USE_FLOPPY_TYPE_BIT 0x0003 /* 5.0, 5.0, 3.5, 3.5 */
-
+#define USE_CPU_TYPE 2
+#define USE_FLOPPY_DISK 4 // ??
+#define USE_CART 2
+#define USE_SPECIAL_RESET 12 /* 'CD' 'F0' - 'F3' 'H0' - 'H4' 'ICM' 'DEBUG' */
+#define USE_FLOPPY_TYPE_BIT 0x0003 /* 5.0, 5.0, 3.5, 3.5 */
+#define USE_MACHINE_FEATURES 8
#define NOTIFY_KEY_DOWN
#define USE_ALT_F10_KEY
#define USE_AUTO_KEY 5
#define USE_SOUND_FILES_FDD
#define USE_JOYSTICK
#define USE_JOY_BUTTON_CAPTIONS
-#define USE_JOYSTICK_TYPE 3
-#define JOYSTICK_TYPE_DEFAULT 0
#define USE_MOUSE
-#define USE_MOUSE_TYPE 3
#define USE_CUSTOM_SCREEN_ZOOM_FACTOR 1.25
#if defined(USE_SOUND_FILES)
void JOYSTICK::write_data_to_port(uint8_t data)
{
- //std::unique_lock<std::mutex> _l = lock_device();
+ std::unique_lock<std::mutex> _l = lock_device();
reg_val = data;
for(int num = 0; num < 2; num++) {
void JOYSTICK::update_config(void)
{
+ std::unique_lock<std::mutex> _l = lock_device();
+ // BEGIN JOYPORT.
+ // config.machine_features[0,1] : JOYPORT 1,2
+ // value =
+ // 0: None connected
+ // 1: Towns PAD 2buttons
+ // 2: Towns PAD 6buttons
+ // 3: Towns MOUSE
+ // 4: Analog Pad (reserved)
+ // 5: Libble Rabble stick (reserved)
+ bool change_jsport = false;
+ const int js_limit = 2;
+ for(int i = 0; i < 2; i++) {
+ if((port_using[i] + 1) != config.machine_features[i]) {
+ change_jsport = true ;
+ if((port_using[i] >= 0) && (port_using[i] < port_count[i])) {
+ JSDEV_TEMPLATE* p = d_port[i][port_using[i]];
+ if(p != nullptr) {
+ p->set_enable(false); // Disconnect
+ }
+ }
+ if((config.machine_features[i] > 0) && (config.machine_features[i] <= js_limit)) {
+ JSDEV_TEMPLATE* p = d_port[i][config.machine_features[i] - 1];
+ if(p != nullptr) {
+ p->set_enable(true);
+ p->reset_device();
+ p->query(_stat); // Query Twice.
+ }
+ }
+ }
+ }
+// if(change_jsport) {
+ write_data_to_port(reg_val);
+// }
+ for(int i = 0; i < 2; i++) {
+ if((config.machine_features[i] > 0) && (config.machine_features[i] <= js_limit)) {
+ JSDEV_TEMPLATE* p = d_port[i][config.machine_features[i] - 1];
+ if(p != nullptr) {
+ port_using[i] = ((int)config.machine_features[i]) - 1;
+ } else {
+ port_using[i] = -1;
+ }
+ } else {
+ port_using[i] = -1;
+ }
+ }
+ // END JOYPORT.
}
-#define STATE_VERSION 16
+#define STATE_VERSION 17
bool JOYSTICK::process_state(FILEIO *state_fio, bool loading)
{
- //std::unique_lock<std::mutex> _l = lock_device();
+ std::unique_lock<std::mutex> _l = lock_device();
if(!state_fio->StateCheckUint32(STATE_VERSION)) {
return false;
state_fio->StateValue(reg_val);
state_fio->StateArray(data_reg, sizeof(data_reg), 1);
state_fio->StateArray(stat_com, sizeof(stat_com), 1);
+
+ state_fio->StateArray(port_using, sizeof(port_using), 1);
if(loading) {
for(int i = 0; i < 2; i++) {
{
return std::unique_lock<std::mutex>(_locker, std::adopt_lock);
}
- void unlock_device(std::unique_lock<std::mutex> _l)
- {
- std::mutex* p = _l.release();
- if(p != nullptr) {
- p->unlock();
- }
- }
public:
JOYSTICK(VM_TEMPLATE* parent_vm, EMU_TEMPLATE* parent_emu) : DEVICE(parent_vm, parent_emu)
{
}
}
- // @note: DEVICE MUST NOT RESET WITHIN reset(), must reset within reset_device().
- virtual void reset_device()
- {
-
- initialize_status();
- output_port_signals(false);
- output_port_com(val_com, false);
- }
virtual void initialize_status()
{
//std::unique_lock<std::mutex> _l = lock_device();
//std::unique_lock<std::mutex> _l = lock_device();
parent_port_num = -1;
+ d_parent_device = NULL;
pad_num = -1;
pad_type = 0;
signal_shift = 0;
signal_mask = 0xffffffff;
- d_parent_device = NULL;
is_connected = false;
- is_negative_logic = false;
force_output_on_change = false;
//unlock_device(_l);
force_output_on_change = val;
}
+ // @note: DEVICE MUST NOT RESET WITHIN reset(), must reset within reset_device().
+ virtual void reset_device()
+ {
+ initialize_status();
+ output_port_signals(false);
+ output_port_com(val_com, false);
+ }
virtual void set_enable(bool is_enable)
{
//std::unique_lock<std::mutex> _l = lock_device();