Annotation of uae/src/od-amiga/UAEGUI.rexx, revision 1.1

1.1     ! root        1: /* UAEGUI.rexx - A nice GUI for uae using MUIREXX
        !             2:  *
        !             3:  * How to use it: Open a shell a type "run rx UAEGUI.rexx".
        !             4:  * Then, run UAE. Once uae's window is opened, the GUI will
        !             5:  * popup.
        !             6:  *
        !             7:  * $VER: UAEGUI.rexx 0.3 (29.01.98) � by Samuel Devulder
        !             8:  *
        !             9:  * History: 
        !            10:  *   v0.1: first try
        !            11:  *   v0.2: adaptation to MUIRexx3.0 (too bad, scripts for MUIRexx2.0 are
        !            12:  *         not fully compatible with MUIRexx3.0)
        !            13:  *   v0.3: added speed gauges
        !            14:  */
        !            15: 
        !            16: TRUE = 1
        !            17: FALSE = 0
        !            18: MUIA_Application_Title = 0x804281b8
        !            19: MUIA_Application_Version = 0x8042b33f
        !            20: MUIA_Application_Copyright = 0x8042ef4d
        !            21: MUIA_Application_Author = 0x80424842
        !            22: MUIA_Application_Base = 0x8042e07a
        !            23: MUIA_Application_OpenConfigWindow = 0x804299ba
        !            24: MUIA_Application_AboutMUI = 0x8042d21d
        !            25: MUIA_Background    = 0x8042545b
        !            26: MUII_BACKGROUND    = 128
        !            27: MUII_SHADOWFILL    = 133
        !            28: MUIA_Image_FreeHoriz = 0x8042da84
        !            29: MUIA_Image_FontMatchWidth = 0x804239bf
        !            30: MUIA_Image_FontMatchHeight = 0x804239c0
        !            31: MUIA_Width         = 0x8042b59c
        !            32: MUIA_Image_FontMatch = 0x8042815d
        !            33: MUIA_Image_FontMatchHeight = 0x80429f26
        !            34: MUIA_FixWidthTxt   = 0x8042d044
        !            35: MUIA_Weight        = 0x80421d1f
        !            36: MUIA_Pressed       = 0x80423535
        !            37: MUIA_ShowMe        = 0x80429ba8
        !            38: MUIA_Slider_Horiz  = 0x8042fad1
        !            39: MUIA_Slider_Min    = 0x8042e404
        !            40: MUIA_Slider_Max    = 0x8042d78a
        !            41: MUIA_Slider_Level  = 0x8042ae3a
        !            42: MUIA_Frame         = 0x8042ac64
        !            43: MUIA_Gauge_Current = 0x8042f0dd
        !            44: MUIA_Gauge_Horiz   = 0x804232dd
        !            45: MUIA_Gauge_Max     = 0x8042bcdb
        !            46: MUIA_Gauge_Divide  = 0x8042d8df
        !            47: MUIV_Frame_Text    = 3
        !            48: MUIV_Frame_Group   = 9
        !            49: 
        !            50: Cycle_Active      = 0x80421788
        !            51: Menuitem_Shortcut = 0x80422030
        !            52: Menuitem_Title    = 0x804218be
        !            53: Selected          = 0x8042654b
        !            54: Disabled          = 0x80423661
        !            55: 
        !            56: options results
        !            57: 
        !            58: ADDRESS COMMAND
        !            59: 
        !            60: BLK = "\033I[2:00000000:00000000:00000000]"
        !            61: RED = "\033I[2:ffffffff:00000000:00000000]"
        !            62: GRN = "\033I[2:00000000:ffffffff:6f000000]"
        !            63: 
        !            64: BLK = BLK||BLK||BLK||BLK
        !            65: RED = RED||RED||RED||RED
        !            66: GRN = GRN||GRN||GRN||GRN
        !            67: 
        !            68: /* Setup STDERR */
        !            69: DO_STDERR = 0;
        !            70: IF OPEN(STDERR,"CON:////UAEGUI.rexx -- Error messages window/WAIT/AUTO","w") then DO_STDERR = 1
        !            71: 
        !            72: /* Run MUIREXX */
        !            73: address command 'resident c:wait'
        !            74: if ~show('p','UAEGUI') then do
        !            75:    'run >nil: muirexx port UAEGUI'
        !            76:    cpt=0
        !            77:    do while ~show('p','UAEGUI')
        !            78:       'wait 1'
        !            79:       cpt=cpt+1
        !            80:       if cpt=60 then do
        !            81:         if DO_STDERR then do
        !            82:          call writeln(STDERR,"Timeout while waiting MUIRexx to start.")
        !            83:         end
        !            84:         call quit
        !            85:       END
        !            86:    end
        !            87: end
        !            88: 
        !            89: /* wait for UAE to setup */
        !            90: if ~show('p','UAE') then do
        !            91: /*   address command "run <>con: uae" */
        !            92:    cpt=0
        !            93:    do while ~show('p','UAE')
        !            94:       'wait 2'
        !            95:       cpt=cpt+1
        !            96:       if cpt=60 then do
        !            97:         if DO_STDERR then do
        !            98:          call writeln(STDERR,"Timeout while waiting UAE to start.")
        !            99:        end
        !           100:         address UAEGUI quit
        !           101:         call quit
        !           102:       end
        !           103:    end 
        !           104: end
        !           105: 
        !           106: address UAEGUI
        !           107: 
        !           108: window ID MAIN COMMAND """QUIT""" PORT UAEGUI TITLE """UAE Gui"""
        !           109: 
        !           110:  menu LABEL "Project"
        !           111:   item COMMAND '"method 'MUIA_Application_AboutMUI' 0"',
        !           112:    PORT UAEGUI LABEL "About MUI"
        !           113:   menu LABEL "Settings"
        !           114:    item COMMAND '"method 'MUIA_Application_OpenConfigWindow'"',
        !           115:     PORT UAEGUI LABEL "MUI..."
        !           116:   endmenu
        !           117:   item ATTRS Menuitem_Title '-1'
        !           118:   item COMMAND '"quit"' PORT UAEGUI ATTRS Menuitem_Shortcut 'Q' LABEL "Quit"
        !           119:  endmenu
        !           120: 
        !           121:  address UAE VERSION NUM;    NUM     = RESULT
        !           122:  address UAE VERSION AUTHOR; AUTHOR  = RESULT
        !           123:  address UAE VERSION PORT;   PORTAUT = RESULT
        !           124: 
        !           125:  text ATTRS MUIA_Frame MUIV_Frame_Group MUIA_Background MUII_SHADOWFILL LABEL,
        !           126:    "\0338\033c\033bUAE v"||NUM%10000||"."||(NUM%100)//100||"."||NUM//100||,
        !           127:    "\033n - Un*x Amiga Emulator\n"||AUTHOR||"\n\n"||PORTAUT 
        !           128: 
        !           129:  group HORIZ
        !           130:   group FRAME HORIZ LABEL "Actions"
        !           131:    button PRESS HELP """This button makes UAE and the GUI exit""",
        !           132:     COMMAND """QUIT""" PORT UAE LABEL "Quit"
        !           133:    button PRESS HELP """This button makes UAE do a hard reset""",
        !           134:     COMMAND """RESET""" PORT UAE LABEL "Reset"
        !           135:    button PRESS HELP """This button makes UAE enter in debug mode""",
        !           136:     COMMAND """Debug""" PORT UAE LABEL "Debug"
        !           137:   endgroup
        !           138:   group FRAME HORIZ LABEL "Speed"
        !           139:    LABEL "fps:"
        !           140:    text ID FPS  ATTRS 0x8042a3f1 4 LABEL "0.00"
        !           141:    gauge ID SPD,
        !           142:     HELP """You can read here the approximated speed of\n"||,
        !           143:            "UAE relative to a real Amiga (50fps).""",
        !           144:     ATTRS MUIA_Gauge_Horiz TRUE MUIA_Gauge_Max 100 LABEL "%ld%%"
        !           145:   endgroup
        !           146:  endgroup
        !           147: 
        !           148:  group  FRAME LABEL "Parameters"
        !           149:   group HORIZ
        !           150:    label "Display:"
        !           151:    address UAE QUERY DISPLAY
        !           152:    cycle ID DRAW,
        !           153:     HELP """This cycle button enables or disables the display output""",
        !           154:     COMMAND """DISPLAY %s""" PORT UAE ATTRS Cycle_Active RESULT labels "OFF,ON"
        !           155:    label "Sound:"
        !           156:    address UAE QUERY SOUND
        !           157:    IF RESULT = -1 THEN
        !           158:         cycle id sound ATTRS Disabled TRUE COMMAND """SOUND %s""",
        !           159:          PORT UAE LABELS "OFF,ON,BEST"
        !           160:    ELSE IF RESULT = 0 THEN
        !           161:         cycle id sound ATTRS Cycle_Active 0,
        !           162:          HELP """This cycle button enables or disables the sound output""",
        !           163:          COMMAND """SOUND %s""" PORT UAE LABELS "OFF,ON,BEST"
        !           164:    ELSE cycle id sound,
        !           165:          HELP """This cycle button enables or disables the sound output""",
        !           166:          ATTRS Cycle_Active RESULT-1 COMMAND """SOUND %s""",
        !           167:          PORT UAE LABELS "OFF,ON,BEST"
        !           168:    label "Joystick:"
        !           169:    address UAE QUERY FAKEJOYSTICK
        !           170:    cycle ID JOY,
        !           171:     HELP """This cycle button enables or disables the joystick emulation""",
        !           172:     COMMAND """FAKEJOYSTICK %s""" PORT UAE ATTRS Cycle_Active RESULT,
        !           173:     LABELS "OFF,ON"
        !           174:   endgroup
        !           175:   group HORIZ
        !           176:    label "POW:"
        !           177:    address UAE QUERY LED_POW;if RESULT = 1 then COL = RED; else COL = BLK
        !           178:    button ID POW HELP """This image represents the power-led state""",
        !           179:     ATTRS MUIA_FixWidthTxt 1 label COL
        !           180:    label "Frame Rate:"
        !           181:    address UAE QUERY FRAMERATE
        !           182:    slider ID SLDR HELP """Use this slider gadget to select the frame rate""",
        !           183:     COMMAND """FRAMERATE %s""" PORT UAE ATTRS MUIA_Slider_Horiz TRUE,
        !           184:     MUIA_Slider_Min 1 MUIA_Slider_Max 20 MUIA_Weight 230,
        !           185:     MUIA_SLIDER_LEVEL RESULT
        !           186:   endgroup
        !           187:  endgroup
        !           188: 
        !           189:  group FRAME LABEL "Disk files"
        !           190:   call SetDfx(0)
        !           191:   call SetDfx(1)
        !           192:   call SetDfx(2)
        !           193:   call SetDfx(3)
        !           194:  endgroup
        !           195: endwindow
        !           196: 
        !           197: address UAE QUERY NAME_DF0;R0=RESULT
        !           198: address UAE QUERY NAME_DF1;R1=RESULT
        !           199: address UAE QUERY NAME_DF2;R2=RESULT
        !           200: address UAE QUERY NAME_DF3;R3=RESULT
        !           201: popasl ID NDF0 CONTENT R0
        !           202: popasl ID NDF1 CONTENT R1
        !           203: popasl ID NDF2 CONTENT R2
        !           204: popasl ID NDF3 CONTENT R3
        !           205: 
        !           206: address UAE feedback LED_POW PORT UAEGUI,
        !           207:  CMD_ON  """button ID POW LABEL "RED"""",
        !           208:  CMD_OFF """button ID POW LABEL "BLK""""
        !           209: 
        !           210: address UAE feedback LED_DF0 PORT UAEGUI,
        !           211:  CMD_ON  """button ID DF0 LABEL "GRN"""",
        !           212:  CMD_OFF """button ID DF0 LABEL "BLK""""
        !           213: 
        !           214: address UAE feedback LED_DF1 PORT UAEGUI,
        !           215:  CMD_ON  """button ID DF1 LABEL "GRN"""",
        !           216:  CMD_OFF """button ID DF1 LABEL "BLK""""
        !           217: 
        !           218: address UAE feedback LED_DF2 PORT UAEGUI,
        !           219:  CMD_ON  """button ID DF2 LABEL "GRN"""",
        !           220:  CMD_OFF """button ID DF2 LABEL "BLK""""
        !           221: 
        !           222: address UAE feedback LED_DF3 PORT UAEGUI,
        !           223:  CMD_ON  """button ID DF3 LABEL "GRN"""",
        !           224:  CMD_OFF """button ID DF3 LABEL "BLK""""
        !           225: 
        !           226: address UAE feedback NAME_DF0 PORT UAEGUI,
        !           227:  CMD """popasl ID NDF0 CONTENT %s"""
        !           228: 
        !           229: address UAE feedback NAME_DF1 PORT UAEGUI,
        !           230:  CMD """popasl ID NDF1 CONTENT %s"""
        !           231: 
        !           232: address UAE feedback NAME_DF2 PORT UAEGUI,
        !           233:  CMD """popasl ID NDF2 CONTENT %s"""
        !           234: 
        !           235: address UAE feedback NAME_DF3 PORT UAEGUI,
        !           236:  CMD """popasl ID NDF3 CONTENT %s"""
        !           237: 
        !           238: address UAE feedback ON_EXIT PORT UAEGUI,
        !           239:  CMD """quit"""
        !           240: 
        !           241: address UAE QUERY LED_POW;if RESULT = 1 then COL = RED; else COL = BLK
        !           242: button ID POW label COL
        !           243: 
        !           244: address UAE QUERY FRAMENUM;FN = RESULT; TN = time('r');
        !           245: 
        !           246: /* in case UAEGUI exits */
        !           247: signal on syntax
        !           248: signal on error
        !           249: ok = 1
        !           250: gauge ID SPD ATTRS MUIA_Gauge_Horiz TRUE MUIA_Gauge_Max 100
        !           251: do while ok
        !           252:   address command wait 5
        !           253:   address UAE QUERY FRAMENUM;FN0=FN;FN=RESULT;TN = time('r');
        !           254:   if TN~=0 then TN = (FN-FN0)/TN
        !           255:   if show('p','UAEGUI') then do
        !           256:     text  id FPS label trunc(100*TN)/100
        !           257:     gauge ID SPD ATTRS MUIA_Gauge_Current trunc(TN*2)
        !           258:   end; else ok = 0
        !           259: end
        !           260: 
        !           261: error:
        !           262: syntax:
        !           263: 
        !           264: quit:
        !           265: 
        !           266: if show('p','UAE') then do
        !           267:   address UAE feedback LED_POW PORT COMMAND CMD_ON  """"""
        !           268:   address UAE feedback LED_DF0 PORT COMMAND CMD_ON  """"""
        !           269:   address UAE feedback LED_DF1 PORT COMMAND CMD_ON  """"""
        !           270:   address UAE feedback LED_DF2 PORT COMMAND CMD_ON  """"""
        !           271:   address UAE feedback LED_DF3 PORT COMMAND CMD_ON  """"""
        !           272:   address UAE feedback LED_POW PORT COMMAND CMD_OFF """"""
        !           273:   address UAE feedback LED_DF0 PORT COMMAND CMD_OFF """"""
        !           274:   address UAE feedback LED_DF1 PORT COMMAND CMD_OFF """"""
        !           275:   address UAE feedback LED_DF2 PORT COMMAND CMD_OFF """"""
        !           276:   address UAE feedback LED_DF3 PORT COMMAND CMD_OFF """"""
        !           277: end
        !           278: 
        !           279: if DO_STDERR then call close(STDERR);
        !           280: 
        !           281: exit 0
        !           282: 
        !           283: SetDFx: 
        !           284:    PARSE ARG unit
        !           285:    group ID GDF||unit HORIZ
        !           286:     label LEFT DOUBLE "DF"||unit||":"
        !           287:     address UAE QUERY LED_DF||unit;if RESULT=1 then COL=GRN; else COL=BLK
        !           288:     button ID DF||unit,
        !           289:      HELP """This image represents the state of drive "||unit||"'s led""",
        !           290:      ATTRS MUIA_FixWidthTxt 1 label COL
        !           291:     button PRESS,
        !           292:      HELP """Use this button to eject the diskfile in drive DF"||unit||":""",
        !           293:      COMMAND """EJECT "||unit||"""" PORT UAE ATTRS MUIA_Weight 100,
        !           294:      LABEL "Eject"
        !           295:     popasl ID NDF||unit,
        !           296:      HELP """Select the name of diskfile for drive DF"||unit||":""",
        !           297:      COMMAND """INSERT "||unit||" '%s'""" PORT UAE ATTRS MUIA_Weight 300
        !           298:    endgroup ID GDF||unit
        !           299: return

unix.superglobalmegacorp.com

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