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

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

unix.superglobalmegacorp.com

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