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

View File

@ -476,10 +476,10 @@ void CodeDataLoggerDialog_t::saveCdlFileAs(void)
}
//qDebug() << "selected file path : " << filename.toUtf8();
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
strcpy(loadedcdfile, filename.toStdString().c_str());
SaveCDLogFile();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------
void CodeDataLoggerDialog_t::loadCdlFile(void)
@ -531,9 +531,9 @@ void CodeDataLoggerDialog_t::loadCdlFile(void)
}
//qDebug() << "selected file path : " << filename.toUtf8();
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
LoadCDLog(filename.toStdString().c_str());
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
return;
}
@ -754,7 +754,7 @@ static int getDefaultCDLFile(char *filepath)
//----------------------------------------------------
void FreeCDLog(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
if (cdloggerdata)
{
free(cdloggerdata);
@ -767,14 +767,14 @@ void FreeCDLog(void)
cdloggervdata = NULL;
cdloggerVideoDataSize = 0;
}
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------
void InitCDLog(void)
{
int rom_sel = 0;
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
if (GameInfo->type == GIT_FDS)
{
rom_sel = 1;
@ -794,7 +794,7 @@ void InitCDLog(void)
cdloggervdata = (unsigned char *)malloc(8192);
}
}
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------
void ResetCDLog(void)
@ -803,7 +803,7 @@ void ResetCDLog(void)
{
return;
}
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
codecount = datacount = rendercount = vromreadcount = 0;
undefinedcount = cdloggerdataSize;
@ -829,7 +829,7 @@ void ResetCDLog(void)
memset(cdloggervdata, 0, 8192);
}
}
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------
bool LoadCDLog(const char *nameo)
@ -882,12 +882,12 @@ bool LoadCDLog(const char *nameo)
//----------------------------------------------------
void StartCDLogging(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_SetLoggingCD(1);
//EnableTracerMenuItems();
//SetDlgItemText(hCDLogger, BTN_CDLOGGER_START_PAUSE, "Pause");
autoSaveArmedCDL = true;
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------
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);
// return false;
//}
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_SetLoggingCD(0);
//EnableTracerMenuItems();
//SetDlgItemText(hCDLogger, BTN_CDLOGGER_START_PAUSE, "Start");
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
return true;
}
//----------------------------------------------------

View File

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

View File

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

View File

@ -572,10 +572,10 @@ void ConsoleVideoConfDialog_t::closeWindow(void)
//----------------------------------------------------
void ConsoleVideoConfDialog_t::resetVideo(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
KillVideo ();
InitVideo (GameInfo);
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------
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 );
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
newppu = reqNewPPU;
@ -796,7 +796,7 @@ void ConsoleVideoConfDialog_t::use_new_PPU_changed( bool value )
g_config->save ();
UpdateEMUCore (g_config);
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------
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->save ();
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
UpdateEMUCore (g_config);
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------
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->save ();
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
RefreshThrottleFPS();
KillSound();
InitSound();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------
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->save ();
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
UpdateEMUCore (g_config);
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------
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->save ();
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
UpdateEMUCore (g_config);
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------
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->save ();
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_SetShowFPS( (value == Qt::Checked) );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------
void ConsoleVideoConfDialog_t::aspectEnableChanged( int value )
@ -951,18 +951,18 @@ void ConsoleVideoConfDialog_t::regionChanged(int index)
// reset sound subsystem for changes to take effect
if ( actRegion != region )
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_SetRegion (region, true);
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
}
//----------------------------------------------------
void ConsoleVideoConfDialog_t::inputDisplayChanged(int index)
{
//printf("Scaler: %i : %i \n", index, scalerSelect->itemData(index).toInt() );
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
input_display = inputDisplaySel->itemData(index).toInt();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
g_config->setOption ("SDL.InputDisplay", input_display);
g_config->save ();
@ -1022,16 +1022,16 @@ void ConsoleVideoConfDialog_t::drawInputAidsChanged( int value )
g_config->setOption("SDL.DrawInputAids", draw );
g_config->save ();
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
drawInputAidsEnable = draw;
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------
void ConsoleVideoConfDialog_t::showFrameCountChanged( int value )
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
frame_display = (value != Qt::Unchecked);
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
//printf("Value:%i \n", value );
g_config->setOption("SDL.ShowFrameCount", frame_display );
@ -1041,9 +1041,9 @@ void ConsoleVideoConfDialog_t::showFrameCountChanged( int value )
//----------------------------------------------------
void ConsoleVideoConfDialog_t::showLagCountChanged( int value )
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
lagCounterDisplay = (value != Qt::Unchecked);
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
//printf("Value:%i \n", value );
g_config->setOption("SDL.ShowLagCount", lagCounterDisplay );
@ -1053,9 +1053,9 @@ void ConsoleVideoConfDialog_t::showLagCountChanged( int value )
//----------------------------------------------------
void ConsoleVideoConfDialog_t::showRerecordCountChanged( int value )
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
rerecord_display = (value != Qt::Unchecked);
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
//printf("Value:%i \n", value );
g_config->setOption("SDL.ShowRerecordCount", rerecord_display );

View File

@ -301,9 +301,9 @@ consoleWin_t::~consoleWin_t(void)
//aviDiskThread->quit();
//aviDiskThread->wait( 10000 );
//fceuWrapperLock();
//FCEU_WRAPPER_LOCK();
//fceuWrapperClose();
//fceuWrapperUnLock();
//FCEU_WRAPPER_UNLOCK();
if ( viewport_GL != NULL )
{
@ -695,12 +695,12 @@ void consoleWin_t::showErrorMsgWindow()
{
QMessageBox msgBox(this);
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
msgBox.resize( this->size() );
msgBox.setIcon( QMessageBox::Critical );
msgBox.setText( tr(errorMsg.c_str()) );
errorMsg.clear();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
//msgBox.show();
msgBox.exec();
}
@ -757,9 +757,9 @@ void consoleWin_t::dropEvent(QDropEvent *event)
{
QList<QUrl> urls = event->mimeData()->urls();
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
LoadGame( urls[0].toString( QUrl::PreferLocalFile ).toStdString().c_str() );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
event->accept();
}
}
@ -2113,9 +2113,9 @@ void consoleWin_t::closeApp(void)
aviDiskThread->quit();
aviDiskThread->wait( 10000 );
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
fceuWrapperClose();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
// LoadGame() checks for an IP and if it finds one begins a network session
// 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() );
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
CloseGame ();
LoadGame ( filename.toStdString().c_str() );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
return;
}
@ -2311,17 +2311,17 @@ void consoleWin_t::openROMFile(void)
void consoleWin_t::loadRomRequestCB( QString s )
{
printf("Load ROM Req: '%s'\n", s.toStdString().c_str() );
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
CloseGame ();
LoadGame ( s.toStdString().c_str() );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::closeROMCB(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
CloseGame();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::loadNSF(void)
@ -2393,9 +2393,9 @@ void consoleWin_t::loadNSF(void)
g_config->setOption ("SDL.LastOpenNSF", filename.toStdString().c_str() );
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
LoadGame( filename.toStdString().c_str() );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::loadStateFrom(void)
@ -2477,9 +2477,9 @@ void consoleWin_t::loadStateFrom(void)
g_config->setOption ("SDL.LastLoadStateFrom", filename.toStdString().c_str() );
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_LoadState( filename.toStdString().c_str() );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::saveStateAs(void)
@ -2568,26 +2568,26 @@ void consoleWin_t::saveStateAs(void)
g_config->setOption ("SDL.LastSaveStateAs", filename.toStdString().c_str() );
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_SaveState( filename.toStdString().c_str() );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::quickLoad(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_LoadState( NULL );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::loadState(int slot)
{
int prevState;
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
prevState = FCEUI_SelectState( slot, false );
FCEUI_LoadState( NULL, true );
FCEUI_SelectState( prevState, false );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::loadState0(void){ loadState(0); }
void consoleWin_t::loadState1(void){ loadState(1); }
@ -2602,19 +2602,19 @@ void consoleWin_t::loadState9(void){ loadState(9); }
void consoleWin_t::quickSave(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_SaveState( NULL );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::saveState(int slot)
{
int prevState;
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
prevState = FCEUI_SelectState( slot, false );
FCEUI_SaveState( NULL, true );
FCEUI_SelectState( prevState, false );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::saveState0(void){ saveState(0); }
void consoleWin_t::saveState1(void){ saveState(1); }
@ -2629,9 +2629,9 @@ void consoleWin_t::saveState9(void){ saveState(9); }
void consoleWin_t::changeState(int slot)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_SelectState( slot, true );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
state[slot]->setChecked(true);
}
void consoleWin_t::changeState0(void){ changeState(0); }
@ -2647,16 +2647,16 @@ void consoleWin_t::changeState9(void){ changeState(9); }
void consoleWin_t::incrementState(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_SelectStateNext(1);
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::decrementState(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_SelectStateNext(-1);
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::mainMenuOpen(void)
@ -2697,9 +2697,9 @@ void consoleWin_t::prepareScreenShot(void)
//void consoleWin_t::takeScreenShot(void)
//{
// fceuWrapperLock();
// FCEU_WRAPPER_LOCK();
// FCEUI_SaveSnapshot();
// fceuWrapperUnLock();
// FCEU_WRAPPER_UNLOCK();
//}
void consoleWin_t::takeScreenShot(void)
@ -2719,7 +2719,7 @@ void consoleWin_t::takeScreenShot(void)
return;
}
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
if ( viewport_GL )
{
@ -2743,7 +2743,7 @@ void consoleWin_t::takeScreenShot(void)
image.save( tr( FCEU_MakeFName(FCEUMKF_SNAP,u,"png").c_str() ), "png" );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
FCEU_DispMessage("Screen snapshot %d saved.",0,u);
}
@ -2876,7 +2876,7 @@ void consoleWin_t::openAviRiffViewer(void)
void consoleWin_t::openTasEditor(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
if ( tasWindowIsOpen() )
{
@ -2892,7 +2892,7 @@ void consoleWin_t::openTasEditor(void)
connect(emulatorThread, SIGNAL(frameFinished(void)), win, SLOT(frameUpdate(void)) );
}
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::openMovieOptWin(void)
@ -3146,33 +3146,33 @@ void consoleWin_t::warnAmbiguousShortcut( QShortcut *shortcut)
void consoleWin_t::powerConsoleCB(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_PowerNES();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
return;
}
void consoleWin_t::consoleHardReset(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
fceuWrapperHardReset();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
return;
}
void consoleWin_t::consoleSoftReset(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
fceuWrapperSoftReset();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
return;
}
void consoleWin_t::consolePause(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
fceuWrapperTogglePause();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
mainMenuEmuPauseSet = false;
return;
@ -3189,9 +3189,9 @@ void consoleWin_t::setRegion(int region)
if ( currentRegion != region )
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_SetRegion (region, true);
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
return;
}
@ -3250,12 +3250,12 @@ void consoleWin_t::toggleGameGenie(bool checked)
{
int gg_enabled;
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
g_config->getOption ("SDL.GameGenie", &gg_enabled);
g_config->setOption ("SDL.GameGenie", !gg_enabled);
g_config->save ();
FCEUI_SetGameGenie (gg_enabled);
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
return;
}
@ -3326,25 +3326,25 @@ void consoleWin_t::loadGameGenieROM(void)
void consoleWin_t::insertCoin(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_VSUniCoin();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
return;
}
void consoleWin_t::fdsSwitchDisk(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEU_FDSSelect();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
return;
}
void consoleWin_t::fdsEjectDisk(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEU_FDSInsert();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
return;
}
@ -3588,55 +3588,55 @@ void consoleWin_t::setCustomAutoFire(void)
void consoleWin_t::incrSoundVolume(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUD_SoundVolumeAdjust( 1);
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::decrSoundVolume(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUD_SoundVolumeAdjust(-1);
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::toggleLagCounterDisplay(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
lagCounterDisplay = !lagCounterDisplay;
g_config->setOption("SDL.ShowLagCount", lagCounterDisplay);
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::toggleFrameAdvLagSkip(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
frameAdvanceLagSkip = !frameAdvanceLagSkip;
FCEUI_DispMessage ("Skipping lag in Frame Advance %sabled.", 0, frameAdvanceLagSkip ? "en" : "dis");
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::toggleMovieBindSaveState(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
bindSavestate = !bindSavestate;
g_config->setOption("SDL.MovieBindSavestate", bindSavestate);
FCEUI_DispMessage ("Savestate binding to movie %sabled.", 0, bindSavestate ? "en" : "dis");
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::toggleMovieFrameDisplay(void)
{
extern int frame_display;
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_MovieToggleFrameDisplay();
g_config->setOption("SDL.ShowFrameCount", frame_display );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::toggleMovieReadWrite(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
//FCEUI_SetMovieToggleReadOnly (!FCEUI_GetMovieToggleReadOnly ());
FCEUI_MovieToggleReadOnly();
@ -3644,33 +3644,33 @@ void consoleWin_t::toggleMovieReadWrite(void)
{
tasWin->updateRecordStatus();
}
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::toggleInputDisplay(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_ToggleInputDisplay();
g_config->setOption ("SDL.InputDisplay", input_display);
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::toggleBackground(void)
{
bool fgOn, bgOn;
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_GetRenderPlanes( fgOn, bgOn );
FCEUI_SetRenderPlanes( fgOn, !bgOn );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::toggleForeground(void)
{
bool fgOn, bgOn;
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_GetRenderPlanes( fgOn, bgOn );
FCEUI_SetRenderPlanes( !fgOn, bgOn );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::toggleTurboMode(void)
@ -3689,28 +3689,28 @@ void consoleWin_t::openMovie(void)
void consoleWin_t::playMovieFromBeginning(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_MoviePlayFromBeginning();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::stopMovie(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_StopMovie();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
return;
}
void consoleWin_t::recordMovie(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
if (fceuWrapperGameLoaded())
{
MovieRecordDialog_t dialog(this);
dialog.exec();
}
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
return;
}
@ -3718,12 +3718,12 @@ void consoleWin_t::aviRecordStart(void)
{
if ( !aviRecordRunning() )
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
if ( aviRecordOpenFile(NULL) == 0 )
{
aviDiskThread->start();
}
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
}
@ -3826,23 +3826,23 @@ void consoleWin_t::aviRecordAsStart(void)
g_config->setOption ("SDL.AviFilePath", lastPath);
}
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
if ( aviRecordOpenFile( filename.toStdString().c_str() ) == 0 )
{
aviDiskThread->start();
}
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::aviRecordStop(void)
{
if ( aviRecordRunning() )
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
aviDiskThread->requestInterruption();
aviDiskThread->quit();
aviDiskThread->wait(10000);
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
}
@ -3913,9 +3913,9 @@ void consoleWin_t::wavRecordStart(void)
{
return;
}
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_BeginWaveRecord( fileName );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
}
@ -4017,18 +4017,18 @@ void consoleWin_t::wavRecordAsStart(void)
g_config->setOption ("SDL.WavFilePath", lastPath);
}
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_BeginWaveRecord( filename.toStdString().c_str() );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
void consoleWin_t::wavRecordStop(void)
{
if ( FCEUI_WaveRecordRunning() )
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_EndWaveRecord();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
}
@ -4253,10 +4253,10 @@ void consoleWin_t::loadMostRecentROM(void)
{
return;
}
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
CloseGame ();
LoadGame ( (romList.back())->c_str() );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
int consoleWin_t::getPeriodicInterval(void)
@ -4350,10 +4350,10 @@ void consoleWin_t::updatePeriodic(void)
if ( recentRomMenuReset )
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
buildRecentRomMenu();
recentRomMenuReset = false;
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
if ( closeRequested )
@ -4639,10 +4639,10 @@ void consoleRecentRomAction::activateCB(void)
{
printf("Activate Recent ROM: %s \n", path.c_str() );
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
CloseGame ();
LoadGame ( path.c_str() );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//-----------------------------------------------------------------------------
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 );
}
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
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++;
}
}
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
parent->editor->findPattern( varray, upBtn->isChecked() );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------------------------------
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,
// we want to be sure that the emulator is not iterating the list
// when we change it.
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
winList.push_back(this);
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
populateBookmarkMenu();
@ -1462,7 +1462,7 @@ HexEditorDialog_t::~HexEditorDialog_t(void)
// Lock the emulation thread mutex to ensure
// that the emulator is not attempting to update memory values
// for window while we are destroying it or editing the window list.
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
for (it = winList.begin(); it != winList.end(); it++)
{
@ -1473,7 +1473,7 @@ HexEditorDialog_t::~HexEditorDialog_t(void)
break;
}
}
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------------------------------
void HexEditorDialog_t::setWindowTitle(void)
@ -1816,7 +1816,7 @@ void HexEditorDialog_t::updatePeriodic(void)
editor->checkMemActivity();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
else
{
@ -2282,7 +2282,7 @@ void QHexEdit::pasteFromClipboard(void)
const char *c;
unsigned char *buf;
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
//printf("Paste: '%s'\n", s.c_str() );
@ -2343,7 +2343,7 @@ void QHexEdit::pasteFromClipboard(void)
}
free(buf);
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------------------------------
void QHexEdit::loadHighlightToClipboard(void)
@ -2352,7 +2352,7 @@ void QHexEdit::loadHighlightToClipboard(void)
std::string s;
char c[8];
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
startAddr = (txtHlgtStartLine*16) + txtHlgtStartChar;
endAddr = (txtHlgtEndLine *16) + txtHlgtEndChar;
@ -2363,7 +2363,7 @@ void QHexEdit::loadHighlightToClipboard(void)
s.append(c);
}
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
loadClipboard( s.c_str() );
}
@ -2732,13 +2732,13 @@ void QHexEdit::keyPressEvent(QKeyEvent *event)
int offs = (cursorPosX-32);
int addr = 16*(lineOffset+cursorPosY) + offs;
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
if ( viewMode == QHexEdit::MODE_NES_ROM )
{
romEditList.applyPatch( addr, key );
}
writeMem( viewMode, addr, key );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
editAddr = -1;
editValue = 0;
@ -2767,13 +2767,13 @@ void QHexEdit::keyPressEvent(QKeyEvent *event)
{
nibbleValue = editValue | nibbleValue;
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
if ( viewMode == QHexEdit::MODE_NES_ROM )
{
romEditList.applyPatch( editAddr, nibbleValue );
}
writeMem( viewMode, editAddr, nibbleValue );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
editAddr = -1;
editValue = 0;
@ -3236,7 +3236,7 @@ void QHexEdit::frzRamSet(void)
return;
}
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_ListCheats( RamFreezeCB, this);
if ( (frzRamAddr >= 0) && (FrozenAddressCount < 256) )
@ -3244,7 +3244,7 @@ void QHexEdit::frzRamSet(void)
FCEUI_AddCheat("", frzRamAddr, GetMem(frzRamAddr), -1, 1);
}
updateCheatDialog();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------------------------------
void QHexEdit::frzRamUnset(void)
@ -3257,10 +3257,10 @@ void QHexEdit::frzRamUnset(void)
{
return;
}
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_ListCheats( RamFreezeCB, this);
updateCheatDialog();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------------------------------
void QHexEdit::frzRamUnsetAll(void)
@ -3273,10 +3273,10 @@ void QHexEdit::frzRamUnsetAll(void)
{
return;
}
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEU_DeleteAllCheats();
updateCheatDialog();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------------------------------
void QHexEdit::frzRamToggle(void)
@ -3289,7 +3289,7 @@ void QHexEdit::frzRamToggle(void)
{
return;
}
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_ListCheats( RamFreezeCB, this);
if ( (frzRamAddr >= 0) && (FrozenAddressCount < 256) )
@ -3297,7 +3297,7 @@ void QHexEdit::frzRamToggle(void)
FCEUI_AddCheat("", frzRamAddr, GetMem(frzRamAddr), -1, 1);
}
updateCheatDialog();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------------------------------
void QHexEdit::addDebugSym(void)

View File

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

View File

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

View File

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

View File

@ -264,26 +264,26 @@ void MsgLogViewDialog_t::closeWindow(void)
//----------------------------------------------------------------------------
void MsgLogViewDialog_t::clearLog(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
msgLog.clear();
txtView->clear();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------------------------------
void MsgLogViewDialog_t::updatePeriodic(void)
{
if (msgLog.getTotalLineCount() != totalLines)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
msgLog.loadTextViewer(txtView);
totalLines = msgLog.getTotalLineCount();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
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 );
}
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
FCEUI_SetUserPalette( pal, NUM_COLORS );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------------------------------
int nesPaletteView::loadFromFile( const char *filepath )
@ -1125,10 +1125,10 @@ void nesPalettePickerView::setSelBox( int val )
if ( val != selBox )
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
PalettePoke( palAddr, val );
FCEUD_UpdatePPUView( -1, 1 );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
this->update();
}
@ -1389,19 +1389,19 @@ void nesPalettePickerDialog::closeWindow(void)
//----------------------------------------------------------------------------
void nesPalettePickerDialog::resetButtonClicked(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
palView->setSelBox( palOrigVal );
PalettePoke( palAddr, palOrigVal );
FCEUD_UpdatePPUView( -1, 1 );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------------------------------
void nesPalettePickerDialog::cancelButtonClicked(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
PalettePoke( palAddr, palOrigVal );
FCEUD_UpdatePPUView( -1, 1 );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
//printf("Close Window\n");
done(0);
@ -1410,10 +1410,10 @@ void nesPalettePickerDialog::cancelButtonClicked(void)
//----------------------------------------------------------------------------
void nesPalettePickerDialog::okButtonClicked(void)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
PalettePoke( palAddr, palView->getSelBox() );
FCEUD_UpdatePPUView( -1, 1 );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
//printf("Close Window\n");
done(0);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -336,7 +336,7 @@ void TimingConfDialog_t::emuSchedNiceChange(int val)
{
return;
}
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
if (consoleWindow->emulatorThread->setNicePriority(-val))
{
char msg[1024];
@ -354,7 +354,7 @@ void TimingConfDialog_t::emuSchedNiceChange(int val)
consoleWindow->QueueErrorMsgWindow(msg);
updateSliderValues();
}
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
#endif
}
//----------------------------------------------------------------------------
@ -366,13 +366,13 @@ void TimingConfDialog_t::emuSchedPrioChange(int val)
}
#ifdef WIN32
printf("Setting EMU Thread to %i\n", val);
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
consoleWindow->emulatorThread->setPriority((QThread::Priority)val);
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
#else
int policy, prio;
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
consoleWindow->emulatorThread->getSchedParam(policy, prio);
if (consoleWindow->emulatorThread->setSchedParam(policy, val))
@ -392,7 +392,7 @@ void TimingConfDialog_t::emuSchedPrioChange(int val)
consoleWindow->QueueErrorMsgWindow(msg);
updateSliderValues();
}
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
#endif
}
//----------------------------------------------------------------------------
@ -405,7 +405,7 @@ void TimingConfDialog_t::emuSchedPolicyChange(int index)
{
return;
}
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
consoleWindow->emulatorThread->getSchedParam(policy, prio);
policy = emuSchedPolicyBox->itemData(index).toInt();
@ -430,7 +430,7 @@ void TimingConfDialog_t::emuSchedPolicyChange(int index)
updatePolicyBox();
updateSliderLimits();
updateSliderValues();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
#endif
}
//----------------------------------------------------------------------------
@ -441,7 +441,7 @@ void TimingConfDialog_t::guiSchedNiceChange(int val)
{
return;
}
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
if (consoleWindow->setNicePriority(-val))
{
char msg[1024];
@ -459,7 +459,7 @@ void TimingConfDialog_t::guiSchedNiceChange(int val)
consoleWindow->QueueErrorMsgWindow(msg);
updateSliderValues();
}
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
#endif
}
//----------------------------------------------------------------------------
@ -475,7 +475,7 @@ void TimingConfDialog_t::guiSchedPrioChange(int val)
{
return;
}
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
consoleWindow->getSchedParam(policy, prio);
if (consoleWindow->setSchedParam(policy, val))
@ -495,7 +495,7 @@ void TimingConfDialog_t::guiSchedPrioChange(int val)
consoleWindow->QueueErrorMsgWindow(msg);
updateSliderValues();
}
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
#endif
}
//----------------------------------------------------------------------------
@ -508,7 +508,7 @@ void TimingConfDialog_t::guiSchedPolicyChange(int index)
{
return;
}
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
consoleWindow->getSchedParam(policy, prio);
policy = guiSchedPolicyBox->itemData(index).toInt();
@ -533,7 +533,7 @@ void TimingConfDialog_t::guiSchedPolicyChange(int index)
updatePolicyBox();
updateSliderLimits();
updateSliderValues();
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
#endif
}
//----------------------------------------------------------------------------
@ -675,7 +675,7 @@ void TimingConfDialog_t::emuTimingMechChange(int index)
{
return;
}
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
mode = timingDevSelBox->itemData(index).toInt();
@ -685,7 +685,7 @@ void TimingConfDialog_t::emuTimingMechChange(int index)
g_config->setOption("SDL.EmuTimingMech", mode);
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------------------------------
void TimingConfDialog_t::updateTimingMech(void)
@ -703,39 +703,39 @@ void TimingConfDialog_t::updateTimingMech(void)
//----------------------------------------------------------------------------
void TimingConfDialog_t::overclockingToggled(bool on)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
if ( !newppu )
{
overclock_enabled = on;
g_config->setOption("SDL.OverClockEnable", overclock_enabled );
}
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
}
//----------------------------------------------------------------------------
void TimingConfDialog_t::postRenderChanged(int value)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
postrenderscanlines = value;
g_config->setOption("SDL.PostRenderScanlines", postrenderscanlines );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
//printf("Post Render %i\n", postrenderscanlines );
}
//----------------------------------------------------------------------------
void TimingConfDialog_t::vblankScanlinesChanged(int value)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
vblankscanlines = value;
g_config->setOption("SDL.VBlankScanlines", vblankscanlines );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
//printf("Vblank Scanlines %i\n", vblankscanlines );
}
//----------------------------------------------------------------------------
void TimingConfDialog_t::no7bitChanged(int value)
{
fceuWrapperLock();
FCEU_WRAPPER_LOCK();
skip_7bit_overclocking = (value != Qt::Unchecked);
g_config->setOption("SDL.Skip7bitOverClocking", skip_7bit_overclocking );
fceuWrapperUnLock();
FCEU_WRAPPER_UNLOCK();
//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 mutexLocks = 0;
static int mutexPending = 0;
static bool emulatorHasMutux = 0;
static bool emulatorHasMutex = 0;
unsigned int emulatorCycleCount = 0;
extern double g_fpsScale;
@ -1212,6 +1212,26 @@ static void DoFun(int frameskip, int periodic_saves)
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)
{
mutexPending++;
@ -1220,9 +1240,30 @@ void fceuWrapperLock(void)
consoleWindow->mutex->lock();
}
mutexPending--;
if ( mutexLocks > 0 )
{
printf("Recursive Lock:%i\n", 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 lockAcq = false;
@ -1254,6 +1295,7 @@ void fceuWrapperUnLock(void)
else
{
printf("Error: Mutex is Already UnLocked\n");
abort();
}
}
@ -1273,7 +1315,7 @@ int fceuWrapperUpdate( void )
msleep( 100 );
}
lock_acq = fceuWrapperTryLock();
lock_acq = fceuWrapperTryLock( __FILE__, __LINE__, __func__ );
if ( !lock_acq )
{
@ -1285,7 +1327,7 @@ int fceuWrapperUpdate( void )
return -1;
}
emulatorHasMutux = 1;
emulatorHasMutex = 1;
if ( GameInfo )
{
@ -1299,7 +1341,7 @@ int fceuWrapperUpdate( void )
}
fceuWrapperUnLock();
emulatorHasMutux = 0;
emulatorHasMutex = 0;
while ( SpeedThrottle() )
{
@ -1312,7 +1354,7 @@ int fceuWrapperUpdate( void )
{
fceuWrapperUnLock();
emulatorHasMutux = 0;
emulatorHasMutex = 0;
msleep( 100 );
}

View File

@ -35,7 +35,9 @@ int fceuWrapperMemoryCleanup( void );
int fceuWrapperClose( void );
int fceuWrapperUpdate( void );
void fceuWrapperLock(void);
void fceuWrapperLock(const char *filename, int line, const char *func);
bool fceuWrapperTryLock(int timeout = 1000);
bool fceuWrapperTryLock(const char *filename, int line, const char *func, int timeout = 1000);
bool fceuWrapperIsLocked(void);
void fceuWrapperUnLock(void);
int fceuWrapperSoftReset(void);
@ -47,10 +49,10 @@ void fceuWrapperRequestAppExit(void);
class fceuCriticalSection
{
public:
fceuCriticalSection(void)
fceuCriticalSection( const char *filename, int lineNum, const char *func )
{
//printf("Wrapper Lock\n");
fceuWrapperLock();
fceuWrapperLock( filename, lineNum, func );
}
~fceuCriticalSection(void)
@ -59,3 +61,15 @@ class fceuCriticalSection
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__)