]> Shamusworld >> Repos - apple2/commitdiff
Fixed stupid lockup bug on exit when emulation paused/off.
authorShamus Hammons <jlhamm@acm.org>
Tue, 1 Apr 2014 13:47:16 +0000 (08:47 -0500)
committerShamus Hammons <jlhamm@acm.org>
Tue, 1 Apr 2014 13:47:16 +0000 (08:47 -0500)
Makefile
src/apple2.cpp

index 8f36aecd52cb7cb4f615fc3dcbfc767d8795f3cf..7c672567869b051dd06134533124961cc01ccfef 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -198,7 +198,7 @@ obj/%.o: src/gui/%.cpp
 
 $(TARGET)$(EXESUFFIX): $(OBJS)
        @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)
 #      upx -9 vj$(EXESUFFIX)
 
index 9a659b2e7fdfeffc0ba3458ee30db8535a9103b6..eaa0ea5ae39678a27819fa6a0d27ed3f8cfc938d 100644 (file)
@@ -117,7 +117,7 @@ static SDL_Thread * cpuThread = NULL;
 static SDL_cond * cpuCond = NULL;
 static SDL_sem * mainSem = NULL;
 static bool cpuFinished = false;
-static bool cpuSleep = false;
+//static bool cpuSleep = false;
 
 // NB: Apple //e Manual sez 6502 is running @ 1,022,727 Hz
 
@@ -141,14 +141,14 @@ int CPUThreadFunc(void * data)
        do
        {
 // This is never set to true anywhere...
-               if (cpuSleep)
-                       SDL_CondWait(cpuCond, cpuMutex);
+//             if (cpuSleep)
+//                     SDL_CondWait(cpuCond, cpuMutex);
 
 // decrement mainSem...
 #ifdef THREAD_DEBUGGING
 WriteLog("CPU: SDL_SemWait(mainSem);\n");
 #endif
-SDL_SemWait(mainSem);
+               SDL_SemWait(mainSem);
 
 // There are exactly 800 slices of 21.333 cycles per frame, so it works out
 // evenly.
@@ -385,26 +385,29 @@ cpuFinished = true;
 //USE A CONDITIONAL!!! OF COURSE!!!!!!11!11!11!!!1!
 //Nope, use a semaphore...
 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
 
 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");
-SDL_WaitThread(cpuThread, NULL);
+       SDL_WaitThread(cpuThread, NULL);
 //nowok:SDL_WaitThread(CPUThreadFunc, NULL);
 WriteLog("Main: SDL_DestroyCond(cpuCond);\n");
-SDL_DestroyCond(cpuCond);
-
-SDL_DestroySemaphore(mainSem);
+       SDL_DestroyCond(cpuCond);
+       SDL_DestroySemaphore(mainSem);
 
        if (settings.autoStateSaving)
        {
                // Save state here...
                SaveApple2State(settings.autoStatePath);
        }
-floppyDrive.SaveImage(0);
-floppyDrive.SaveImage(1);
+
+       floppyDrive.SaveImage(0);
+       floppyDrive.SaveImage(1);
 
        SoundDone();
        VideoDone();