Annotation of uae/amiga/source/uaectrl.c, revision 1.1

1.1     ! root        1: /***********************************************************
        !             2:  * UAE - The U*nix Amiga Emulator                          *
        !             3:  *                                                         *
        !             4:  * UAE-Ctrl -- Emulator Control from Inside Emulation      *
        !             5:  *  (c) 1996 Tauno Taipaleenmaki <[email protected]>  *
        !             6:  *                                                         *
        !             7:  * Version 0.1                                             *
        !             8:  *                                                         *
        !             9:  * Command line version, Should work with any KS version   *
        !            10:  *                                                         *
        !            11:  ***********************************************************/
        !            12: #include <proto/exec.h>
        !            13: #include <stdio.h>
        !            14: #include <stdlib.h>
        !            15: #include <ctype.h>
        !            16: #include <string.h>
        !            17: #include "uae-control.h"
        !            18: #include "uae_pragmas.h"
        !            19: 
        !            20: #define MAX_DRV_NAME          20
        !            21: 
        !            22:      struct Library              *UaeBase;
        !            23: 
        !            24: struct UAE_CONFIG      config;
        !            25: 
        !            26: void print_drive_status(void);
        !            27: void quit_program(int error, char *text);
        !            28: 
        !            29: /************************************
        !            30:  * Main program                     *
        !            31:  ************************************/
        !            32: int main()
        !            33: {
        !            34:        int                  quit = 0,i, correct,number;
        !            35:        char                 buf[257];
        !            36:        char                 *langs[]={
        !            37:              "US\0","DE\0","SE\0","FR\0","IT\0", 
        !            38:        };
        !            39: 
        !            40:        UaeBase = OpenLibrary("uae.library",0);
        !            41:        if (!UaeBase) {
        !            42:              UaeBase = OpenLibrary("uae.library",0);
        !            43:              if (!UaeBase) {
        !            44:                     quit_program(1, "Emulator not running or uae.library not installed.\n");
        !            45:                     return(1);
        !            46:              }
        !            47:        }
        !            48: /* Read UAE configuration */
        !            49:        i = GetUaeConfig( &config );
        !            50: 
        !            51:        while( quit == 0 ) {
        !            52:              printf(" UAE-Control v0.1\n\n");
        !            53:              printf(" 1) Reset\n");
        !            54:              printf(" 2) Debug\n");
        !            55:              printf(" 3) Exit Emulator\n");
        !            56:              printf(" 4) Change framerate     (Currently : %ld)\n", config.framerate);
        !            57:              printf(" 5) Toggle sound         (Currently : %s)\n", config.do_output_sound ? "ON" : "OFF");
        !            58:              printf(" 6) Toggle fake joystick (Currently : %s)\n", config.do_fake_joystick ? "ON" : "OFF");
        !            59:              printf(" 7) Change language      (Currently : %s)\n", langs[config.keyboard]);
        !            60:              printf(" 8) Eject a disk\n");
        !            61:              printf(" 9) Insert a disk\n");
        !            62:              printf("10) Exit UAE-Control\n\n");
        !            63:              correct = 0;
        !            64:              while( correct == 0 ) {
        !            65:                     printf(" Command : ");
        !            66:                     gets( buf );
        !            67:                     i = atoi( buf );
        !            68:                     if ((i > 0) && (i < 11))
        !            69:                       correct = 1;
        !            70:              }
        !            71:              switch( i ) {
        !            72:               case 1:
        !            73:                     printf("\n The reset function does not work correctly yet.\n");
        !            74:                     break;
        !            75:               case 2:
        !            76:                     DebugFunc();
        !            77:                     break;
        !            78:               case 3:
        !            79:                     ExitEmu();
        !            80:                     break;
        !            81:               case 4:
        !            82:                     printf(" Enter new framerate (1-20) :");
        !            83:                     gets( buf );
        !            84:                     number = atoi( buf );
        !            85:                     if ((number > 0) && (number < 21)) {
        !            86:                            SetFrameRate( number );
        !            87:                            GetUaeConfig( &config );
        !            88:                      } else {
        !            89:                            printf(" Illegal value, not changed.\n");
        !            90:                     }
        !            91:                     break;
        !            92:               case 5:
        !            93:                     if (config.do_output_sound)                            
        !            94:                       DisableSound();
        !            95:                     else
        !            96:                       EnableSound();
        !            97:                     GetUaeConfig( &config );
        !            98:                     break;
        !            99:               case 6:
        !           100:                     if (config.do_fake_joystick)
        !           101:                       DisableJoystick();
        !           102:                     else
        !           103:                       EnableJoystick();
        !           104:                     GetUaeConfig( &config );
        !           105:                     break;
        !           106:               case 7:
        !           107:                     printf(" 1 = US, 2 = DE, 3 = SE, 4 = FR, 5 = IT\n");
        !           108:                     printf(" What will it be : ");
        !           109:                     gets( buf );
        !           110:                     number = atoi( buf );
        !           111:                     if ((number >= 1) && (number <= 5)) {
        !           112:                            ChangeLanguage( number-1 );
        !           113:                            GetUaeConfig( &config );
        !           114:                     } else {
        !           115:                            printf(" Illegal value, not changed.\n");
        !           116:                     }
        !           117:                     break;
        !           118:               case 8:
        !           119:                     print_drive_status();
        !           120:                     printf(" Eject which drive (1-4): ");
        !           121:                     gets( buf );
        !           122:                     number = atoi( buf );
        !           123:                     if ((number >= 1) && (number <=4 )) {
        !           124:                            EjectDisk( number-1 );
        !           125:                            GetUaeConfig( &config );
        !           126:                     } else {
        !           127:                            printf(" Illegal drive, not changed.\n");
        !           128:                     }
        !           129:                     break;
        !           130:               case 9:
        !           131:                     print_drive_status();
        !           132:                     printf(" Enter disk to drive (1-4): ");
        !           133:                     gets( buf );
        !           134:                     number = atoi( buf ); 
        !           135:                     if ((number >= 1) && (number <= 4)) {
        !           136:                            printf("Name of diskfile :");
        !           137:                            gets( buf );
        !           138:                            InsertDisk( (UBYTE *)&buf, number - 1 );
        !           139:                            GetUaeConfig( &config );
        !           140:                     } else {
        !           141:                            printf(" Illegal drive, not changed.\n");
        !           142:                     }
        !           143:                     break;
        !           144:               case 10:
        !           145:                     quit = 1;
        !           146:                     break;
        !           147:              }
        !           148:        }
        !           149:        quit_program(0, "");
        !           150:        return(0);
        !           151: }
        !           152: 
        !           153: /******************************************
        !           154:  * Prints drive status                    *
        !           155:  ******************************************/
        !           156: void print_drive_status(void)
        !           157: {            
        !           158:        printf(" DF0 : %s\n", config.disk_in_df0 ? config.df0_name : "EMPTY");
        !           159:        printf(" DF1 : %s\n", config.disk_in_df1 ? config.df1_name : "EMPTY");
        !           160:        printf(" DF2 : %s\n", config.disk_in_df2 ? config.df2_name : "EMPTY");
        !           161:        printf(" DF3 : %s\n", config.disk_in_df3 ? config.df3_name : "EMPTY");
        !           162: }
        !           163:        
        !           164:        
        !           165:        
        !           166:              
        !           167: /******************************************
        !           168:  * Quits the program                      *
        !           169:  ******************************************/
        !           170: void quit_program(int error, char *text)
        !           171: {
        !           172:        if (error > 0) {
        !           173:              printf(" UAE-Control v0.1\n");
        !           174:              printf("  (c)1996 Tauno Taipaleenmaki\n\n");
        !           175:              printf(" ERROR: %s\n", text);
        !           176:        }
        !           177:        if (UaeBase)
        !           178:         CloseLibrary( UaeBase );
        !           179: }
        !           180: 
        !           181: 
        !           182: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.