mirror of
https://github.com/robmcmullen/apple2.git
synced 2024-06-09 10:29:27 +00:00
Fixed stupid lockup bug on exit when emulation paused/off.
This commit is contained in:
parent
df2889bf95
commit
1e6f6a0ca5
2
Makefile
2
Makefile
|
@ -198,7 +198,7 @@ obj/%.o: src/gui/%.cpp
|
||||||
|
|
||||||
$(TARGET)$(EXESUFFIX): $(OBJS)
|
$(TARGET)$(EXESUFFIX): $(OBJS)
|
||||||
@echo -e "\033[01;33m***\033[00;32m Linking it all together...\033[00m"
|
@echo -e "\033[01;33m***\033[00;32m Linking it all together...\033[00m"
|
||||||
$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
|
@$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
|
||||||
# strip --strip-all vj$(EXESUFFIX)
|
# strip --strip-all vj$(EXESUFFIX)
|
||||||
# upx -9 vj$(EXESUFFIX)
|
# upx -9 vj$(EXESUFFIX)
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ static SDL_Thread * cpuThread = NULL;
|
||||||
static SDL_cond * cpuCond = NULL;
|
static SDL_cond * cpuCond = NULL;
|
||||||
static SDL_sem * mainSem = NULL;
|
static SDL_sem * mainSem = NULL;
|
||||||
static bool cpuFinished = false;
|
static bool cpuFinished = false;
|
||||||
static bool cpuSleep = false;
|
//static bool cpuSleep = false;
|
||||||
|
|
||||||
// NB: Apple //e Manual sez 6502 is running @ 1,022,727 Hz
|
// NB: Apple //e Manual sez 6502 is running @ 1,022,727 Hz
|
||||||
|
|
||||||
|
@ -141,14 +141,14 @@ int CPUThreadFunc(void * data)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// This is never set to true anywhere...
|
// This is never set to true anywhere...
|
||||||
if (cpuSleep)
|
// if (cpuSleep)
|
||||||
SDL_CondWait(cpuCond, cpuMutex);
|
// SDL_CondWait(cpuCond, cpuMutex);
|
||||||
|
|
||||||
// decrement mainSem...
|
// decrement mainSem...
|
||||||
#ifdef THREAD_DEBUGGING
|
#ifdef THREAD_DEBUGGING
|
||||||
WriteLog("CPU: SDL_SemWait(mainSem);\n");
|
WriteLog("CPU: SDL_SemWait(mainSem);\n");
|
||||||
#endif
|
#endif
|
||||||
SDL_SemWait(mainSem);
|
SDL_SemWait(mainSem);
|
||||||
|
|
||||||
// There are exactly 800 slices of 21.333 cycles per frame, so it works out
|
// There are exactly 800 slices of 21.333 cycles per frame, so it works out
|
||||||
// evenly.
|
// evenly.
|
||||||
|
@ -385,26 +385,29 @@ cpuFinished = true;
|
||||||
//USE A CONDITIONAL!!! OF COURSE!!!!!!11!11!11!!!1!
|
//USE A CONDITIONAL!!! OF COURSE!!!!!!11!11!11!!!1!
|
||||||
//Nope, use a semaphore...
|
//Nope, use a semaphore...
|
||||||
WriteLog("Main: SDL_SemWait(mainSem);\n");
|
WriteLog("Main: SDL_SemWait(mainSem);\n");
|
||||||
SDL_SemWait(mainSem);//should lock until CPU thread is waiting...
|
// Only do this if NOT in power off/emulation paused mode!
|
||||||
|
if (!pauseMode)
|
||||||
|
// Should lock until CPU thread is waiting...
|
||||||
|
SDL_SemWait(mainSem);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WriteLog("Main: SDL_CondSignal(cpuCond);//thread is probably asleep, wake it up\n");
|
WriteLog("Main: SDL_CondSignal(cpuCond);//thread is probably asleep, wake it up\n");
|
||||||
SDL_CondSignal(cpuCond);//thread is probably asleep, wake it up
|
SDL_CondSignal(cpuCond);//thread is probably asleep, wake it up
|
||||||
WriteLog("Main: SDL_WaitThread(cpuThread, NULL);\n");
|
WriteLog("Main: SDL_WaitThread(cpuThread, NULL);\n");
|
||||||
SDL_WaitThread(cpuThread, NULL);
|
SDL_WaitThread(cpuThread, NULL);
|
||||||
//nowok:SDL_WaitThread(CPUThreadFunc, NULL);
|
//nowok:SDL_WaitThread(CPUThreadFunc, NULL);
|
||||||
WriteLog("Main: SDL_DestroyCond(cpuCond);\n");
|
WriteLog("Main: SDL_DestroyCond(cpuCond);\n");
|
||||||
SDL_DestroyCond(cpuCond);
|
SDL_DestroyCond(cpuCond);
|
||||||
|
SDL_DestroySemaphore(mainSem);
|
||||||
SDL_DestroySemaphore(mainSem);
|
|
||||||
|
|
||||||
if (settings.autoStateSaving)
|
if (settings.autoStateSaving)
|
||||||
{
|
{
|
||||||
// Save state here...
|
// Save state here...
|
||||||
SaveApple2State(settings.autoStatePath);
|
SaveApple2State(settings.autoStatePath);
|
||||||
}
|
}
|
||||||
floppyDrive.SaveImage(0);
|
|
||||||
floppyDrive.SaveImage(1);
|
floppyDrive.SaveImage(0);
|
||||||
|
floppyDrive.SaveImage(1);
|
||||||
|
|
||||||
SoundDone();
|
SoundDone();
|
||||||
VideoDone();
|
VideoDone();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user