~ubuntu-branches/ubuntu/karmic/e-uae/karmic

« back to all changes in this revision

Viewing changes to amiga/source/uaectrl.c

  • Committer: Bazaar Package Importer
  • Author(s): Stephan Suerken
  • Date: 2008-07-05 14:02:02 UTC
  • Revision ID: james.westby@ubuntu.com-20080705140202-u5aagnhtg31pmjc3
Tags: upstream-0.8.29-WIP4
ImportĀ upstreamĀ versionĀ 0.8.29-WIP4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***********************************************************
 
2
 * UAE - The U*nix Amiga Emulator                          *
 
3
 *                                                         *
 
4
 * UAE-Ctrl -- Emulator Control from Inside Emulation      *
 
5
 *  (c) 1996 Tauno Taipaleenmaki <tataipal@raita.oulu.fi>  *
 
6
 *                                                         *
 
7
 * Version 0.1                                             *
 
8
 *                                                         *
 
9
 * Command line version, Should work with any KS version   *
 
10
 *                                                         *
 
11
 ***********************************************************/
 
12
#include <clib/exec_protos.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 UAE_CONFIG      config;
 
23
 
 
24
void print_drive_status(void);
 
25
void quit_program(int error, char *text);
 
26
 
 
27
/************************************
 
28
 * Main program                     *
 
29
 ************************************/
 
30
int main()
 
31
{
 
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",
 
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:
 
63
                     HardReset();
 
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 );
 
75
                     if (SetFrameRate (number))
 
76
                            GetUaeConfig(&config);
 
77
                     else
 
78
                            printf(" Illegal value, not changed.\n");
 
79
                     break;
 
80
               case 5:
 
81
                     if (config.do_output_sound)
 
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 );
 
122
                     number = atoi( buf );
 
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
/******************************************
 
142
 * Prints drive status                    *
 
143
 ******************************************/
 
144
void print_drive_status(void)
 
145
{
 
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
}
 
151
 
 
152
 
 
153
 
 
154
/******************************************
 
155
 * Quits the program                      *
 
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
}