]> Shamusworld >> Repos - apple2/commitdiff
Prevent aborting when the log file fills up; added CTRL key support.
authorShamus Hammons <jlhamm@acm.org>
Mon, 9 Sep 2013 12:59:51 +0000 (07:59 -0500)
committerShamus Hammons <jlhamm@acm.org>
Mon, 9 Sep 2013 12:59:51 +0000 (07:59 -0500)
apple2.cfg
src/apple2.cpp
src/log.cpp

index f843a17b7c5641d51a8cc52b1191f7ff9f0859bb..f67291817b150ef19aff1e96b435713b54e8e694 100755 (executable)
@@ -50,7 +50,7 @@ autoSaveState = 1
 #floppyImage1 = ./disks/MoebiusIIA.dsk
 #floppyImage2 = ./disks/MoebiusIIB.dsk
 # Yes
-floppyImage1 = ./disks/wind_walker_1.dsk
+#floppyImage1 = ./disks/wind_walker_1.dsk
 # Yes
 #floppyImage1 = ./disks/dino_eggs.dsk
 # ??? 1, yes; 2, no
@@ -64,12 +64,19 @@ floppyImage1 = ./disks/wind_walker_1.dsk
 #floppyImage2 = ./disks/u2player-jlh.dsk
 # Yes
 #floppyImage1 = ./disks/TheHeist.dsk
+# Yes
+#floppyImage1 = ./disks/ult31snd.dsk
+#floppyImage2 = ./disks/ult32snd.dsk
+# Yes (key repeat is too high)
+#floppyImage1 = ./disks/bandits.dsk
+# Yes
+#floppyImage1 = ./disks/SpareChange.dsk
+# Yes
+#floppyImage1 = ./disks/lode_runner.dsk
+# Yes
+floppyImage1 = ./disks/championship_lode_runner.dsk
 
 
-# OpenGL options: 1 - use OpenGL rendering, 0 - use old style rendering
-
-useOpenGL = 1
-
 # OpenGL filtering type: 1 - blurry, 0 - sharp
 
 glFilterType = 0
@@ -78,20 +85,6 @@ glFilterType = 0
 
 fullscreen = 0
 
-# Backend renderer (OpenGL dependent): 0 - regular, 1 - "TV" style
-
-#renderType = 0
-
-# NTSC/PAL options: 1 - NTSC, 0 - PAL
-
-hardwareTypeNTSC = 1
-
-# Framskip options: 0 - no skip, 1-N - draw every Nth frame
-# Note: Skipping frames may cause strange visual side effects--don't bother
-#       reporting these unless they occur with a frameskip value of 0!
-
-frameSkip = 0
-
 # Joystick options: 1 - use joystick, 0 - don't use
 
 useJoystick = 0
index 0e6518397fb40950e898f8afdca0a6ef94fe278b..1999e7651422af354dacbbe9495e87145f209549 100755 (executable)
@@ -908,8 +908,10 @@ int main(int /*argc*/, char * /*argv*/[])
 //Kill the DOS ROM in slot 6 for now...
 //not
        memcpy(rom + 0xC600, diskROM, 0x100);
+//     memcpy(rom + 0xC700, diskROM, 0x100);   // Slot 7???
 
        WriteLog("About to initialize video...\n");
+
        if (!InitVideo())
        {
                std::cout << "Aborting!" << std::endl;
@@ -1121,21 +1123,20 @@ static void FrameCallback(void)
                switch (event.type)
                {
                case SDL_TEXTINPUT:
-//                     if (event.key.keysym.unicode != 0)
-//                     {
 //Need to do some key translation here, and screen out non-apple keys as well...
+//(really, could do it all in SDL_KEYDOWN, would just have to get symbols &
+// everything else done separately. this is slightly easier. :-P)
 //                     if (event.key.keysym.sym == SDLK_TAB)   // Prelim key screening...
                        if (event.edit.text[0] == '\t') // Prelim key screening...
                                break;
 
-//                             lastKeyPressed = event.key.keysym.unicode;
                        lastKeyPressed = event.edit.text[0];
                        keyDown = true;
+
                        //kludge: should have a caps lock thingy here...
                        //or all uppercase for ][+...
                        if (lastKeyPressed >= 'a' && lastKeyPressed <='z')
                                lastKeyPressed &= 0xDF;         // Convert to upper case...
-//                     }
 
                        break;
                case SDL_KEYDOWN:
@@ -1155,6 +1156,16 @@ static void FrameCallback(void)
                        else if (event.key.keysym.sym == SDLK_RETURN)
                                lastKeyPressed = 0x0D, keyDown = true;
 
+                       // Fix CTRL+key combo...
+                       if (event.key.keysym.mod & KMOD_CTRL)
+                       {
+                               if (event.key.keysym.sym >= SDLK_a && event.key.keysym.sym <= SDLK_z)
+//                             {
+                                       lastKeyPressed = (event.key.keysym.sym - SDLK_a) + 1;
+//printf("Key combo pressed: CTRL+%c\n", lastKeyPressed + 0x40);
+//                             }
+                       }
+
                        // Use ALT+Q to exit, as well as the usual window decoration method
                        if (event.key.keysym.sym == SDLK_q && (event.key.keysym.mod & KMOD_ALT))
                                running = false;
index ebf253544983dfc1499f3a81a66abab48a3b9a01..e56a55727157c78628253035d4f1812972eab708 100755 (executable)
 #include <stdarg.h>
 #include <stdint.h>
 
-#define MAX_LOG_SIZE           10000000                                // Maximum size of log file (10 MB)
+// Maximum size of log file (10 MB ought to be enough for anybody)
+#define MAX_LOG_SIZE           10000000
 
 static FILE * log_stream = NULL;
 static uint32_t logSize = 0;
+static bool logDone = false;
+
 
 bool InitLog(const char * path)
 {
@@ -33,19 +36,21 @@ bool InitLog(const char * path)
        return true;
 }
 
+
 void LogDone(void)
 {
        if (log_stream)
                fclose(log_stream);
 }
 
+
 //
 // This logger is used mainly to ensure that text gets written to the log file
 // even if the program crashes. The performance hit is acceptable in this case!
 //
 void WriteLog(const char * text, ...)
 {
-       if (!log_stream)
+       if (!log_stream || logDone)
                return;
 
        va_list arg;
@@ -57,9 +62,10 @@ void WriteLog(const char * text, ...)
        {
                fflush(log_stream);
                fclose(log_stream);
-               exit(1);
-       }//*/
+               logDone = true;
+       }
 
        va_end(arg);
        fflush(log_stream);                                     // Make sure that text is written!
 }
+