Merge remote-tracking branch 'TasVideos/master' into Qt_WinBuild
This commit is contained in:
commit
deea77a30b
|
@ -83,6 +83,7 @@ int closeGamePadConfWindow(void)
|
|||
//----------------------------------------------------
|
||||
GamePadConfDialog_t::GamePadConfDialog_t(QWidget *parent)
|
||||
: QDialog( parent )
|
||||
, changeSeqStatus(0)
|
||||
{
|
||||
QWidget *mainWidget;
|
||||
QVBoxLayout *mainLayout;
|
||||
|
@ -98,6 +99,7 @@ GamePadConfDialog_t::GamePadConfDialog_t(QWidget *parent)
|
|||
QPushButton *removeProfileButton;
|
||||
QPushButton *clearAllButton;
|
||||
QPushButton *closebutton;
|
||||
QPushButton *changeSeqButton = nullptr;
|
||||
QPushButton *clearButton[GAMEPAD_NUM_BUTTONS];
|
||||
QScrollArea *scroll;
|
||||
QStyle *style;
|
||||
|
@ -267,11 +269,14 @@ GamePadConfDialog_t::GamePadConfDialog_t(QWidget *parent)
|
|||
|
||||
clearAllButton = new QPushButton(tr("Clear All"));
|
||||
closebutton = new QPushButton(tr("Close"));
|
||||
changeSeqButton = new QPushButton(tr("Change Sequentially"));
|
||||
|
||||
clearAllButton->setIcon( style->standardIcon( QStyle::SP_LineEditClearButton ) );
|
||||
closebutton->setIcon( style->standardIcon( QStyle::SP_DialogCloseButton ) );
|
||||
changeSeqButton->setIcon( style->standardIcon( QStyle::QStyle::SP_ArrowDown ) );
|
||||
|
||||
hbox4->addWidget( clearAllButton );
|
||||
hbox4->addWidget( changeSeqButton );
|
||||
hbox4->addWidget( closebutton );
|
||||
|
||||
connect(button[0], SIGNAL(clicked()), this, SLOT(changeButton0(void)) );
|
||||
|
@ -303,6 +308,7 @@ GamePadConfDialog_t::GamePadConfDialog_t(QWidget *parent)
|
|||
|
||||
connect(clearAllButton , SIGNAL(clicked()), this, SLOT(clearAllCallback(void)) );
|
||||
connect(closebutton , SIGNAL(clicked()), this, SLOT(closeWindow(void)) );
|
||||
connect(changeSeqButton , SIGNAL(clicked()), this, SLOT(changeSequentallyCallback(void)) );
|
||||
|
||||
connect(portSel , SIGNAL(activated(int)), this, SLOT(portSelect(int)) );
|
||||
connect(devSel , SIGNAL(activated(int)), this, SLOT(deviceSelect(int)) );
|
||||
|
@ -557,14 +563,19 @@ void GamePadConfDialog_t::changeButton(int padNo, int x)
|
|||
ButtonConfigBegin ();
|
||||
|
||||
button[x]->setText("Waiting" );
|
||||
button[x]->setStyleSheet("background-color: green; color: white;");
|
||||
|
||||
DWaitButton (NULL, &GamePad[padNo].bmap[x], &buttonConfigStatus );
|
||||
|
||||
keyNameStr = ButtonName( &GamePad[padNo].bmap[x] );
|
||||
|
||||
keyName[x]->setText( keyNameStr );
|
||||
button[x]->setText("Change");
|
||||
button[x]->setStyleSheet("");
|
||||
|
||||
if (buttonConfigStatus != 0)
|
||||
{
|
||||
keyNameStr = ButtonName( &GamePad[padNo].bmap[x] );
|
||||
keyName[x]->setText( keyNameStr );
|
||||
lcl[padNo].btn[x].needsSave = 1;
|
||||
}
|
||||
|
||||
ButtonConfigEnd ();
|
||||
|
||||
|
@ -582,6 +593,17 @@ void GamePadConfDialog_t::clearButton( int padNo, int x )
|
|||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
if (changeSeqStatus != 0)
|
||||
{
|
||||
// change sequentially still in progress
|
||||
// now try to abort its progress
|
||||
changeSeqStatus = -1;
|
||||
// ... out from waiting gamepad button event loop
|
||||
buttonConfigStatus = 0;
|
||||
// and ignore this event
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
promptToSave();
|
||||
|
||||
printf("GamePad Close Window Event\n");
|
||||
|
@ -593,6 +615,16 @@ void GamePadConfDialog_t::closeEvent(QCloseEvent *event)
|
|||
//----------------------------------------------------
|
||||
void GamePadConfDialog_t::closeWindow(void)
|
||||
{
|
||||
if (changeSeqStatus != 0)
|
||||
{
|
||||
// change sequentially still in progress
|
||||
// now try to abort its progress
|
||||
changeSeqStatus = -1;
|
||||
// ... out from waiting gamepad button event loop
|
||||
buttonConfigStatus = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
promptToSave();
|
||||
|
||||
printf("Close Window\n");
|
||||
|
@ -947,6 +979,34 @@ void GamePadConfDialog_t::updatePeriodic(void)
|
|||
efs_chkbox->setChecked( fourScore );
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
void GamePadConfDialog_t::changeSequentallyCallback(void)
|
||||
{
|
||||
// get pointer to button
|
||||
QPushButton* changeSeqButton = qobject_cast<QPushButton*>(sender());
|
||||
if (!changeSeqButton)
|
||||
return;
|
||||
|
||||
// disable it for user input
|
||||
changeSeqButton->setEnabled(false);
|
||||
|
||||
// change button for every button on gamepad
|
||||
for (int i = 0; i < GAMEPAD_NUM_BUTTONS; ++i)
|
||||
{
|
||||
changeSeqStatus += 1;
|
||||
if (this->isHidden()) break;
|
||||
changeButton(portNum, i);
|
||||
if (this->isHidden()) break;
|
||||
// abort?
|
||||
if (changeSeqStatus == -1) break;
|
||||
}
|
||||
// return all back
|
||||
changeSeqStatus = 0;
|
||||
changeSeqButton->setEnabled(true);
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
GamePadConfigButton_t::GamePadConfigButton_t(int i)
|
||||
{
|
||||
|
|
|
@ -52,6 +52,10 @@ class GamePadConfDialog_t : public QDialog
|
|||
|
||||
int portNum;
|
||||
int buttonConfigStatus;
|
||||
int changeSeqStatus; // status of sequentally changing buttons mechanism
|
||||
// 0 - we can start new change process
|
||||
// 1-10 - changing in progress
|
||||
// -1 - changing is aborted
|
||||
|
||||
void changeButton( int port, int button );
|
||||
void clearButton( int port, int button );
|
||||
|
@ -98,6 +102,7 @@ class GamePadConfDialog_t : public QDialog
|
|||
void saveProfileCallback(void);
|
||||
void deleteProfileCallback(void);
|
||||
void updatePeriodic(void);
|
||||
void changeSequentallyCallback(void);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1243,7 +1243,14 @@ void RamSearchDialog_t::addRamWatchClicked(void)
|
|||
}
|
||||
strcpy( desc, "Quick Watch Add");
|
||||
|
||||
ramWatchList.add_entry( desc, addr, dpyType, dpySize, 0 );
|
||||
int size = 1;
|
||||
switch (dpySize) {
|
||||
case 'd': size = 4; break;
|
||||
case 'w': size = 2; break;
|
||||
case 'b': size = 1; break;
|
||||
default: break;
|
||||
}
|
||||
ramWatchList.add_entry( desc, addr, dpyType, size, 0 );
|
||||
|
||||
openRamWatchWindow(consoleWindow);
|
||||
}
|
||||
|
|
|
@ -728,14 +728,17 @@ void ramWatch_t::updateMem (void)
|
|||
}
|
||||
else if (size == 2)
|
||||
{
|
||||
val.u16 = GetMem (addr) | (GetMem (addr + 1) << 8);
|
||||
val.u16 = (GetMem (addr) << 8) | GetMem (addr + 1);
|
||||
}
|
||||
else
|
||||
else if (size == 4)
|
||||
{
|
||||
val.u8 = GetMem (addr);
|
||||
val.u32 = GetMem (addr + 3);
|
||||
val.u32 |= GetMem (addr + 2) << 8;
|
||||
val.u32 |= GetMem (addr + 1) << 16;
|
||||
val.u32 |= GetMem (addr ) << 24;
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------.----
|
||||
void RamWatchDialog_t::openWatchEditWindow( ramWatch_t *rw, int mode)
|
||||
{
|
||||
int ret, isSep = 0;
|
||||
|
|
|
@ -20,13 +20,13 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
//#include <unistd.h>
|
||||
//#include <sys/types.h>
|
||||
//#include <sys/ipc.h>
|
||||
//#include <sys/shm.h>
|
||||
//#include <sys/stat.h>
|
||||
//#include <fcntl.h>
|
||||
//#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "Qt/nes_shm.h"
|
||||
|
||||
|
@ -39,35 +39,7 @@ nes_shm_t *open_nes_shm(void)
|
|||
|
||||
vaddr = (nes_shm_t*)malloc( sizeof(struct nes_shm_t) );
|
||||
|
||||
memset(vaddr, 0, sizeof(struct nes_shm_t));
|
||||
|
||||
//int shmId;
|
||||
//struct shmid_ds ds;
|
||||
|
||||
//shmId = shmget( IPC_PRIVATE, sizeof(struct nes_shm_t), IPC_CREAT | S_IRWXU | S_IRWXG );
|
||||
|
||||
//if ( shmId == -1 )
|
||||
//{
|
||||
// perror("Error: GL shmget Failed:");
|
||||
// return NULL;
|
||||
//}
|
||||
//printf("Created ShmID: %i \n", shmId );
|
||||
|
||||
//vaddr = (nes_shm_t*)shmat( shmId, NULL, 0);
|
||||
|
||||
//if ( vaddr == (nes_shm_t*)-1 )
|
||||
//{
|
||||
// perror("Error: NES shmat Failed:");
|
||||
// return NULL;
|
||||
//}
|
||||
//memset( vaddr, 0, sizeof(struct nes_shm_t));
|
||||
|
||||
//if ( shmctl( shmId, IPC_RMID, &ds ) != 0 )
|
||||
//{
|
||||
// perror("Error: GLX shmctl IPC_RMID Failed:");
|
||||
//}
|
||||
|
||||
//sem_init( &vaddr->sem, 1, 1 );
|
||||
memset( vaddr, 0, sizeof(struct nes_shm_t));
|
||||
|
||||
vaddr->video.ncol = 256;
|
||||
vaddr->video.nrow = 256;
|
||||
|
|
Loading…
Reference in New Issue