Added FCEU_WRAPPER_LOCK macros to allow for tracking of critical section mutex locking.

This commit is contained in:
mjbudd77 2021-12-29 15:56:47 -05:00
parent 425e3104de
commit 68693ca29d
22 changed files with 459 additions and 391 deletions

View File

@ -545,13 +545,13 @@ void GuiCheatsDialog_t::showCheatSearchResults(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void GuiCheatsDialog_t::resetSearchCallback(void) void GuiCheatsDialog_t::resetSearchCallback(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_CheatSearchBegin(); FCEUI_CheatSearchBegin();
showCheatSearchResults(); showCheatSearchResults();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
knownValBtn->setEnabled(true); knownValBtn->setEnabled(true);
eqValBtn->setEnabled(true); eqValBtn->setEnabled(true);
@ -573,7 +573,7 @@ void GuiCheatsDialog_t::knownValueCallback(void)
{ {
int value; int value;
//printf("Cheat Search Known!\n"); //printf("Cheat Search Known!\n");
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
//printf("'%s'\n", knownValEntry->displayText().toStdString().c_str() ); //printf("'%s'\n", knownValEntry->displayText().toStdString().c_str() );
@ -583,19 +583,19 @@ void GuiCheatsDialog_t::knownValueCallback(void)
showCheatSearchResults(); showCheatSearchResults();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void GuiCheatsDialog_t::equalValueCallback(void) void GuiCheatsDialog_t::equalValueCallback(void)
{ {
//printf("Cheat Search Equal!\n"); //printf("Cheat Search Equal!\n");
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_CheatSearchEnd(FCEU_SEARCH_PUERLY_RELATIVE_CHANGE, 0, 0); FCEUI_CheatSearchEnd(FCEU_SEARCH_PUERLY_RELATIVE_CHANGE, 0, 0);
showCheatSearchResults(); showCheatSearchResults();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void GuiCheatsDialog_t::notEqualValueCallback(void) void GuiCheatsDialog_t::notEqualValueCallback(void)
@ -604,7 +604,7 @@ void GuiCheatsDialog_t::notEqualValueCallback(void)
int value; int value;
int checked = useNeVal->checkState() != Qt::Unchecked; int checked = useNeVal->checkState() != Qt::Unchecked;
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
if (checked) if (checked)
{ {
@ -619,7 +619,7 @@ void GuiCheatsDialog_t::notEqualValueCallback(void)
showCheatSearchResults(); showCheatSearchResults();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void GuiCheatsDialog_t::greaterThanValueCallback(void) void GuiCheatsDialog_t::greaterThanValueCallback(void)
@ -628,7 +628,7 @@ void GuiCheatsDialog_t::greaterThanValueCallback(void)
int value; int value;
int checked = useGrVal->checkState() != Qt::Unchecked; int checked = useGrVal->checkState() != Qt::Unchecked;
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
if (checked) if (checked)
{ {
@ -643,7 +643,7 @@ void GuiCheatsDialog_t::greaterThanValueCallback(void)
showCheatSearchResults(); showCheatSearchResults();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void GuiCheatsDialog_t::lessThanValueCallback(void) void GuiCheatsDialog_t::lessThanValueCallback(void)
@ -652,7 +652,7 @@ void GuiCheatsDialog_t::lessThanValueCallback(void)
int value; int value;
int checked = useLtVal->checkState() != Qt::Unchecked; int checked = useLtVal->checkState() != Qt::Unchecked;
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
if (checked) if (checked)
{ {
@ -667,7 +667,7 @@ void GuiCheatsDialog_t::lessThanValueCallback(void)
showCheatSearchResults(); showCheatSearchResults();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int GuiCheatsDialog_t::activeCheatListCB(char *name, uint32 a, uint8 v, int c, int s, int type, void *data) int GuiCheatsDialog_t::activeCheatListCB(char *name, uint32 a, uint8 v, int c, int s, int type, void *data)
@ -779,7 +779,7 @@ void GuiCheatsDialog_t::openCheatFile(void)
g_config->setOption("SDL.LastOpenFile", filename.toStdString().c_str()); g_config->setOption("SDL.LastOpenFile", filename.toStdString().c_str());
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
fp = fopen(filename.toStdString().c_str(), "r"); fp = fopen(filename.toStdString().c_str(), "r");
@ -788,7 +788,7 @@ void GuiCheatsDialog_t::openCheatFile(void)
FCEU_LoadGameCheats(fp, 0); FCEU_LoadGameCheats(fp, 0);
fclose(fp); fclose(fp);
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
showActiveCheatList(true); showActiveCheatList(true);
@ -850,7 +850,7 @@ void GuiCheatsDialog_t::saveCheatFile(void)
//g_config->setOption ("SDL.LastOpenFile", filename.toStdString().c_str() ); //g_config->setOption ("SDL.LastOpenFile", filename.toStdString().c_str() );
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
fp = FCEUD_UTF8fopen(filename.toStdString().c_str(), "wb"); fp = FCEUD_UTF8fopen(filename.toStdString().c_str(), "wb");
@ -859,7 +859,7 @@ void GuiCheatsDialog_t::saveCheatFile(void)
FCEU_SaveGameCheats(fp); FCEU_SaveGameCheats(fp);
fclose(fp); fclose(fp);
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
showActiveCheatList(true); showActiveCheatList(true);
@ -890,9 +890,9 @@ void GuiCheatsDialog_t::addActvCheat(void)
name = cheatNameEntry->text().toStdString(); name = cheatNameEntry->text().toStdString();
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_AddCheat(name.c_str(), a, v, c, 1); FCEUI_AddCheat(name.c_str(), a, v, c, 1);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
showActiveCheatList(true); showActiveCheatList(true);
} }
@ -911,9 +911,9 @@ void GuiCheatsDialog_t::deleteActvCheat(void)
int row = actvCheatList->indexOfTopLevelItem(item); int row = actvCheatList->indexOfTopLevelItem(item);
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_DelCheat(row); FCEUI_DelCheat(row);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
showActiveCheatList(true); showActiveCheatList(true);
@ -969,11 +969,11 @@ void GuiCheatsDialog_t::updateCheatParameters(void)
//printf("Name: %s \n", name.c_str() ); //printf("Name: %s \n", name.c_str() );
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_SetCheat(row, name.c_str(), a, v, c, s, type); FCEUI_SetCheat(row, name.c_str(), a, v, c, s, type);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
showActiveCheatList(false); showActiveCheatList(false);
} }
@ -1038,9 +1038,9 @@ void GuiCheatsDialog_t::globalEnableCheats(int state)
g_config->setOption("SDL.CheatsDisabled", !val); g_config->setOption("SDL.CheatsDisabled", !val);
g_config->save(); g_config->save();
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_GlobalToggleCheat(val); FCEUI_GlobalToggleCheat(val);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void GuiCheatsDialog_t::autoLoadSaveCheats(int state) void GuiCheatsDialog_t::autoLoadSaveCheats(int state)

View File

@ -476,10 +476,10 @@ void CodeDataLoggerDialog_t::saveCdlFileAs(void)
} }
//qDebug() << "selected file path : " << filename.toUtf8(); //qDebug() << "selected file path : " << filename.toUtf8();
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
strcpy(loadedcdfile, filename.toStdString().c_str()); strcpy(loadedcdfile, filename.toStdString().c_str());
SaveCDLogFile(); SaveCDLogFile();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------- //----------------------------------------------------
void CodeDataLoggerDialog_t::loadCdlFile(void) void CodeDataLoggerDialog_t::loadCdlFile(void)
@ -531,9 +531,9 @@ void CodeDataLoggerDialog_t::loadCdlFile(void)
} }
//qDebug() << "selected file path : " << filename.toUtf8(); //qDebug() << "selected file path : " << filename.toUtf8();
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
LoadCDLog(filename.toStdString().c_str()); LoadCDLog(filename.toStdString().c_str());
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
return; return;
} }
@ -754,7 +754,7 @@ static int getDefaultCDLFile(char *filepath)
//---------------------------------------------------- //----------------------------------------------------
void FreeCDLog(void) void FreeCDLog(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
if (cdloggerdata) if (cdloggerdata)
{ {
free(cdloggerdata); free(cdloggerdata);
@ -767,14 +767,14 @@ void FreeCDLog(void)
cdloggervdata = NULL; cdloggervdata = NULL;
cdloggerVideoDataSize = 0; cdloggerVideoDataSize = 0;
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------- //----------------------------------------------------
void InitCDLog(void) void InitCDLog(void)
{ {
int rom_sel = 0; int rom_sel = 0;
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
if (GameInfo->type == GIT_FDS) if (GameInfo->type == GIT_FDS)
{ {
rom_sel = 1; rom_sel = 1;
@ -794,7 +794,7 @@ void InitCDLog(void)
cdloggervdata = (unsigned char *)malloc(8192); cdloggervdata = (unsigned char *)malloc(8192);
} }
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------- //----------------------------------------------------
void ResetCDLog(void) void ResetCDLog(void)
@ -803,7 +803,7 @@ void ResetCDLog(void)
{ {
return; return;
} }
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
codecount = datacount = rendercount = vromreadcount = 0; codecount = datacount = rendercount = vromreadcount = 0;
undefinedcount = cdloggerdataSize; undefinedcount = cdloggerdataSize;
@ -829,7 +829,7 @@ void ResetCDLog(void)
memset(cdloggervdata, 0, 8192); memset(cdloggervdata, 0, 8192);
} }
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------- //----------------------------------------------------
bool LoadCDLog(const char *nameo) bool LoadCDLog(const char *nameo)
@ -882,12 +882,12 @@ bool LoadCDLog(const char *nameo)
//---------------------------------------------------- //----------------------------------------------------
void StartCDLogging(void) void StartCDLogging(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_SetLoggingCD(1); FCEUI_SetLoggingCD(1);
//EnableTracerMenuItems(); //EnableTracerMenuItems();
//SetDlgItemText(hCDLogger, BTN_CDLOGGER_START_PAUSE, "Pause"); //SetDlgItemText(hCDLogger, BTN_CDLOGGER_START_PAUSE, "Pause");
autoSaveArmedCDL = true; autoSaveArmedCDL = true;
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------- //----------------------------------------------------
bool PauseCDLogging(void) bool PauseCDLogging(void)
@ -898,11 +898,11 @@ bool PauseCDLogging(void)
// MessageBox(hCDLogger, "The Trace Logger is currently using this for some of its features.\nPlease turn the Trace Logger off and try again.","Unable to Pause Code/Data Logger", MB_OK); // MessageBox(hCDLogger, "The Trace Logger is currently using this for some of its features.\nPlease turn the Trace Logger off and try again.","Unable to Pause Code/Data Logger", MB_OK);
// return false; // return false;
//} //}
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_SetLoggingCD(0); FCEUI_SetLoggingCD(0);
//EnableTracerMenuItems(); //EnableTracerMenuItems();
//SetDlgItemText(hCDLogger, BTN_CDLOGGER_START_PAUSE, "Start"); //SetDlgItemText(hCDLogger, BTN_CDLOGGER_START_PAUSE, "Start");
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
return true; return true;
} }
//---------------------------------------------------- //----------------------------------------------------

View File

@ -2021,9 +2021,9 @@ void ConsoleDebugger::openDebugSymbolEditWindow( int addr )
if ( ret == QDialog::Accepted ) if ( ret == QDialog::Accepted )
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
asmView->updateAssemblyView(); asmView->updateAssemblyView();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -2299,7 +2299,7 @@ static void DeleteBreak(int sel)
if(sel<0) return; if(sel<0) return;
if(sel>=numWPs) return; if(sel>=numWPs) return;
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
if (watchpoint[sel].cond) if (watchpoint[sel].cond)
{ {
@ -2334,7 +2334,7 @@ static void DeleteBreak(int sel)
watchpoint[numWPs].desc = 0; watchpoint[numWPs].desc = 0;
numWPs--; numWPs--;
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void debuggerClearAllBookmarks(void) void debuggerClearAllBookmarks(void)
@ -2346,7 +2346,7 @@ void debuggerClearAllBreakpoints(void)
{ {
int i; int i;
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
for (i=0; i<numWPs; i++) for (i=0; i<numWPs; i++)
{ {
@ -2372,7 +2372,7 @@ void debuggerClearAllBreakpoints(void)
} }
numWPs = 0; numWPs = 0;
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void ConsoleDebugger::delete_BP_CB(void) void ConsoleDebugger::delete_BP_CB(void)
@ -2603,11 +2603,11 @@ void ConsoleDebugger::changeCpuFontCB(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void ConsoleDebugger::reloadSymbolsCB(void) void ConsoleDebugger::reloadSymbolsCB(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
debugSymbolTable.loadGameSymbols(); debugSymbolTable.loadGameSymbols();
asmView->updateAssemblyView(); asmView->updateAssemblyView();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void ConsoleDebugger::pcSetPlaceTop(void) void ConsoleDebugger::pcSetPlaceTop(void)
@ -2753,13 +2753,13 @@ void ConsoleDebugger::debugStepBackCB(void)
{ {
if (FCEUI_EmulationPaused()) if (FCEUI_EmulationPaused())
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUD_TraceLoggerBackUpInstruction(); FCEUD_TraceLoggerBackUpInstruction();
updateWindowData(); updateWindowData();
hexEditorUpdateMemoryValues(true); hexEditorUpdateMemoryValues(true);
hexEditorRequestUpdateAll(); hexEditorRequestUpdateAll();
lastBpIdx = BREAK_TYPE_STEP; lastBpIdx = BREAK_TYPE_STEP;
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -3075,12 +3075,12 @@ void ConsoleDebugger::resetCountersCB (void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void ConsoleDebugger::asmViewCtxMenuRunToCursor(void) void ConsoleDebugger::asmViewCtxMenuRunToCursor(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
watchpoint[64].address = asmView->getCtxMenuAddr(); watchpoint[64].address = asmView->getCtxMenuAddr();
watchpoint[64].flags = WP_E|WP_X; watchpoint[64].flags = WP_E|WP_X;
FCEUI_SetEmulationPaused(0); FCEUI_SetEmulationPaused(0);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void ConsoleDebugger::asmViewCtxMenuGoTo(void) void ConsoleDebugger::asmViewCtxMenuGoTo(void)
@ -3300,12 +3300,12 @@ void QAsmView::setBreakpointAtSelectedLine(void)
if ( addr >= 0 ) if ( addr >= 0 )
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
watchpoint[64].address = addr; watchpoint[64].address = addr;
watchpoint[64].flags = WP_E|WP_X; watchpoint[64].flags = WP_E|WP_X;
FCEUI_SetEmulationPaused(0); FCEUI_SetEmulationPaused(0);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -4024,17 +4024,17 @@ void ConsoleDebugger::updatePeriodic(void)
if ( bpNotifyReq ) if ( bpNotifyReq )
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
breakPointNotify( lastBpIdx ); breakPointNotify( lastBpIdx );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
bpNotifyReq = false; bpNotifyReq = false;
} }
if ( windowUpdateReq ) if ( windowUpdateReq )
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
updateWindowData(); updateWindowData();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
asmView->update(); asmView->update();
@ -4277,7 +4277,7 @@ void FCEUD_DebugBreakpoint( int bpNum )
printf("Breakpoint Hit: %i \n", bpNum ); printf("Breakpoint Hit: %i \n", bpNum );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
while ( nes_shm->runEmulator && bpDebugEnable && while ( nes_shm->runEmulator && bpDebugEnable &&
FCEUI_EmulationPaused() && !FCEUI_EmulationFrameStepped()) FCEUI_EmulationPaused() && !FCEUI_EmulationFrameStepped())
@ -4302,7 +4302,7 @@ void FCEUD_DebugBreakpoint( int bpNum )
// since we unfreezed emulation, reset delta_cycles counter // since we unfreezed emulation, reset delta_cycles counter
ResetDebugStatisticsDeltaCounters(); ResetDebugStatisticsDeltaCounters();
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
waitingAtBp = false; waitingAtBp = false;
} }
@ -5060,9 +5060,9 @@ void QAsmView::setDisplayByteCodes( bool value )
calcLineOffsets(); calcLineOffsets();
calcMinimumWidth(); calcMinimumWidth();
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
updateAssemblyView(); updateAssemblyView();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -5072,9 +5072,9 @@ void QAsmView::setDisplayTraceData( bool value )
{ {
showTraceData = value; showTraceData = value;
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
updateAssemblyView(); updateAssemblyView();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -5084,9 +5084,9 @@ void QAsmView::setDisplayROMoffsets( bool value )
{ {
displayROMoffsets = value; displayROMoffsets = value;
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
updateAssemblyView(); updateAssemblyView();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -5096,9 +5096,9 @@ void QAsmView::setSymbolDebugEnable( bool value )
{ {
symbolicDebugEnable = value; symbolicDebugEnable = value;
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
updateAssemblyView(); updateAssemblyView();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -5108,9 +5108,9 @@ void QAsmView::setRegisterNameEnable( bool value )
{ {
registerNameEnable = value; registerNameEnable = value;
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
updateAssemblyView(); updateAssemblyView();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -6892,7 +6892,7 @@ asmLookAheadPopup::asmLookAheadPopup( int addr, QWidget *parent )
QFont font; QFont font;
char stmp[128]; char stmp[128];
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
vbox = new QVBoxLayout(); vbox = new QVBoxLayout();
vbox1 = new QVBoxLayout(); vbox1 = new QVBoxLayout();
@ -7029,7 +7029,7 @@ asmLookAheadPopup::asmLookAheadPopup( int addr, QWidget *parent )
resize(512, 512); resize(512, 512);
asmView->updateAssemblyView(); asmView->updateAssemblyView();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
hbar->hide(); hbar->hide();
vbar->hide(); vbar->hide();
@ -7459,7 +7459,7 @@ DebugBreakOnDialog::DebugBreakOnDialog(int type, QWidget *parent )
char stmp[128]; char stmp[128];
QPushButton *btn; QPushButton *btn;
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
prevPauseState = FCEUI_EmulationPaused(); prevPauseState = FCEUI_EmulationPaused();
@ -7467,7 +7467,7 @@ DebugBreakOnDialog::DebugBreakOnDialog(int type, QWidget *parent )
{ {
FCEUI_ToggleEmulationPause(); FCEUI_ToggleEmulationPause();
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
currLbl = new QLabel(); currLbl = new QLabel();

View File

@ -400,11 +400,11 @@ void ConsoleSndConfDialog_t::bufSizeChanged(int value)
g_config->setOption("SDL.Sound.BufSize", value); g_config->setOption("SDL.Sound.BufSize", value);
// reset sound subsystem for changes to take effect // reset sound subsystem for changes to take effect
if (fceuWrapperTryLock()) if (FCEU_WRAPPER_TRYLOCK(1000))
{ {
KillSound(); KillSound();
InitSound(); InitSound();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
} }
//---------------------------------------------------- //----------------------------------------------------
@ -418,10 +418,10 @@ void ConsoleSndConfDialog_t::volumeChanged(int value)
g_config->setOption("SDL.Sound.Volume", value); g_config->setOption("SDL.Sound.Volume", value);
if (fceuWrapperTryLock()) if (FCEU_WRAPPER_TRYLOCK(1000))
{ {
FCEUI_SetSoundVolume(value); FCEUI_SetSoundVolume(value);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
} }
//---------------------------------------------------- //----------------------------------------------------
@ -435,10 +435,10 @@ void ConsoleSndConfDialog_t::triangleChanged(int value)
g_config->setOption("SDL.Sound.TriangleVolume", value); g_config->setOption("SDL.Sound.TriangleVolume", value);
if (fceuWrapperTryLock()) if (FCEU_WRAPPER_TRYLOCK(1000))
{ {
FCEUI_SetTriangleVolume(value); FCEUI_SetTriangleVolume(value);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
} }
//---------------------------------------------------- //----------------------------------------------------
@ -452,10 +452,10 @@ void ConsoleSndConfDialog_t::square1Changed(int value)
g_config->setOption("SDL.Sound.Square1Volume", value); g_config->setOption("SDL.Sound.Square1Volume", value);
if (fceuWrapperTryLock()) if (FCEU_WRAPPER_TRYLOCK(1000))
{ {
FCEUI_SetSquare1Volume(value); FCEUI_SetSquare1Volume(value);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
} }
//---------------------------------------------------- //----------------------------------------------------
@ -469,10 +469,10 @@ void ConsoleSndConfDialog_t::square2Changed(int value)
g_config->setOption("SDL.Sound.Square2Volume", value); g_config->setOption("SDL.Sound.Square2Volume", value);
if (fceuWrapperTryLock()) if (FCEU_WRAPPER_TRYLOCK(1000))
{ {
FCEUI_SetSquare2Volume(value); FCEUI_SetSquare2Volume(value);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
} }
//---------------------------------------------------- //----------------------------------------------------
@ -486,10 +486,10 @@ void ConsoleSndConfDialog_t::noiseChanged(int value)
g_config->setOption("SDL.Sound.NoiseVolume", value); g_config->setOption("SDL.Sound.NoiseVolume", value);
if (fceuWrapperTryLock()) if (FCEU_WRAPPER_TRYLOCK(1000))
{ {
FCEUI_SetNoiseVolume(value); FCEUI_SetNoiseVolume(value);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
} }
//---------------------------------------------------- //----------------------------------------------------
@ -503,10 +503,10 @@ void ConsoleSndConfDialog_t::pcmChanged(int value)
g_config->setOption("SDL.Sound.PCMVolume", value); g_config->setOption("SDL.Sound.PCMVolume", value);
if (fceuWrapperTryLock()) if (FCEU_WRAPPER_TRYLOCK(1000))
{ {
FCEUI_SetPCMVolume(value); FCEUI_SetPCMVolume(value);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
} }
//---------------------------------------------------- //----------------------------------------------------
@ -518,21 +518,21 @@ void ConsoleSndConfDialog_t::enaSoundStateChange(int value)
g_config->getOption("SDL.Sound", &last_soundopt); g_config->getOption("SDL.Sound", &last_soundopt);
g_config->setOption("SDL.Sound", 1); g_config->setOption("SDL.Sound", 1);
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
if (GameInfo && !last_soundopt) if (GameInfo && !last_soundopt)
{ {
InitSound(); InitSound();
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
else else
{ {
g_config->setOption("SDL.Sound", 0); g_config->setOption("SDL.Sound", 0);
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
KillSound(); KillSound();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
} }
//---------------------------------------------------- //----------------------------------------------------
@ -542,17 +542,17 @@ void ConsoleSndConfDialog_t::enaSoundLowPassChange(int value)
{ {
g_config->setOption("SDL.Sound.LowPass", 1); g_config->setOption("SDL.Sound.LowPass", 1);
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_SetLowPass(1); FCEUI_SetLowPass(1);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
else else
{ {
g_config->setOption("SDL.Sound.LowPass", 0); g_config->setOption("SDL.Sound.LowPass", 0);
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_SetLowPass(0); FCEUI_SetLowPass(0);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
g_config->save(); g_config->save();
} }
@ -594,11 +594,11 @@ void ConsoleSndConfDialog_t::soundQualityChanged(int index)
g_config->getOption("SDL.Sound.Quality", &sndQuality ); g_config->getOption("SDL.Sound.Quality", &sndQuality );
// reset sound subsystem for changes to take effect // reset sound subsystem for changes to take effect
if (fceuWrapperTryLock()) if (FCEU_WRAPPER_TRYLOCK(1000))
{ {
KillSound(); KillSound();
InitSound(); InitSound();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
g_config->save(); g_config->save();
@ -611,11 +611,11 @@ void ConsoleSndConfDialog_t::soundRateChanged(int index)
g_config->setOption("SDL.Sound.Rate", rateSelect->itemData(index).toInt()); g_config->setOption("SDL.Sound.Rate", rateSelect->itemData(index).toInt());
// reset sound subsystem for changes to take effect // reset sound subsystem for changes to take effect
if (fceuWrapperTryLock()) if (FCEU_WRAPPER_TRYLOCK(1000))
{ {
KillSound(); KillSound();
InitSound(); InitSound();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
g_config->save(); g_config->save();
} }

View File

@ -572,10 +572,10 @@ void ConsoleVideoConfDialog_t::closeWindow(void)
//---------------------------------------------------- //----------------------------------------------------
void ConsoleVideoConfDialog_t::resetVideo(void) void ConsoleVideoConfDialog_t::resetVideo(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
KillVideo (); KillVideo ();
InitVideo (GameInfo); InitVideo (GameInfo);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------- //----------------------------------------------------
void ConsoleVideoConfDialog_t::updateReadouts(void) void ConsoleVideoConfDialog_t::updateReadouts(void)
@ -782,7 +782,7 @@ void ConsoleVideoConfDialog_t::use_new_PPU_changed( bool value )
} }
//printf("NEW PPU Value:%i \n", reqNewPPU ); //printf("NEW PPU Value:%i \n", reqNewPPU );
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
newppu = reqNewPPU; newppu = reqNewPPU;
@ -796,7 +796,7 @@ void ConsoleVideoConfDialog_t::use_new_PPU_changed( bool value )
g_config->save (); g_config->save ();
UpdateEMUCore (g_config); UpdateEMUCore (g_config);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------- //----------------------------------------------------
void ConsoleVideoConfDialog_t::frameskip_changed( int value ) void ConsoleVideoConfDialog_t::frameskip_changed( int value )
@ -805,9 +805,9 @@ void ConsoleVideoConfDialog_t::frameskip_changed( int value )
g_config->setOption("SDL.Frameskip", (value == Qt::Checked) ); g_config->setOption("SDL.Frameskip", (value == Qt::Checked) );
g_config->save (); g_config->save ();
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
UpdateEMUCore (g_config); UpdateEMUCore (g_config);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------- //----------------------------------------------------
void ConsoleVideoConfDialog_t::vsync_changed( int value ) void ConsoleVideoConfDialog_t::vsync_changed( int value )
@ -839,11 +839,11 @@ void ConsoleVideoConfDialog_t::intFrameRate_changed( int value )
g_config->setOption("SDL.IntFrameRate", useIntFrameRate ); g_config->setOption("SDL.IntFrameRate", useIntFrameRate );
g_config->save (); g_config->save ();
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
RefreshThrottleFPS(); RefreshThrottleFPS();
KillSound(); KillSound();
InitSound(); InitSound();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------- //----------------------------------------------------
void ConsoleVideoConfDialog_t::useSpriteLimitChanged( int value ) void ConsoleVideoConfDialog_t::useSpriteLimitChanged( int value )
@ -852,9 +852,9 @@ void ConsoleVideoConfDialog_t::useSpriteLimitChanged( int value )
g_config->setOption("SDL.DisableSpriteLimit", (value == Qt::Checked) ); g_config->setOption("SDL.DisableSpriteLimit", (value == Qt::Checked) );
g_config->save (); g_config->save ();
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
UpdateEMUCore (g_config); UpdateEMUCore (g_config);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------- //----------------------------------------------------
void ConsoleVideoConfDialog_t::clipSidesChanged( int value ) void ConsoleVideoConfDialog_t::clipSidesChanged( int value )
@ -863,9 +863,9 @@ void ConsoleVideoConfDialog_t::clipSidesChanged( int value )
g_config->setOption("SDL.ClipSides", (value == Qt::Checked) ); g_config->setOption("SDL.ClipSides", (value == Qt::Checked) );
g_config->save (); g_config->save ();
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
UpdateEMUCore (g_config); UpdateEMUCore (g_config);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------- //----------------------------------------------------
void ConsoleVideoConfDialog_t::showFPSChanged( int value ) void ConsoleVideoConfDialog_t::showFPSChanged( int value )
@ -874,9 +874,9 @@ void ConsoleVideoConfDialog_t::showFPSChanged( int value )
g_config->setOption("SDL.ShowFPS", (value == Qt::Checked) ); g_config->setOption("SDL.ShowFPS", (value == Qt::Checked) );
g_config->save (); g_config->save ();
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_SetShowFPS( (value == Qt::Checked) ); FCEUI_SetShowFPS( (value == Qt::Checked) );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------- //----------------------------------------------------
void ConsoleVideoConfDialog_t::aspectEnableChanged( int value ) void ConsoleVideoConfDialog_t::aspectEnableChanged( int value )
@ -951,18 +951,18 @@ void ConsoleVideoConfDialog_t::regionChanged(int index)
// reset sound subsystem for changes to take effect // reset sound subsystem for changes to take effect
if ( actRegion != region ) if ( actRegion != region )
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_SetRegion (region, true); FCEUI_SetRegion (region, true);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
} }
//---------------------------------------------------- //----------------------------------------------------
void ConsoleVideoConfDialog_t::inputDisplayChanged(int index) void ConsoleVideoConfDialog_t::inputDisplayChanged(int index)
{ {
//printf("Scaler: %i : %i \n", index, scalerSelect->itemData(index).toInt() ); //printf("Scaler: %i : %i \n", index, scalerSelect->itemData(index).toInt() );
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
input_display = inputDisplaySel->itemData(index).toInt(); input_display = inputDisplaySel->itemData(index).toInt();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
g_config->setOption ("SDL.InputDisplay", input_display); g_config->setOption ("SDL.InputDisplay", input_display);
g_config->save (); g_config->save ();
@ -1022,16 +1022,16 @@ void ConsoleVideoConfDialog_t::drawInputAidsChanged( int value )
g_config->setOption("SDL.DrawInputAids", draw ); g_config->setOption("SDL.DrawInputAids", draw );
g_config->save (); g_config->save ();
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
drawInputAidsEnable = draw; drawInputAidsEnable = draw;
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------- //----------------------------------------------------
void ConsoleVideoConfDialog_t::showFrameCountChanged( int value ) void ConsoleVideoConfDialog_t::showFrameCountChanged( int value )
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
frame_display = (value != Qt::Unchecked); frame_display = (value != Qt::Unchecked);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
//printf("Value:%i \n", value ); //printf("Value:%i \n", value );
g_config->setOption("SDL.ShowFrameCount", frame_display ); g_config->setOption("SDL.ShowFrameCount", frame_display );
@ -1041,9 +1041,9 @@ void ConsoleVideoConfDialog_t::showFrameCountChanged( int value )
//---------------------------------------------------- //----------------------------------------------------
void ConsoleVideoConfDialog_t::showLagCountChanged( int value ) void ConsoleVideoConfDialog_t::showLagCountChanged( int value )
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
lagCounterDisplay = (value != Qt::Unchecked); lagCounterDisplay = (value != Qt::Unchecked);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
//printf("Value:%i \n", value ); //printf("Value:%i \n", value );
g_config->setOption("SDL.ShowLagCount", lagCounterDisplay ); g_config->setOption("SDL.ShowLagCount", lagCounterDisplay );
@ -1053,9 +1053,9 @@ void ConsoleVideoConfDialog_t::showLagCountChanged( int value )
//---------------------------------------------------- //----------------------------------------------------
void ConsoleVideoConfDialog_t::showRerecordCountChanged( int value ) void ConsoleVideoConfDialog_t::showRerecordCountChanged( int value )
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
rerecord_display = (value != Qt::Unchecked); rerecord_display = (value != Qt::Unchecked);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
//printf("Value:%i \n", value ); //printf("Value:%i \n", value );
g_config->setOption("SDL.ShowRerecordCount", rerecord_display ); g_config->setOption("SDL.ShowRerecordCount", rerecord_display );

View File

@ -301,9 +301,9 @@ consoleWin_t::~consoleWin_t(void)
//aviDiskThread->quit(); //aviDiskThread->quit();
//aviDiskThread->wait( 10000 ); //aviDiskThread->wait( 10000 );
//fceuWrapperLock(); //FCEU_WRAPPER_LOCK();
//fceuWrapperClose(); //fceuWrapperClose();
//fceuWrapperUnLock(); //FCEU_WRAPPER_UNLOCK();
if ( viewport_GL != NULL ) if ( viewport_GL != NULL )
{ {
@ -695,12 +695,12 @@ void consoleWin_t::showErrorMsgWindow()
{ {
QMessageBox msgBox(this); QMessageBox msgBox(this);
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
msgBox.resize( this->size() ); msgBox.resize( this->size() );
msgBox.setIcon( QMessageBox::Critical ); msgBox.setIcon( QMessageBox::Critical );
msgBox.setText( tr(errorMsg.c_str()) ); msgBox.setText( tr(errorMsg.c_str()) );
errorMsg.clear(); errorMsg.clear();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
//msgBox.show(); //msgBox.show();
msgBox.exec(); msgBox.exec();
} }
@ -757,9 +757,9 @@ void consoleWin_t::dropEvent(QDropEvent *event)
{ {
QList<QUrl> urls = event->mimeData()->urls(); QList<QUrl> urls = event->mimeData()->urls();
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
LoadGame( urls[0].toString( QUrl::PreferLocalFile ).toStdString().c_str() ); LoadGame( urls[0].toString( QUrl::PreferLocalFile ).toStdString().c_str() );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
event->accept(); event->accept();
} }
} }
@ -2113,9 +2113,9 @@ void consoleWin_t::closeApp(void)
aviDiskThread->quit(); aviDiskThread->quit();
aviDiskThread->wait( 10000 ); aviDiskThread->wait( 10000 );
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
fceuWrapperClose(); fceuWrapperClose();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
// LoadGame() checks for an IP and if it finds one begins a network session // LoadGame() checks for an IP and if it finds one begins a network session
// clear the NetworkIP field so this doesn't happen unintentionally // clear the NetworkIP field so this doesn't happen unintentionally
@ -2300,10 +2300,10 @@ void consoleWin_t::openROMFile(void)
g_config->setOption ("SDL.LastOpenFile", filename.toStdString().c_str() ); g_config->setOption ("SDL.LastOpenFile", filename.toStdString().c_str() );
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
CloseGame (); CloseGame ();
LoadGame ( filename.toStdString().c_str() ); LoadGame ( filename.toStdString().c_str() );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
return; return;
} }
@ -2311,17 +2311,17 @@ void consoleWin_t::openROMFile(void)
void consoleWin_t::loadRomRequestCB( QString s ) void consoleWin_t::loadRomRequestCB( QString s )
{ {
printf("Load ROM Req: '%s'\n", s.toStdString().c_str() ); printf("Load ROM Req: '%s'\n", s.toStdString().c_str() );
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
CloseGame (); CloseGame ();
LoadGame ( s.toStdString().c_str() ); LoadGame ( s.toStdString().c_str() );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::closeROMCB(void) void consoleWin_t::closeROMCB(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
CloseGame(); CloseGame();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::loadNSF(void) void consoleWin_t::loadNSF(void)
@ -2393,9 +2393,9 @@ void consoleWin_t::loadNSF(void)
g_config->setOption ("SDL.LastOpenNSF", filename.toStdString().c_str() ); g_config->setOption ("SDL.LastOpenNSF", filename.toStdString().c_str() );
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
LoadGame( filename.toStdString().c_str() ); LoadGame( filename.toStdString().c_str() );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::loadStateFrom(void) void consoleWin_t::loadStateFrom(void)
@ -2477,9 +2477,9 @@ void consoleWin_t::loadStateFrom(void)
g_config->setOption ("SDL.LastLoadStateFrom", filename.toStdString().c_str() ); g_config->setOption ("SDL.LastLoadStateFrom", filename.toStdString().c_str() );
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_LoadState( filename.toStdString().c_str() ); FCEUI_LoadState( filename.toStdString().c_str() );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::saveStateAs(void) void consoleWin_t::saveStateAs(void)
@ -2568,26 +2568,26 @@ void consoleWin_t::saveStateAs(void)
g_config->setOption ("SDL.LastSaveStateAs", filename.toStdString().c_str() ); g_config->setOption ("SDL.LastSaveStateAs", filename.toStdString().c_str() );
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_SaveState( filename.toStdString().c_str() ); FCEUI_SaveState( filename.toStdString().c_str() );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::quickLoad(void) void consoleWin_t::quickLoad(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_LoadState( NULL ); FCEUI_LoadState( NULL );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::loadState(int slot) void consoleWin_t::loadState(int slot)
{ {
int prevState; int prevState;
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
prevState = FCEUI_SelectState( slot, false ); prevState = FCEUI_SelectState( slot, false );
FCEUI_LoadState( NULL, true ); FCEUI_LoadState( NULL, true );
FCEUI_SelectState( prevState, false ); FCEUI_SelectState( prevState, false );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::loadState0(void){ loadState(0); } void consoleWin_t::loadState0(void){ loadState(0); }
void consoleWin_t::loadState1(void){ loadState(1); } void consoleWin_t::loadState1(void){ loadState(1); }
@ -2602,19 +2602,19 @@ void consoleWin_t::loadState9(void){ loadState(9); }
void consoleWin_t::quickSave(void) void consoleWin_t::quickSave(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_SaveState( NULL ); FCEUI_SaveState( NULL );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::saveState(int slot) void consoleWin_t::saveState(int slot)
{ {
int prevState; int prevState;
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
prevState = FCEUI_SelectState( slot, false ); prevState = FCEUI_SelectState( slot, false );
FCEUI_SaveState( NULL, true ); FCEUI_SaveState( NULL, true );
FCEUI_SelectState( prevState, false ); FCEUI_SelectState( prevState, false );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::saveState0(void){ saveState(0); } void consoleWin_t::saveState0(void){ saveState(0); }
void consoleWin_t::saveState1(void){ saveState(1); } void consoleWin_t::saveState1(void){ saveState(1); }
@ -2629,9 +2629,9 @@ void consoleWin_t::saveState9(void){ saveState(9); }
void consoleWin_t::changeState(int slot) void consoleWin_t::changeState(int slot)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_SelectState( slot, true ); FCEUI_SelectState( slot, true );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
state[slot]->setChecked(true); state[slot]->setChecked(true);
} }
void consoleWin_t::changeState0(void){ changeState(0); } void consoleWin_t::changeState0(void){ changeState(0); }
@ -2647,16 +2647,16 @@ void consoleWin_t::changeState9(void){ changeState(9); }
void consoleWin_t::incrementState(void) void consoleWin_t::incrementState(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_SelectStateNext(1); FCEUI_SelectStateNext(1);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::decrementState(void) void consoleWin_t::decrementState(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_SelectStateNext(-1); FCEUI_SelectStateNext(-1);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::mainMenuOpen(void) void consoleWin_t::mainMenuOpen(void)
@ -2697,9 +2697,9 @@ void consoleWin_t::prepareScreenShot(void)
//void consoleWin_t::takeScreenShot(void) //void consoleWin_t::takeScreenShot(void)
//{ //{
// fceuWrapperLock(); // FCEU_WRAPPER_LOCK();
// FCEUI_SaveSnapshot(); // FCEUI_SaveSnapshot();
// fceuWrapperUnLock(); // FCEU_WRAPPER_UNLOCK();
//} //}
void consoleWin_t::takeScreenShot(void) void consoleWin_t::takeScreenShot(void)
@ -2719,7 +2719,7 @@ void consoleWin_t::takeScreenShot(void)
return; return;
} }
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
if ( viewport_GL ) if ( viewport_GL )
{ {
@ -2743,7 +2743,7 @@ void consoleWin_t::takeScreenShot(void)
image.save( tr( FCEU_MakeFName(FCEUMKF_SNAP,u,"png").c_str() ), "png" ); image.save( tr( FCEU_MakeFName(FCEUMKF_SNAP,u,"png").c_str() ), "png" );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
FCEU_DispMessage("Screen snapshot %d saved.",0,u); FCEU_DispMessage("Screen snapshot %d saved.",0,u);
} }
@ -2876,7 +2876,7 @@ void consoleWin_t::openAviRiffViewer(void)
void consoleWin_t::openTasEditor(void) void consoleWin_t::openTasEditor(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
if ( tasWindowIsOpen() ) if ( tasWindowIsOpen() )
{ {
@ -2892,7 +2892,7 @@ void consoleWin_t::openTasEditor(void)
connect(emulatorThread, SIGNAL(frameFinished(void)), win, SLOT(frameUpdate(void)) ); connect(emulatorThread, SIGNAL(frameFinished(void)), win, SLOT(frameUpdate(void)) );
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::openMovieOptWin(void) void consoleWin_t::openMovieOptWin(void)
@ -3146,33 +3146,33 @@ void consoleWin_t::warnAmbiguousShortcut( QShortcut *shortcut)
void consoleWin_t::powerConsoleCB(void) void consoleWin_t::powerConsoleCB(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_PowerNES(); FCEUI_PowerNES();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
return; return;
} }
void consoleWin_t::consoleHardReset(void) void consoleWin_t::consoleHardReset(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
fceuWrapperHardReset(); fceuWrapperHardReset();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
return; return;
} }
void consoleWin_t::consoleSoftReset(void) void consoleWin_t::consoleSoftReset(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
fceuWrapperSoftReset(); fceuWrapperSoftReset();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
return; return;
} }
void consoleWin_t::consolePause(void) void consoleWin_t::consolePause(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
fceuWrapperTogglePause(); fceuWrapperTogglePause();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
mainMenuEmuPauseSet = false; mainMenuEmuPauseSet = false;
return; return;
@ -3189,9 +3189,9 @@ void consoleWin_t::setRegion(int region)
if ( currentRegion != region ) if ( currentRegion != region )
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_SetRegion (region, true); FCEUI_SetRegion (region, true);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
return; return;
} }
@ -3250,12 +3250,12 @@ void consoleWin_t::toggleGameGenie(bool checked)
{ {
int gg_enabled; int gg_enabled;
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
g_config->getOption ("SDL.GameGenie", &gg_enabled); g_config->getOption ("SDL.GameGenie", &gg_enabled);
g_config->setOption ("SDL.GameGenie", !gg_enabled); g_config->setOption ("SDL.GameGenie", !gg_enabled);
g_config->save (); g_config->save ();
FCEUI_SetGameGenie (gg_enabled); FCEUI_SetGameGenie (gg_enabled);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
return; return;
} }
@ -3326,25 +3326,25 @@ void consoleWin_t::loadGameGenieROM(void)
void consoleWin_t::insertCoin(void) void consoleWin_t::insertCoin(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_VSUniCoin(); FCEUI_VSUniCoin();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
return; return;
} }
void consoleWin_t::fdsSwitchDisk(void) void consoleWin_t::fdsSwitchDisk(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEU_FDSSelect(); FCEU_FDSSelect();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
return; return;
} }
void consoleWin_t::fdsEjectDisk(void) void consoleWin_t::fdsEjectDisk(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEU_FDSInsert(); FCEU_FDSInsert();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
return; return;
} }
@ -3588,55 +3588,55 @@ void consoleWin_t::setCustomAutoFire(void)
void consoleWin_t::incrSoundVolume(void) void consoleWin_t::incrSoundVolume(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUD_SoundVolumeAdjust( 1); FCEUD_SoundVolumeAdjust( 1);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::decrSoundVolume(void) void consoleWin_t::decrSoundVolume(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUD_SoundVolumeAdjust(-1); FCEUD_SoundVolumeAdjust(-1);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::toggleLagCounterDisplay(void) void consoleWin_t::toggleLagCounterDisplay(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
lagCounterDisplay = !lagCounterDisplay; lagCounterDisplay = !lagCounterDisplay;
g_config->setOption("SDL.ShowLagCount", lagCounterDisplay); g_config->setOption("SDL.ShowLagCount", lagCounterDisplay);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::toggleFrameAdvLagSkip(void) void consoleWin_t::toggleFrameAdvLagSkip(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
frameAdvanceLagSkip = !frameAdvanceLagSkip; frameAdvanceLagSkip = !frameAdvanceLagSkip;
FCEUI_DispMessage ("Skipping lag in Frame Advance %sabled.", 0, frameAdvanceLagSkip ? "en" : "dis"); FCEUI_DispMessage ("Skipping lag in Frame Advance %sabled.", 0, frameAdvanceLagSkip ? "en" : "dis");
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::toggleMovieBindSaveState(void) void consoleWin_t::toggleMovieBindSaveState(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
bindSavestate = !bindSavestate; bindSavestate = !bindSavestate;
g_config->setOption("SDL.MovieBindSavestate", bindSavestate); g_config->setOption("SDL.MovieBindSavestate", bindSavestate);
FCEUI_DispMessage ("Savestate binding to movie %sabled.", 0, bindSavestate ? "en" : "dis"); FCEUI_DispMessage ("Savestate binding to movie %sabled.", 0, bindSavestate ? "en" : "dis");
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::toggleMovieFrameDisplay(void) void consoleWin_t::toggleMovieFrameDisplay(void)
{ {
extern int frame_display; extern int frame_display;
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_MovieToggleFrameDisplay(); FCEUI_MovieToggleFrameDisplay();
g_config->setOption("SDL.ShowFrameCount", frame_display ); g_config->setOption("SDL.ShowFrameCount", frame_display );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::toggleMovieReadWrite(void) void consoleWin_t::toggleMovieReadWrite(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
//FCEUI_SetMovieToggleReadOnly (!FCEUI_GetMovieToggleReadOnly ()); //FCEUI_SetMovieToggleReadOnly (!FCEUI_GetMovieToggleReadOnly ());
FCEUI_MovieToggleReadOnly(); FCEUI_MovieToggleReadOnly();
@ -3644,33 +3644,33 @@ void consoleWin_t::toggleMovieReadWrite(void)
{ {
tasWin->updateRecordStatus(); tasWin->updateRecordStatus();
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::toggleInputDisplay(void) void consoleWin_t::toggleInputDisplay(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_ToggleInputDisplay(); FCEUI_ToggleInputDisplay();
g_config->setOption ("SDL.InputDisplay", input_display); g_config->setOption ("SDL.InputDisplay", input_display);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::toggleBackground(void) void consoleWin_t::toggleBackground(void)
{ {
bool fgOn, bgOn; bool fgOn, bgOn;
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_GetRenderPlanes( fgOn, bgOn ); FCEUI_GetRenderPlanes( fgOn, bgOn );
FCEUI_SetRenderPlanes( fgOn, !bgOn ); FCEUI_SetRenderPlanes( fgOn, !bgOn );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::toggleForeground(void) void consoleWin_t::toggleForeground(void)
{ {
bool fgOn, bgOn; bool fgOn, bgOn;
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_GetRenderPlanes( fgOn, bgOn ); FCEUI_GetRenderPlanes( fgOn, bgOn );
FCEUI_SetRenderPlanes( !fgOn, bgOn ); FCEUI_SetRenderPlanes( !fgOn, bgOn );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::toggleTurboMode(void) void consoleWin_t::toggleTurboMode(void)
@ -3689,28 +3689,28 @@ void consoleWin_t::openMovie(void)
void consoleWin_t::playMovieFromBeginning(void) void consoleWin_t::playMovieFromBeginning(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_MoviePlayFromBeginning(); FCEUI_MoviePlayFromBeginning();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::stopMovie(void) void consoleWin_t::stopMovie(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_StopMovie(); FCEUI_StopMovie();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
return; return;
} }
void consoleWin_t::recordMovie(void) void consoleWin_t::recordMovie(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
if (fceuWrapperGameLoaded()) if (fceuWrapperGameLoaded())
{ {
MovieRecordDialog_t dialog(this); MovieRecordDialog_t dialog(this);
dialog.exec(); dialog.exec();
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
return; return;
} }
@ -3718,12 +3718,12 @@ void consoleWin_t::aviRecordStart(void)
{ {
if ( !aviRecordRunning() ) if ( !aviRecordRunning() )
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
if ( aviRecordOpenFile(NULL) == 0 ) if ( aviRecordOpenFile(NULL) == 0 )
{ {
aviDiskThread->start(); aviDiskThread->start();
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
} }
@ -3826,23 +3826,23 @@ void consoleWin_t::aviRecordAsStart(void)
g_config->setOption ("SDL.AviFilePath", lastPath); g_config->setOption ("SDL.AviFilePath", lastPath);
} }
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
if ( aviRecordOpenFile( filename.toStdString().c_str() ) == 0 ) if ( aviRecordOpenFile( filename.toStdString().c_str() ) == 0 )
{ {
aviDiskThread->start(); aviDiskThread->start();
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::aviRecordStop(void) void consoleWin_t::aviRecordStop(void)
{ {
if ( aviRecordRunning() ) if ( aviRecordRunning() )
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
aviDiskThread->requestInterruption(); aviDiskThread->requestInterruption();
aviDiskThread->quit(); aviDiskThread->quit();
aviDiskThread->wait(10000); aviDiskThread->wait(10000);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
} }
@ -3913,9 +3913,9 @@ void consoleWin_t::wavRecordStart(void)
{ {
return; return;
} }
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_BeginWaveRecord( fileName ); FCEUI_BeginWaveRecord( fileName );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
} }
@ -4017,18 +4017,18 @@ void consoleWin_t::wavRecordAsStart(void)
g_config->setOption ("SDL.WavFilePath", lastPath); g_config->setOption ("SDL.WavFilePath", lastPath);
} }
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_BeginWaveRecord( filename.toStdString().c_str() ); FCEUI_BeginWaveRecord( filename.toStdString().c_str() );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
void consoleWin_t::wavRecordStop(void) void consoleWin_t::wavRecordStop(void)
{ {
if ( FCEUI_WaveRecordRunning() ) if ( FCEUI_WaveRecordRunning() )
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_EndWaveRecord(); FCEUI_EndWaveRecord();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
} }
@ -4253,10 +4253,10 @@ void consoleWin_t::loadMostRecentROM(void)
{ {
return; return;
} }
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
CloseGame (); CloseGame ();
LoadGame ( (romList.back())->c_str() ); LoadGame ( (romList.back())->c_str() );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
int consoleWin_t::getPeriodicInterval(void) int consoleWin_t::getPeriodicInterval(void)
@ -4350,10 +4350,10 @@ void consoleWin_t::updatePeriodic(void)
if ( recentRomMenuReset ) if ( recentRomMenuReset )
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
buildRecentRomMenu(); buildRecentRomMenu();
recentRomMenuReset = false; recentRomMenuReset = false;
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
if ( closeRequested ) if ( closeRequested )
@ -4639,10 +4639,10 @@ void consoleRecentRomAction::activateCB(void)
{ {
printf("Activate Recent ROM: %s \n", path.c_str() ); printf("Activate Recent ROM: %s \n", path.c_str() );
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
CloseGame (); CloseGame ();
LoadGame ( path.c_str() ); LoadGame ( path.c_str() );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
autoFireMenuAction::autoFireMenuAction(int on, int off, QString name, QWidget *parent) autoFireMenuAction::autoFireMenuAction(int on, int off, QString name, QWidget *parent)

View File

@ -276,9 +276,9 @@ void GameGenieDialog_t::addCheatClicked(void)
c = strtol( cmp->text().toStdString().c_str(), NULL, 16 ); c = strtol( cmp->text().toStdString().c_str(), NULL, 16 );
} }
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_AddCheat( name.c_str(), a, v, c, 1 ); FCEUI_AddCheat( name.c_str(), a, v, c, 1 );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -1071,9 +1071,9 @@ void HexEditorFindDialog_t::runSearch(void)
i++; i++;
} }
} }
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
parent->editor->findPattern( varray, upBtn->isChecked() ); parent->editor->findPattern( varray, upBtn->isChecked() );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
HexEditorDialog_t::HexEditorDialog_t(QWidget *parent) HexEditorDialog_t::HexEditorDialog_t(QWidget *parent)
@ -1439,9 +1439,9 @@ HexEditorDialog_t::HexEditorDialog_t(QWidget *parent)
// Lock the mutex before adding a new window to the list, // Lock the mutex before adding a new window to the list,
// we want to be sure that the emulator is not iterating the list // we want to be sure that the emulator is not iterating the list
// when we change it. // when we change it.
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
winList.push_back(this); winList.push_back(this);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
populateBookmarkMenu(); populateBookmarkMenu();
@ -1462,7 +1462,7 @@ HexEditorDialog_t::~HexEditorDialog_t(void)
// Lock the emulation thread mutex to ensure // Lock the emulation thread mutex to ensure
// that the emulator is not attempting to update memory values // that the emulator is not attempting to update memory values
// for window while we are destroying it or editing the window list. // for window while we are destroying it or editing the window list.
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
for (it = winList.begin(); it != winList.end(); it++) for (it = winList.begin(); it != winList.end(); it++)
{ {
@ -1473,7 +1473,7 @@ HexEditorDialog_t::~HexEditorDialog_t(void)
break; break;
} }
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void HexEditorDialog_t::setWindowTitle(void) void HexEditorDialog_t::setWindowTitle(void)
@ -1816,7 +1816,7 @@ void HexEditorDialog_t::updatePeriodic(void)
editor->checkMemActivity(); editor->checkMemActivity();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
else else
{ {
@ -2282,7 +2282,7 @@ void QHexEdit::pasteFromClipboard(void)
const char *c; const char *c;
unsigned char *buf; unsigned char *buf;
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
//printf("Paste: '%s'\n", s.c_str() ); //printf("Paste: '%s'\n", s.c_str() );
@ -2343,7 +2343,7 @@ void QHexEdit::pasteFromClipboard(void)
} }
free(buf); free(buf);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void QHexEdit::loadHighlightToClipboard(void) void QHexEdit::loadHighlightToClipboard(void)
@ -2352,7 +2352,7 @@ void QHexEdit::loadHighlightToClipboard(void)
std::string s; std::string s;
char c[8]; char c[8];
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
startAddr = (txtHlgtStartLine*16) + txtHlgtStartChar; startAddr = (txtHlgtStartLine*16) + txtHlgtStartChar;
endAddr = (txtHlgtEndLine *16) + txtHlgtEndChar; endAddr = (txtHlgtEndLine *16) + txtHlgtEndChar;
@ -2363,7 +2363,7 @@ void QHexEdit::loadHighlightToClipboard(void)
s.append(c); s.append(c);
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
loadClipboard( s.c_str() ); loadClipboard( s.c_str() );
} }
@ -2732,13 +2732,13 @@ void QHexEdit::keyPressEvent(QKeyEvent *event)
int offs = (cursorPosX-32); int offs = (cursorPosX-32);
int addr = 16*(lineOffset+cursorPosY) + offs; int addr = 16*(lineOffset+cursorPosY) + offs;
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
if ( viewMode == QHexEdit::MODE_NES_ROM ) if ( viewMode == QHexEdit::MODE_NES_ROM )
{ {
romEditList.applyPatch( addr, key ); romEditList.applyPatch( addr, key );
} }
writeMem( viewMode, addr, key ); writeMem( viewMode, addr, key );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
editAddr = -1; editAddr = -1;
editValue = 0; editValue = 0;
@ -2767,13 +2767,13 @@ void QHexEdit::keyPressEvent(QKeyEvent *event)
{ {
nibbleValue = editValue | nibbleValue; nibbleValue = editValue | nibbleValue;
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
if ( viewMode == QHexEdit::MODE_NES_ROM ) if ( viewMode == QHexEdit::MODE_NES_ROM )
{ {
romEditList.applyPatch( editAddr, nibbleValue ); romEditList.applyPatch( editAddr, nibbleValue );
} }
writeMem( viewMode, editAddr, nibbleValue ); writeMem( viewMode, editAddr, nibbleValue );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
editAddr = -1; editAddr = -1;
editValue = 0; editValue = 0;
@ -3236,7 +3236,7 @@ void QHexEdit::frzRamSet(void)
return; return;
} }
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_ListCheats( RamFreezeCB, this); FCEUI_ListCheats( RamFreezeCB, this);
if ( (frzRamAddr >= 0) && (FrozenAddressCount < 256) ) if ( (frzRamAddr >= 0) && (FrozenAddressCount < 256) )
@ -3244,7 +3244,7 @@ void QHexEdit::frzRamSet(void)
FCEUI_AddCheat("", frzRamAddr, GetMem(frzRamAddr), -1, 1); FCEUI_AddCheat("", frzRamAddr, GetMem(frzRamAddr), -1, 1);
} }
updateCheatDialog(); updateCheatDialog();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void QHexEdit::frzRamUnset(void) void QHexEdit::frzRamUnset(void)
@ -3257,10 +3257,10 @@ void QHexEdit::frzRamUnset(void)
{ {
return; return;
} }
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_ListCheats( RamFreezeCB, this); FCEUI_ListCheats( RamFreezeCB, this);
updateCheatDialog(); updateCheatDialog();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void QHexEdit::frzRamUnsetAll(void) void QHexEdit::frzRamUnsetAll(void)
@ -3273,10 +3273,10 @@ void QHexEdit::frzRamUnsetAll(void)
{ {
return; return;
} }
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEU_DeleteAllCheats(); FCEU_DeleteAllCheats();
updateCheatDialog(); updateCheatDialog();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void QHexEdit::frzRamToggle(void) void QHexEdit::frzRamToggle(void)
@ -3289,7 +3289,7 @@ void QHexEdit::frzRamToggle(void)
{ {
return; return;
} }
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_ListCheats( RamFreezeCB, this); FCEUI_ListCheats( RamFreezeCB, this);
if ( (frzRamAddr >= 0) && (FrozenAddressCount < 256) ) if ( (frzRamAddr >= 0) && (FrozenAddressCount < 256) )
@ -3297,7 +3297,7 @@ void QHexEdit::frzRamToggle(void)
FCEUI_AddCheat("", frzRamAddr, GetMem(frzRamAddr), -1, 1); FCEUI_AddCheat("", frzRamAddr, GetMem(frzRamAddr), -1, 1);
} }
updateCheatDialog(); updateCheatDialog();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void QHexEdit::addDebugSym(void) void QHexEdit::addDebugSym(void)

View File

@ -478,9 +478,9 @@ void InputConfDialog_t::openLoadPresetFile(void)
} }
qDebug() << "selected file path : " << filename.toUtf8(); qDebug() << "selected file path : " << filename.toUtf8();
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
loadInputSettingsFromFile(filename.toStdString().c_str()); loadInputSettingsFromFile(filename.toStdString().c_str());
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
updatePortLabels(); updatePortLabels();
updatePortComboBoxes(); updatePortComboBoxes();

View File

@ -419,23 +419,23 @@ void LuaControlDialog_t::startLuaScript(void)
{ {
#ifdef _S9XLUA_H #ifdef _S9XLUA_H
outBuf.clear(); outBuf.clear();
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
if (0 == FCEU_LoadLuaCode(scriptPath->text().toStdString().c_str(), scriptArgs->text().toStdString().c_str())) if (0 == FCEU_LoadLuaCode(scriptPath->text().toStdString().c_str(), scriptArgs->text().toStdString().c_str()))
{ {
char error_msg[2048]; char error_msg[2048];
sprintf( error_msg, "Error: Could not open the selected lua script: '%s'\n", scriptPath->text().toStdString().c_str()); sprintf( error_msg, "Error: Could not open the selected lua script: '%s'\n", scriptPath->text().toStdString().c_str());
FCEUD_PrintError(error_msg); FCEUD_PrintError(error_msg);
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
#endif #endif
} }
//---------------------------------------------------- //----------------------------------------------------
void LuaControlDialog_t::stopLuaScript(void) void LuaControlDialog_t::stopLuaScript(void)
{ {
#ifdef _S9XLUA_H #ifdef _S9XLUA_H
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEU_LuaStop(); FCEU_LuaStop();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
#endif #endif
} }
//---------------------------------------------------- //----------------------------------------------------

View File

@ -470,13 +470,13 @@ void MoviePlayDialog_t::playMovie(void)
pauseframe = strtol(pauseAtFrameEntry->text().toStdString().c_str(), NULL, 0); pauseframe = strtol(pauseAtFrameEntry->text().toStdString().c_str(), NULL, 0);
} }
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
if (FCEUI_LoadMovie(path.c_str(), if (FCEUI_LoadMovie(path.c_str(),
replayReadOnlySetting, pauseframe ? pauseframe : false) == false) replayReadOnlySetting, pauseframe ? pauseframe : false) == false)
{ {
movieLoadError = true; movieLoadError = true;
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
if (movieLoadError) if (movieLoadError)
{ {

View File

@ -264,26 +264,26 @@ void MsgLogViewDialog_t::closeWindow(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void MsgLogViewDialog_t::clearLog(void) void MsgLogViewDialog_t::clearLog(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
msgLog.clear(); msgLog.clear();
txtView->clear(); txtView->clear();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void MsgLogViewDialog_t::updatePeriodic(void) void MsgLogViewDialog_t::updatePeriodic(void)
{ {
if (msgLog.getTotalLineCount() != totalLines) if (msgLog.getTotalLineCount() != totalLines)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
msgLog.loadTextViewer(txtView); msgLog.loadTextViewer(txtView);
totalLines = msgLog.getTotalLineCount(); totalLines = msgLog.getTotalLineCount();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
txtView->moveCursor(QTextCursor::End); txtView->moveCursor(QTextCursor::End);
} }

View File

@ -615,9 +615,9 @@ void nesPaletteView::setActivePalette(void)
//printf("%i %i,%i,%i \n", p, palo[p].r, palo[p].g, palo[p].b ); //printf("%i %i,%i,%i \n", p, palo[p].r, palo[p].g, palo[p].b );
} }
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_SetUserPalette( pal, NUM_COLORS ); FCEUI_SetUserPalette( pal, NUM_COLORS );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int nesPaletteView::loadFromFile( const char *filepath ) int nesPaletteView::loadFromFile( const char *filepath )
@ -1125,10 +1125,10 @@ void nesPalettePickerView::setSelBox( int val )
if ( val != selBox ) if ( val != selBox )
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
PalettePoke( palAddr, val ); PalettePoke( palAddr, val );
FCEUD_UpdatePPUView( -1, 1 ); FCEUD_UpdatePPUView( -1, 1 );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
this->update(); this->update();
} }
@ -1389,19 +1389,19 @@ void nesPalettePickerDialog::closeWindow(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void nesPalettePickerDialog::resetButtonClicked(void) void nesPalettePickerDialog::resetButtonClicked(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
palView->setSelBox( palOrigVal ); palView->setSelBox( palOrigVal );
PalettePoke( palAddr, palOrigVal ); PalettePoke( palAddr, palOrigVal );
FCEUD_UpdatePPUView( -1, 1 ); FCEUD_UpdatePPUView( -1, 1 );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void nesPalettePickerDialog::cancelButtonClicked(void) void nesPalettePickerDialog::cancelButtonClicked(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
PalettePoke( palAddr, palOrigVal ); PalettePoke( palAddr, palOrigVal );
FCEUD_UpdatePPUView( -1, 1 ); FCEUD_UpdatePPUView( -1, 1 );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
//printf("Close Window\n"); //printf("Close Window\n");
done(0); done(0);
@ -1410,10 +1410,10 @@ void nesPalettePickerDialog::cancelButtonClicked(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void nesPalettePickerDialog::okButtonClicked(void) void nesPalettePickerDialog::okButtonClicked(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
PalettePoke( palAddr, palView->getSelBox() ); PalettePoke( palAddr, palView->getSelBox() );
FCEUD_UpdatePPUView( -1, 1 ); FCEUD_UpdatePPUView( -1, 1 );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
//printf("Close Window\n"); //printf("Close Window\n");
done(0); done(0);

View File

@ -529,9 +529,9 @@ void RamSearchDialog_t::periodicUpdate(void)
if (currFrameCounter != frameCounterLastPass) if (currFrameCounter != frameCounterLastPass)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
copyRamToLocalBuffer(); copyRamToLocalBuffer();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
//if ( currFrameCounter != (frameCounterLastPass+1) ) //if ( currFrameCounter != (frameCounterLastPass+1) )
//{ //{
@ -1117,9 +1117,9 @@ void RamSearchDialog_t::resetSearch(void)
{ {
memset(lclMemBuf, 0, sizeof(lclMemBuf)); memset(lclMemBuf, 0, sizeof(lclMemBuf));
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
copyRamToLocalBuffer(); copyRamToLocalBuffer();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
actvSrchList.clear(); actvSrchList.clear();
deactvSrchList.clear(); deactvSrchList.clear();
@ -1294,13 +1294,13 @@ void RamSearchDialog_t::addCheatClicked(void)
} }
strcpy(desc, "Quick Cheat Add"); strcpy(desc, "Quick Cheat Add");
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
FCEUI_AddCheat(desc, addr, GetMem(addr), -1, 1); FCEUI_AddCheat(desc, addr, GetMem(addr), -1, 1);
updateCheatDialog(); updateCheatDialog();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void RamSearchDialog_t::addRamWatchClicked(void) void RamSearchDialog_t::addRamWatchClicked(void)

View File

@ -1477,7 +1477,7 @@ int SymbolEditWindow::exec(void)
if ( ret == QDialog::Accepted ) if ( ret == QDialog::Accepted )
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
if ( isArrayBox->isChecked() ) if ( isArrayBox->isChecked() )
{ {
size = atoi( arraySize->text().toStdString().c_str() ); size = atoi( arraySize->text().toStdString().c_str() );
@ -1562,7 +1562,7 @@ int SymbolEditWindow::exec(void)
sym->trimTrailingSpaces(); sym->trimTrailingSpaces();
} }
debugSymbolTable.save(); // Save table to disk immediately after an add, edit, or delete debugSymbolTable.save(); // Save table to disk immediately after an add, edit, or delete
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
return ret; return ret;
} }

View File

@ -235,7 +235,7 @@ TasEditorWindow::~TasEditorWindow(void)
printf("Destroy Tas Editor Window\n"); printf("Destroy Tas Editor Window\n");
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
//if (!askToSaveProject()) return false; //if (!askToSaveProject()) return false;
// destroy window // destroy window
@ -279,7 +279,7 @@ TasEditorWindow::~TasEditorWindow(void)
clearProjectList(); clearProjectList();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
// Save Horizontal Panel State // Save Horizontal Panel State
settings.setValue("tasEditor/hPanelState", mainHBox->saveState()); settings.setValue("tasEditor/hPanelState", mainHBox->saveState());
@ -1472,7 +1472,7 @@ int TasEditorWindow::initModules(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::frameUpdate(void) void TasEditorWindow::frameUpdate(void)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
//printf("TAS Frame Update: %zi\n", currMovieData.records.size()); //printf("TAS Frame Update: %zi\n", currMovieData.records.size());
@ -1511,14 +1511,14 @@ void TasEditorWindow::frameUpdate(void)
recentProjectMenuReset = false; recentProjectMenuReset = false;
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool TasEditorWindow::loadProject(const char* fullname) bool TasEditorWindow::loadProject(const char* fullname)
{ {
bool success = false; bool success = false;
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
// try to load project // try to load project
if (project.load(fullname)) if (project.load(fullname))
@ -1537,7 +1537,7 @@ bool TasEditorWindow::loadProject(const char* fullname)
updateCaption(); updateCaption();
update(); update();
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
return success; return success;
} }
@ -1545,7 +1545,7 @@ bool TasEditorWindow::saveProject(bool save_compact)
{ {
bool ret = true; bool ret = true;
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
if (project.getProjectFile().empty()) if (project.getProjectFile().empty())
{ {
@ -1564,7 +1564,7 @@ bool TasEditorWindow::saveProject(bool save_compact)
updateCaption(); updateCaption();
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
return ret; return ret;
} }
@ -1901,7 +1901,7 @@ void TasEditorWindow::createNewProject(void)
params.copyCurrentMarkers = copyMarkers->isChecked(); params.copyCurrentMarkers = copyMarkers->isChecked();
params.authorName = authorEdit->text().toStdWString(); params.authorName = authorEdit->text().toStdWString();
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
if ( QDialog::Accepted == ret ) if ( QDialog::Accepted == ret )
{ {
@ -1943,7 +1943,7 @@ void TasEditorWindow::createNewProject(void)
updateCaption(); updateCaption();
update(); update();
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::importMovieFile( const char *path ) void TasEditorWindow::importMovieFile( const char *path )
@ -2370,7 +2370,7 @@ void TasEditorWindow::saveProjectCompactCb(void)
{ {
int ret; int ret;
QDialog dialog(this); QDialog dialog(this);
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION(emuLock);
QGroupBox *fileContentsBox, *greenZoneSaveBox; QGroupBox *fileContentsBox, *greenZoneSaveBox;
QVBoxLayout *mainLayout, *vbox1, *vbox; QVBoxLayout *mainLayout, *vbox1, *vbox;
QHBoxLayout *hbox; QHBoxLayout *hbox;
@ -2507,7 +2507,7 @@ void TasEditorWindow::setCurrentPattern(int idx)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::recordingChanged(int newState) void TasEditorWindow::recordingChanged(int newState)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
int oldState = !movie_readonly ? Qt::Checked : Qt::Unchecked; int oldState = !movie_readonly ? Qt::Checked : Qt::Unchecked;
if ( newState != oldState ) if ( newState != oldState )
@ -2518,21 +2518,21 @@ void TasEditorWindow::recordingChanged(int newState)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::editUndoCB(void) void TasEditorWindow::editUndoCB(void)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
history.undo(); history.undo();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::editRedoCB(void) void TasEditorWindow::editRedoCB(void)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
history.redo(); history.redo();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::editUndoSelCB(void) void TasEditorWindow::editUndoSelCB(void)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
int dragMode = pianoRoll->getDragMode(); int dragMode = pianoRoll->getDragMode();
@ -2545,7 +2545,7 @@ void TasEditorWindow::editUndoSelCB(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::editRedoSelCB(void) void TasEditorWindow::editRedoSelCB(void)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
int dragMode = pianoRoll->getDragMode(); int dragMode = pianoRoll->getDragMode();
@ -2558,7 +2558,7 @@ void TasEditorWindow::editRedoSelCB(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::editDeselectAll(void) void TasEditorWindow::editDeselectAll(void)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
int dragMode = pianoRoll->getDragMode(); int dragMode = pianoRoll->getDragMode();
@ -2570,7 +2570,7 @@ void TasEditorWindow::editDeselectAll(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::editSelectAll(void) void TasEditorWindow::editSelectAll(void)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
int dragMode = pianoRoll->getDragMode(); int dragMode = pianoRoll->getDragMode();
@ -2582,7 +2582,7 @@ void TasEditorWindow::editSelectAll(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::editSelBtwMkrs(void) void TasEditorWindow::editSelBtwMkrs(void)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
int dragMode = pianoRoll->getDragMode(); int dragMode = pianoRoll->getDragMode();
@ -2594,7 +2594,7 @@ void TasEditorWindow::editSelBtwMkrs(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::editReselectClipboard(void) void TasEditorWindow::editReselectClipboard(void)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
int dragMode = pianoRoll->getDragMode(); int dragMode = pianoRoll->getDragMode();
@ -2607,70 +2607,70 @@ void TasEditorWindow::editReselectClipboard(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::editCutCB(void) void TasEditorWindow::editCutCB(void)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
splicer.cutSelectedInputToClipboard(); splicer.cutSelectedInputToClipboard();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::editCopyCB(void) void TasEditorWindow::editCopyCB(void)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
splicer.copySelectedInputToClipboard(); splicer.copySelectedInputToClipboard();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::editPasteCB(void) void TasEditorWindow::editPasteCB(void)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
splicer.pasteInputFromClipboard(); splicer.pasteInputFromClipboard();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::editPasteInsertCB(void) void TasEditorWindow::editPasteInsertCB(void)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
splicer.pasteInsertInputFromClipboard(); splicer.pasteInsertInputFromClipboard();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::editClearCB(void) void TasEditorWindow::editClearCB(void)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
splicer.clearSelectedFrames(); splicer.clearSelectedFrames();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::editDeleteCB(void) void TasEditorWindow::editDeleteCB(void)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
splicer.deleteSelectedFrames(); splicer.deleteSelectedFrames();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::editCloneCB(void) void TasEditorWindow::editCloneCB(void)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
splicer.cloneSelectedFrames(); splicer.cloneSelectedFrames();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::editInsertCB(void) void TasEditorWindow::editInsertCB(void)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
splicer.insertSelectedFrames(); splicer.insertSelectedFrames();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::editInsertNumFramesCB(void) void TasEditorWindow::editInsertNumFramesCB(void)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
splicer.insertNumberOfFrames(); splicer.insertNumberOfFrames();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::editTruncateMovieCB(void) void TasEditorWindow::editTruncateMovieCB(void)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
splicer.truncateMovie(); splicer.truncateMovie();
} }
@ -2947,42 +2947,37 @@ void TasEditorWindow::changeBranchesFontCB(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::playbackPauseCB(void) void TasEditorWindow::playbackPauseCB(void)
{ {
fceuWrapperLock(); FCEU_CRITICAL_SECTION( emuLock );
playback.toggleEmulationPause(); playback.toggleEmulationPause();
pianoRoll->update(); pianoRoll->update();
fceuWrapperUnLock();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::playbackFrameRewind(void) void TasEditorWindow::playbackFrameRewind(void)
{ {
fceuWrapperLock(); FCEU_CRITICAL_SECTION( emuLock );
playback.handleRewindFrame(); playback.handleRewindFrame();
pianoRoll->update(); pianoRoll->update();
fceuWrapperUnLock();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::playbackFrameForward(void) void TasEditorWindow::playbackFrameForward(void)
{ {
fceuWrapperLock(); FCEU_CRITICAL_SECTION( emuLock );
playback.handleForwardFrame(); playback.handleForwardFrame();
pianoRoll->update(); pianoRoll->update();
fceuWrapperUnLock();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::playbackFrameRewindFull(void) void TasEditorWindow::playbackFrameRewindFull(void)
{ {
fceuWrapperLock(); FCEU_CRITICAL_SECTION( emuLock );
playback.handleRewindFull(); playback.handleRewindFull();
pianoRoll->update(); pianoRoll->update();
fceuWrapperUnLock();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::playbackFrameForwardFull(void) void TasEditorWindow::playbackFrameForwardFull(void)
{ {
fceuWrapperLock(); FCEU_CRITICAL_SECTION( emuLock );
playback.handleForwardFull(); playback.handleForwardFull();
pianoRoll->update(); pianoRoll->update();
fceuWrapperUnLock();
} }
// ---------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------
void TasEditorWindow::playbackFollowCursorCb(bool val) void TasEditorWindow::playbackFollowCursorCb(bool val)
@ -3002,10 +2997,9 @@ void TasEditorWindow::playbackAutoRestoreCb(bool val)
// ---------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------
void TasEditorWindow::scrollSelectionUpOne(void) void TasEditorWindow::scrollSelectionUpOne(void)
{ {
FCEU_CRITICAL_SECTION( emuLock );
int dragMode = pianoRoll->getDragMode(); int dragMode = pianoRoll->getDragMode();
fceuWrapperLock();
//printf("DragMode: %i\n", dragMode); //printf("DragMode: %i\n", dragMode);
if ( (dragMode != DRAG_MODE_SELECTION) && (dragMode != DRAG_MODE_DESELECTION) ) if ( (dragMode != DRAG_MODE_SELECTION) && (dragMode != DRAG_MODE_DESELECTION) )
@ -3018,15 +3012,13 @@ void TasEditorWindow::scrollSelectionUpOne(void)
} }
pianoRoll->update(); pianoRoll->update();
} }
fceuWrapperUnLock();
} }
// ---------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------
void TasEditorWindow::scrollSelectionDnOne(void) void TasEditorWindow::scrollSelectionDnOne(void)
{ {
FCEU_CRITICAL_SECTION( emuLock );
int dragMode = pianoRoll->getDragMode(); int dragMode = pianoRoll->getDragMode();
fceuWrapperLock();
//printf("DragMode: %i\n", dragMode); //printf("DragMode: %i\n", dragMode);
if ( (dragMode != DRAG_MODE_SELECTION) && (dragMode != DRAG_MODE_DESELECTION) ) if ( (dragMode != DRAG_MODE_SELECTION) && (dragMode != DRAG_MODE_DESELECTION) )
@ -3039,7 +3031,6 @@ void TasEditorWindow::scrollSelectionDnOne(void)
} }
pianoRoll->update(); pianoRoll->update();
} }
fceuWrapperUnLock();
} }
// ---------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------
void TasEditorWindow::histTreeItemActivated(QTreeWidgetItem *item, int col) void TasEditorWindow::histTreeItemActivated(QTreeWidgetItem *item, int col)
@ -3050,11 +3041,13 @@ void TasEditorWindow::histTreeItemActivated(QTreeWidgetItem *item, int col)
{ {
return; return;
} }
FCEU_CRITICAL_SECTION( emuLock );
history.handleSingleClick(row); history.handleSingleClick(row);
} }
// ---------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------
void TasEditorWindow::tabViewChanged(int idx) void TasEditorWindow::tabViewChanged(int idx)
{ {
FCEU_CRITICAL_SECTION( emuLock );
taseditorConfig.displayBranchesTree = (idx == 1); taseditorConfig.displayBranchesTree = (idx == 1);
bookmarks.redrawBookmarksSectionCaption(); bookmarks.redrawBookmarksSectionCaption();
} }
@ -3063,7 +3056,7 @@ void TasEditorWindow::openProjectSaveOptions(void)
{ {
int ret; int ret;
QDialog dialog(this); QDialog dialog(this);
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
QGroupBox *settingsBox, *fileContentsBox, *greenZoneSaveBox; QGroupBox *settingsBox, *fileContentsBox, *greenZoneSaveBox;
QVBoxLayout *mainLayout, *vbox1, *vbox; QVBoxLayout *mainLayout, *vbox1, *vbox;
QHBoxLayout *hbox1, *hbox; QHBoxLayout *hbox1, *hbox;
@ -3216,7 +3209,7 @@ void TasEditorWindow::setGreenzoneCapacity(void)
int ret; int ret;
int newValue = taseditorConfig.greenzoneCapacity; int newValue = taseditorConfig.greenzoneCapacity;
QInputDialog dialog(this); QInputDialog dialog(this);
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
dialog.setWindowTitle( tr("Greenzone Capacity") ); dialog.setWindowTitle( tr("Greenzone Capacity") );
dialog.setInputMode( QInputDialog::IntInput ); dialog.setInputMode( QInputDialog::IntInput );
@ -3255,7 +3248,7 @@ void TasEditorWindow::setMaxUndoCapacity(void)
int ret; int ret;
int newValue = taseditorConfig.maxUndoLevels; int newValue = taseditorConfig.maxUndoLevels;
QInputDialog dialog(this); QInputDialog dialog(this);
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
dialog.setWindowTitle( tr("Max undo levels") ); dialog.setWindowTitle( tr("Max undo levels") );
dialog.setInputMode( QInputDialog::IntInput ); dialog.setInputMode( QInputDialog::IntInput );
@ -3553,7 +3546,7 @@ bool TasEditorWindow::handleInputColumnSet(int joy, int button)
void TasEditorWindow::setMarkers(void) void TasEditorWindow::setMarkers(void)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
RowsSelection* current_selection = selection.getCopyOfCurrentRowsSelection(); RowsSelection* current_selection = selection.getCopyOfCurrentRowsSelection();
if (current_selection->size()) if (current_selection->size())
@ -3581,7 +3574,7 @@ void TasEditorWindow::setMarkers(void)
} }
void TasEditorWindow::removeMarkers(void) void TasEditorWindow::removeMarkers(void)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
RowsSelection* current_selection = selection.getCopyOfCurrentRowsSelection(); RowsSelection* current_selection = selection.getCopyOfCurrentRowsSelection();
if (current_selection->size()) if (current_selection->size())
@ -3608,7 +3601,7 @@ void TasEditorWindow::removeMarkers(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TasEditorWindow::ungreenzoneSelectedFrames(void) void TasEditorWindow::ungreenzoneSelectedFrames(void)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
greenzone.ungreenzoneSelectedFrames(); greenzone.ungreenzoneSelectedFrames();
} }
@ -4293,7 +4286,7 @@ void QPianoRoll::resizeEvent(QResizeEvent *event)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void QPianoRoll::mouseDoubleClickEvent(QMouseEvent * event) void QPianoRoll::mouseDoubleClickEvent(QMouseEvent * event)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
int col, line, row_index, column_index, kbModifiers, alt_pressed; int col, line, row_index, column_index, kbModifiers, alt_pressed;
bool headerClicked, row_valid; bool headerClicked, row_valid;
QPoint c = convPixToCursor( event->pos() ); QPoint c = convPixToCursor( event->pos() );
@ -4436,7 +4429,7 @@ void QPianoRoll::contextMenuEvent(QContextMenuEvent *event)
int mkr; int mkr;
QAction *act; QAction *act;
QMenu menu(this); QMenu menu(this);
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
mkr = markersManager->getMarkerAtFrame( rowUnderMouse ); mkr = markersManager->getMarkerAtFrame( rowUnderMouse );
@ -4512,7 +4505,7 @@ void QPianoRoll::contextMenuEvent(QContextMenuEvent *event)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void QPianoRoll::mousePressEvent(QMouseEvent * event) void QPianoRoll::mousePressEvent(QMouseEvent * event)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
int col, line, row_index, column_index, kbModifiers, alt_pressed; int col, line, row_index, column_index, kbModifiers, alt_pressed;
bool row_valid, headerClicked; bool row_valid, headerClicked;
QPoint c = convPixToCursor( event->pos() ); QPoint c = convPixToCursor( event->pos() );
@ -4699,7 +4692,7 @@ void QPianoRoll::mousePressEvent(QMouseEvent * event)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void QPianoRoll::mouseReleaseEvent(QMouseEvent * event) void QPianoRoll::mouseReleaseEvent(QMouseEvent * event)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
int col, line; int col, line;
QPoint c = convPixToCursor( event->pos() ); QPoint c = convPixToCursor( event->pos() );
@ -4737,7 +4730,7 @@ void QPianoRoll::mouseReleaseEvent(QMouseEvent * event)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void QPianoRoll::mouseMoveEvent(QMouseEvent * event) void QPianoRoll::mouseMoveEvent(QMouseEvent * event)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
int col, line; int col, line;
QPoint c = convPixToCursor( event->pos() ); QPoint c = convPixToCursor( event->pos() );
@ -4768,7 +4761,7 @@ void QPianoRoll::mouseMoveEvent(QMouseEvent * event)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void QPianoRoll::wheelEvent(QWheelEvent *event) void QPianoRoll::wheelEvent(QWheelEvent *event)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
int ofs, kbModifiers, msButtons, zDelta; int ofs, kbModifiers, msButtons, zDelta;
QPoint numPixels = event->pixelDelta(); QPoint numPixels = event->pixelDelta();
@ -4961,16 +4954,16 @@ void QPianoRoll::dropEvent(QDropEvent *event)
if ( fi.suffix().compare("fm3") == 0 ) if ( fi.suffix().compare("fm3") == 0 )
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
tasWin->loadProject( fi.filePath().toStdString().c_str() ); tasWin->loadProject( fi.filePath().toStdString().c_str() );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
event->accept(); event->accept();
} }
else if ( fi.suffix().compare("fm2") == 0 ) else if ( fi.suffix().compare("fm2") == 0 )
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
tasWin->importMovieFile( fi.filePath().toStdString().c_str() ); tasWin->importMovieFile( fi.filePath().toStdString().c_str() );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
event->accept(); event->accept();
} }
} }
@ -5988,7 +5981,7 @@ void QPianoRoll::finishDrag(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void QPianoRoll::paintEvent(QPaintEvent *event) void QPianoRoll::paintEvent(QPaintEvent *event)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
int x, y, row, nrow, lineNum; int x, y, row, nrow, lineNum;
QPainter painter(this); QPainter painter(this);
QColor white(255,255,255), black(0,0,0), blkColor, rowTextColor; QColor white(255,255,255), black(0,0,0), blkColor, rowTextColor;
@ -6494,7 +6487,7 @@ bookmarkPreviewPopup::bookmarkPreviewPopup( int index, QWidget *parent )
//qApp->installEventFilter(this); //qApp->installEventFilter(this);
fceuWrapperLock(); //FCEU_WRAPPER_LOCK();
// retrieve info from the pointed bookmark's Markers // retrieve info from the pointed bookmark's Markers
int frame = bookmarks->bookmarksArray[index].snapshot.keyFrame; int frame = bookmarks->bookmarksArray[index].snapshot.keyFrame;
@ -6555,7 +6548,7 @@ bookmarkPreviewPopup::bookmarkPreviewPopup( int index, QWidget *parent )
move(pos); move(pos);
fceuWrapperUnLock(); //FCEU_WRAPPER_UNLOCK();
alpha = 0; alpha = 0;
actv = true; actv = true;

View File

@ -75,6 +75,8 @@ BOOKMARKS::BOOKMARKS(QWidget *parent)
this->setMouseTracking(true); this->setMouseTracking(true);
calcFontData(); calcFontData();
redrawFlag = false;
} }
BOOKMARKS::~BOOKMARKS(void) BOOKMARKS::~BOOKMARKS(void)
@ -227,15 +229,26 @@ void BOOKMARKS::update()
if (mustCheckItemUnderMouse) if (mustCheckItemUnderMouse)
{ {
if (editMode == EDIT_MODE_BRANCHES) if (editMode == EDIT_MODE_BRANCHES)
{
itemUnderMouse = branches->findItemUnderMouse(mouseX, mouseY); itemUnderMouse = branches->findItemUnderMouse(mouseX, mouseY);
}
else if (editMode == EDIT_MODE_BOTH) else if (editMode == EDIT_MODE_BOTH)
{
itemUnderMouse = findItemUnderMouse(); itemUnderMouse = findItemUnderMouse();
}
else else
{
itemUnderMouse = ITEM_UNDER_MOUSE_NONE; itemUnderMouse = ITEM_UNDER_MOUSE_NONE;
}
mustCheckItemUnderMouse = false; mustCheckItemUnderMouse = false;
redrawFlag = true;
} }
QWidget::update(); if ( redrawFlag )
{
QWidget::update();
redrawFlag = false;
}
} }
// stores commands in array for update() function // stores commands in array for update() function
@ -471,6 +484,7 @@ void BOOKMARKS::redrawBookmarksList(bool eraseBG)
{ {
//InvalidateRect(hwndBookmarksList, 0, eraseBG); //InvalidateRect(hwndBookmarksList, 0, eraseBG);
} }
redrawFlag = true;
} }
void BOOKMARKS::redrawChangedBookmarks(int frame) void BOOKMARKS::redrawChangedBookmarks(int frame)
{ {
@ -484,11 +498,11 @@ void BOOKMARKS::redrawChangedBookmarks(int frame)
} }
void BOOKMARKS::redrawBookmark(int bookmarkNumber) void BOOKMARKS::redrawBookmark(int bookmarkNumber)
{ {
//redrawBookmarksListRow((bookmarkNumber + TOTAL_BOOKMARKS - 1) % TOTAL_BOOKMARKS); redrawFlag = true;
} }
void BOOKMARKS::redrawBookmarksListRow(int rowIndex) void BOOKMARKS::redrawBookmarksListRow(int rowIndex)
{ {
//ListView_RedrawItems(hwndBookmarksList, rowIndex, rowIndex); redrawFlag = true;
} }
void BOOKMARKS::resizeEvent(QResizeEvent *event) void BOOKMARKS::resizeEvent(QResizeEvent *event)
@ -499,7 +513,7 @@ void BOOKMARKS::resizeEvent(QResizeEvent *event)
void BOOKMARKS::paintEvent(QPaintEvent *event) void BOOKMARKS::paintEvent(QPaintEvent *event)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
QPainter painter(this); QPainter painter(this);
int x, y, item, cell_y; int x, y, item, cell_y;
QColor white(255,255,255), black(0,0,0), blkColor; QColor white(255,255,255), black(0,0,0), blkColor;
@ -723,7 +737,7 @@ int BOOKMARKS::calcColumn( int px )
void BOOKMARKS::mousePressEvent(QMouseEvent * event) void BOOKMARKS::mousePressEvent(QMouseEvent * event)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
int item, row_under_mouse, item_valid; int item, row_under_mouse, item_valid;
QPoint c = convPixToCursor( event->pos() ); QPoint c = convPixToCursor( event->pos() );
@ -758,11 +772,13 @@ void BOOKMARKS::mousePressEvent(QMouseEvent * event)
playback->handleMiddleButtonClick(); playback->handleMiddleButtonClick();
} }
//printf("Mouse Button Pressed: 0x%x (%i,%i)\n", event->button(), c.x(), c.y() ); //printf("Mouse Button Pressed: 0x%x (%i,%i)\n", event->button(), c.x(), c.y() );
redrawFlag = true;
} }
void BOOKMARKS::mouseReleaseEvent(QMouseEvent * event) void BOOKMARKS::mouseReleaseEvent(QMouseEvent * event)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
//QPoint c = convPixToCursor( event->pos() ); //QPoint c = convPixToCursor( event->pos() );
//printf("Mouse Button Released: 0x%x (%i,%i)\n", event->button(), c.x(), c.y() ); //printf("Mouse Button Released: 0x%x (%i,%i)\n", event->button(), c.x(), c.y() );
@ -783,11 +799,12 @@ void BOOKMARKS::mouseReleaseEvent(QMouseEvent * event)
} }
bookmarkRightclicked = ITEM_UNDER_MOUSE_NONE; bookmarkRightclicked = ITEM_UNDER_MOUSE_NONE;
} }
redrawFlag = true;
} }
void BOOKMARKS::showImage(void) void BOOKMARKS::showImage(void)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
//static_cast<bookmarkPreviewPopup*>(fceuCustomToolTipShow( imagePos, new bookmarkPreviewPopup(imageItem, this) )); //static_cast<bookmarkPreviewPopup*>(fceuCustomToolTipShow( imagePos, new bookmarkPreviewPopup(imageItem, this) ));
bool item_valid = (imageItem >= 0) && (imageItem < TOTAL_BOOKMARKS); bool item_valid = (imageItem >= 0) && (imageItem < TOTAL_BOOKMARKS);
@ -803,7 +820,7 @@ void BOOKMARKS::showImage(void)
void BOOKMARKS::mouseMoveEvent(QMouseEvent * event) void BOOKMARKS::mouseMoveEvent(QMouseEvent * event)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
int item, row_under_mouse, item_valid, column; int item, row_under_mouse, item_valid, column;
QPoint c = convPixToCursor( event->pos() ); QPoint c = convPixToCursor( event->pos() );
@ -863,7 +880,7 @@ bool BOOKMARKS::event(QEvent *event)
{ {
if (event->type() == QEvent::ToolTip) if (event->type() == QEvent::ToolTip)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
int item, row_under_mouse, item_valid, column; int item, row_under_mouse, item_valid, column;
QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event); QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event);

View File

@ -157,6 +157,8 @@ private:
int pxStartCol2; int pxStartCol2;
int pxStartCol3; int pxStartCol3;
bool redrawFlag;
private slots: private slots:
void showImage(void); void showImage(void);

View File

@ -513,7 +513,7 @@ void BRANCHES::mouseDoubleClickEvent(QMouseEvent * event)
void BRANCHES::mousePressEvent(QMouseEvent * event) void BRANCHES::mousePressEvent(QMouseEvent * event)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
int item = findItemUnderMouse( event->pos().x(), event->pos().y() ); int item = findItemUnderMouse( event->pos().x(), event->pos().y() );
bookmarks->itemUnderMouse = item; bookmarks->itemUnderMouse = item;
@ -563,7 +563,7 @@ void BRANCHES::mousePressEvent(QMouseEvent * event)
void BRANCHES::mouseReleaseEvent(QMouseEvent * event) void BRANCHES::mouseReleaseEvent(QMouseEvent * event)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
int item = findItemUnderMouse( event->pos().x(), event->pos().y() ); int item = findItemUnderMouse( event->pos().x(), event->pos().y() );
bookmarks->itemUnderMouse = item; bookmarks->itemUnderMouse = item;
@ -585,7 +585,7 @@ void BRANCHES::mouseReleaseEvent(QMouseEvent * event)
void BRANCHES::showImage(void) void BRANCHES::showImage(void)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
//static_cast<bookmarkPreviewPopup*>(fceuCustomToolTipShow( imagePos, new bookmarkPreviewPopup(imageItem, this) )); //static_cast<bookmarkPreviewPopup*>(fceuCustomToolTipShow( imagePos, new bookmarkPreviewPopup(imageItem, this) ));
bool item_valid = (imageItem >= 0) && (imageItem < TOTAL_BOOKMARKS); bool item_valid = (imageItem >= 0) && (imageItem < TOTAL_BOOKMARKS);
@ -602,7 +602,7 @@ void BRANCHES::showImage(void)
void BRANCHES::mouseMoveEvent(QMouseEvent * event) void BRANCHES::mouseMoveEvent(QMouseEvent * event)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
int item, item_valid; int item, item_valid;
item = findItemUnderMouse( event->pos().x(), event->pos().y() ); item = findItemUnderMouse( event->pos().x(), event->pos().y() );
@ -672,7 +672,7 @@ bool BRANCHES::event(QEvent *event)
{ {
if (event->type() == QEvent::ToolTip) if (event->type() == QEvent::ToolTip)
{ {
fceuCriticalSection emuLock; FCEU_CRITICAL_SECTION( emuLock );
int item, item_valid; int item, item_valid;
QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event); QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event);

View File

@ -336,7 +336,7 @@ void TimingConfDialog_t::emuSchedNiceChange(int val)
{ {
return; return;
} }
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
if (consoleWindow->emulatorThread->setNicePriority(-val)) if (consoleWindow->emulatorThread->setNicePriority(-val))
{ {
char msg[1024]; char msg[1024];
@ -354,7 +354,7 @@ void TimingConfDialog_t::emuSchedNiceChange(int val)
consoleWindow->QueueErrorMsgWindow(msg); consoleWindow->QueueErrorMsgWindow(msg);
updateSliderValues(); updateSliderValues();
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
#endif #endif
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -366,13 +366,13 @@ void TimingConfDialog_t::emuSchedPrioChange(int val)
} }
#ifdef WIN32 #ifdef WIN32
printf("Setting EMU Thread to %i\n", val); printf("Setting EMU Thread to %i\n", val);
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
consoleWindow->emulatorThread->setPriority((QThread::Priority)val); consoleWindow->emulatorThread->setPriority((QThread::Priority)val);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
#else #else
int policy, prio; int policy, prio;
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
consoleWindow->emulatorThread->getSchedParam(policy, prio); consoleWindow->emulatorThread->getSchedParam(policy, prio);
if (consoleWindow->emulatorThread->setSchedParam(policy, val)) if (consoleWindow->emulatorThread->setSchedParam(policy, val))
@ -392,7 +392,7 @@ void TimingConfDialog_t::emuSchedPrioChange(int val)
consoleWindow->QueueErrorMsgWindow(msg); consoleWindow->QueueErrorMsgWindow(msg);
updateSliderValues(); updateSliderValues();
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
#endif #endif
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -405,7 +405,7 @@ void TimingConfDialog_t::emuSchedPolicyChange(int index)
{ {
return; return;
} }
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
consoleWindow->emulatorThread->getSchedParam(policy, prio); consoleWindow->emulatorThread->getSchedParam(policy, prio);
policy = emuSchedPolicyBox->itemData(index).toInt(); policy = emuSchedPolicyBox->itemData(index).toInt();
@ -430,7 +430,7 @@ void TimingConfDialog_t::emuSchedPolicyChange(int index)
updatePolicyBox(); updatePolicyBox();
updateSliderLimits(); updateSliderLimits();
updateSliderValues(); updateSliderValues();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
#endif #endif
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -441,7 +441,7 @@ void TimingConfDialog_t::guiSchedNiceChange(int val)
{ {
return; return;
} }
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
if (consoleWindow->setNicePriority(-val)) if (consoleWindow->setNicePriority(-val))
{ {
char msg[1024]; char msg[1024];
@ -459,7 +459,7 @@ void TimingConfDialog_t::guiSchedNiceChange(int val)
consoleWindow->QueueErrorMsgWindow(msg); consoleWindow->QueueErrorMsgWindow(msg);
updateSliderValues(); updateSliderValues();
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
#endif #endif
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -475,7 +475,7 @@ void TimingConfDialog_t::guiSchedPrioChange(int val)
{ {
return; return;
} }
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
consoleWindow->getSchedParam(policy, prio); consoleWindow->getSchedParam(policy, prio);
if (consoleWindow->setSchedParam(policy, val)) if (consoleWindow->setSchedParam(policy, val))
@ -495,7 +495,7 @@ void TimingConfDialog_t::guiSchedPrioChange(int val)
consoleWindow->QueueErrorMsgWindow(msg); consoleWindow->QueueErrorMsgWindow(msg);
updateSliderValues(); updateSliderValues();
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
#endif #endif
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -508,7 +508,7 @@ void TimingConfDialog_t::guiSchedPolicyChange(int index)
{ {
return; return;
} }
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
consoleWindow->getSchedParam(policy, prio); consoleWindow->getSchedParam(policy, prio);
policy = guiSchedPolicyBox->itemData(index).toInt(); policy = guiSchedPolicyBox->itemData(index).toInt();
@ -533,7 +533,7 @@ void TimingConfDialog_t::guiSchedPolicyChange(int index)
updatePolicyBox(); updatePolicyBox();
updateSliderLimits(); updateSliderLimits();
updateSliderValues(); updateSliderValues();
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
#endif #endif
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -675,7 +675,7 @@ void TimingConfDialog_t::emuTimingMechChange(int index)
{ {
return; return;
} }
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
mode = timingDevSelBox->itemData(index).toInt(); mode = timingDevSelBox->itemData(index).toInt();
@ -685,7 +685,7 @@ void TimingConfDialog_t::emuTimingMechChange(int index)
g_config->setOption("SDL.EmuTimingMech", mode); g_config->setOption("SDL.EmuTimingMech", mode);
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TimingConfDialog_t::updateTimingMech(void) void TimingConfDialog_t::updateTimingMech(void)
@ -703,39 +703,39 @@ void TimingConfDialog_t::updateTimingMech(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TimingConfDialog_t::overclockingToggled(bool on) void TimingConfDialog_t::overclockingToggled(bool on)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
if ( !newppu ) if ( !newppu )
{ {
overclock_enabled = on; overclock_enabled = on;
g_config->setOption("SDL.OverClockEnable", overclock_enabled ); g_config->setOption("SDL.OverClockEnable", overclock_enabled );
} }
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TimingConfDialog_t::postRenderChanged(int value) void TimingConfDialog_t::postRenderChanged(int value)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
postrenderscanlines = value; postrenderscanlines = value;
g_config->setOption("SDL.PostRenderScanlines", postrenderscanlines ); g_config->setOption("SDL.PostRenderScanlines", postrenderscanlines );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
//printf("Post Render %i\n", postrenderscanlines ); //printf("Post Render %i\n", postrenderscanlines );
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TimingConfDialog_t::vblankScanlinesChanged(int value) void TimingConfDialog_t::vblankScanlinesChanged(int value)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
vblankscanlines = value; vblankscanlines = value;
g_config->setOption("SDL.VBlankScanlines", vblankscanlines ); g_config->setOption("SDL.VBlankScanlines", vblankscanlines );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
//printf("Vblank Scanlines %i\n", vblankscanlines ); //printf("Vblank Scanlines %i\n", vblankscanlines );
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void TimingConfDialog_t::no7bitChanged(int value) void TimingConfDialog_t::no7bitChanged(int value)
{ {
fceuWrapperLock(); FCEU_WRAPPER_LOCK();
skip_7bit_overclocking = (value != Qt::Unchecked); skip_7bit_overclocking = (value != Qt::Unchecked);
g_config->setOption("SDL.Skip7bitOverClocking", skip_7bit_overclocking ); g_config->setOption("SDL.Skip7bitOverClocking", skip_7bit_overclocking );
fceuWrapperUnLock(); FCEU_WRAPPER_UNLOCK();
//printf("Skip 7-bit: %i\n", skip_7bit_overclocking ); //printf("Skip 7-bit: %i\n", skip_7bit_overclocking );
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -99,7 +99,7 @@ static int frameskip=0;
static int periodic_saves = 0; static int periodic_saves = 0;
static int mutexLocks = 0; static int mutexLocks = 0;
static int mutexPending = 0; static int mutexPending = 0;
static bool emulatorHasMutux = 0; static bool emulatorHasMutex = 0;
unsigned int emulatorCycleCount = 0; unsigned int emulatorCycleCount = 0;
extern double g_fpsScale; extern double g_fpsScale;
@ -1212,6 +1212,26 @@ static void DoFun(int frameskip, int periodic_saves)
emulatorCycleCount++; emulatorCycleCount++;
} }
static std::string lockFile;
void fceuWrapperLock(const char *filename, int line, const char *func)
{
char txt[32];
fceuWrapperLock();
if ( mutexLocks > 1 )
{
printf("Recursive Lock:%i\n", mutexLocks );
printf("Already Locked By: %s\n", lockFile.c_str() );
printf("Requested By: %s:%i - %s\n", filename, line, func );
}
sprintf( txt, ":%i - ", line );
lockFile.assign(filename);
lockFile.append(txt);
lockFile.append(func);
}
void fceuWrapperLock(void) void fceuWrapperLock(void)
{ {
mutexPending++; mutexPending++;
@ -1220,9 +1240,30 @@ void fceuWrapperLock(void)
consoleWindow->mutex->lock(); consoleWindow->mutex->lock();
} }
mutexPending--; mutexPending--;
if ( mutexLocks > 0 )
{
printf("Recursive Lock:%i\n", mutexLocks );
}
mutexLocks++; mutexLocks++;
} }
bool fceuWrapperTryLock(const char *filename, int line, const char *func, int timeout)
{
char txt[32];
bool lockAcq = false;
lockAcq = fceuWrapperTryLock( timeout );
if ( lockAcq )
{
sprintf( txt, ":%i - ", line );
lockFile.assign(filename);
lockFile.append(txt);
lockFile.append(func);
}
return lockAcq;
}
bool fceuWrapperTryLock(int timeout) bool fceuWrapperTryLock(int timeout)
{ {
bool lockAcq = false; bool lockAcq = false;
@ -1254,6 +1295,7 @@ void fceuWrapperUnLock(void)
else else
{ {
printf("Error: Mutex is Already UnLocked\n"); printf("Error: Mutex is Already UnLocked\n");
abort();
} }
} }
@ -1273,7 +1315,7 @@ int fceuWrapperUpdate( void )
msleep( 100 ); msleep( 100 );
} }
lock_acq = fceuWrapperTryLock(); lock_acq = fceuWrapperTryLock( __FILE__, __LINE__, __func__ );
if ( !lock_acq ) if ( !lock_acq )
{ {
@ -1285,7 +1327,7 @@ int fceuWrapperUpdate( void )
return -1; return -1;
} }
emulatorHasMutux = 1; emulatorHasMutex = 1;
if ( GameInfo ) if ( GameInfo )
{ {
@ -1299,7 +1341,7 @@ int fceuWrapperUpdate( void )
} }
fceuWrapperUnLock(); fceuWrapperUnLock();
emulatorHasMutux = 0; emulatorHasMutex = 0;
while ( SpeedThrottle() ) while ( SpeedThrottle() )
{ {
@ -1312,7 +1354,7 @@ int fceuWrapperUpdate( void )
{ {
fceuWrapperUnLock(); fceuWrapperUnLock();
emulatorHasMutux = 0; emulatorHasMutex = 0;
msleep( 100 ); msleep( 100 );
} }

View File

@ -35,7 +35,9 @@ int fceuWrapperMemoryCleanup( void );
int fceuWrapperClose( void ); int fceuWrapperClose( void );
int fceuWrapperUpdate( void ); int fceuWrapperUpdate( void );
void fceuWrapperLock(void); void fceuWrapperLock(void);
void fceuWrapperLock(const char *filename, int line, const char *func);
bool fceuWrapperTryLock(int timeout = 1000); bool fceuWrapperTryLock(int timeout = 1000);
bool fceuWrapperTryLock(const char *filename, int line, const char *func, int timeout = 1000);
bool fceuWrapperIsLocked(void); bool fceuWrapperIsLocked(void);
void fceuWrapperUnLock(void); void fceuWrapperUnLock(void);
int fceuWrapperSoftReset(void); int fceuWrapperSoftReset(void);
@ -47,10 +49,10 @@ void fceuWrapperRequestAppExit(void);
class fceuCriticalSection class fceuCriticalSection
{ {
public: public:
fceuCriticalSection(void) fceuCriticalSection( const char *filename, int lineNum, const char *func )
{ {
//printf("Wrapper Lock\n"); //printf("Wrapper Lock\n");
fceuWrapperLock(); fceuWrapperLock( filename, lineNum, func );
} }
~fceuCriticalSection(void) ~fceuCriticalSection(void)
@ -59,3 +61,15 @@ class fceuCriticalSection
fceuWrapperUnLock(); fceuWrapperUnLock();
} }
}; };
#define FCEU_WRAPPER_LOCK() \
fceuWrapperLock( __FILE__, __LINE__, __func__ )
#define FCEU_WRAPPER_TRYLOCK(timeout) \
fceuWrapperTryLock( __FILE__, __LINE__, __func__, timeout )
#define FCEU_WRAPPER_UNLOCK() \
fceuWrapperUnLock()
#define FCEU_CRITICAL_SECTION(x) \
fceuCriticalSection x(__FILE__, __LINE__, __func__)