1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802
|
namespace eval tas {
### periodic refresh stuff
variable callback_list ""
variable callback_frame_id
variable callback_realtime_id
# TODO move to utils?
# Register the given callback to be executed
# - (Once) when it is registered
# - Every MSX frame
# - Or at least 10 times per second (e.g. when MSX emulation is paused)
proc enable_periodic {callback} {
variable callback_list
variable callback_frame_id
variable callback_realtime_id
# on 1st callback activate the after-stuff
if {[llength $callback_list] == 0} {
set callback_frame_id [after frame [namespace code periodic_frame]]
set callback_realtime_id [after realtime 0.1 [namespace code periodic_realtime]]
}
# add to list of registered callbacks
lappend callback_list $callback
# execute callback for the first time
$callback
}
# Remove a previously registered callback. After this proc returns, the
# callback is guaranteed to not be called anymore. So it's (no longer)
# required to add a check in the callback proc.
proc disable_periodic {callback} {
variable callback_list
variable callback_frame_id
variable callback_realtime_id
# remove from registered callbacks
set idx [lsearch -exact $callback_list $callback]
if {$idx == -1} return
set callback_list [lreplace $callback_list $idx $idx]
# if the last callback was removed then deactivate after stuff
if {[llength $callback_list] == 0} {
after cancel $callback_frame_id
after cancel $callback_realtime_id
}
}
proc periodic_execute {} {
variable callback_list
foreach callback $callback_list {
$callback
}
}
proc periodic_frame {} {
variable callback_frame_id
variable callback_realtime_id
periodic_execute
# postpone 'after realtime' / reschedule 'after frame'
after cancel $callback_realtime_id
set callback_frame_id [after frame [namespace code periodic_frame]]
set callback_realtime_id [after realtime 0.1 [namespace code periodic_realtime]]
}
proc periodic_realtime {} {
variable callback_realtime_id
periodic_execute
# reschedule 'after realtime', no need to handle 'after frame'
set callback_realtime_id [after realtime 0.1 [namespace code periodic_realtime]]
}
### frame counter ###
set_help_text toggle_frame_counter\
{Toggles display of a frame counter in the lower right corner.}
proc toggle_frame_counter {} {
if {[osd exists framecount]} {
disable_periodic framecount_update
osd destroy framecount
return ""
}
osd create rectangle framecount \
-x 269 -y 227 -h 7 -w 42 -scaled true \
-rgba "0x0044aa80 0x2266dd80 0x0055cc80 0x44aaff80" \
-borderrgba 0x00000040 -bordersize 0.5
osd create text framecount.text -x 3 -y 1 -size 4 -rgba 0xffffffff
enable_periodic framecount_update
return ""
}
proc framecount_update {} {
# Heuristic: A 'ex (sp),ix' Z80 instruction takes 25 cycles. If we're
# not more than 25 Z80 cycles past the start of a frame, then indicate
# we're at the start of the frame. (But it could as well be the 2nd or
# 3rd (short) instruction in the frame.)
set inside [expr {([machine_info VDP_cycle_in_frame] < (6 * 25)) ? "" : "+"}]
osd configure framecount.text -text "Frame: [machine_info VDP_frame_count]$inside"
}
### frame advance/reverse and helper procs for TAS mode key bindings ###
proc get_start_of_frame_time {} {
expr {[machine_info time] - [machine_info VDP_cycle_in_frame] / (6.0 * 3579545)}
}
set_help_text prev_frame \
{Rewind to the (start of) the previous frame. Useful
to bind to a key in combination with next_frame. You can also
go back N frames if you add N as the optional argument.}
proc prev_frame {{count 1}} {
set t [expr {[get_start_of_frame_time] - $count * [vdp::get_frame_duration]}]
if {$t < 0} {set t 0}
reverse goto $t
}
set_help_text next_frame \
{Emulates until the (start of) the next frame, then pause emulation.
Useful to bind to a key and emulate frame by frame. You can also
go over the next N frames if you add N as the optional argument.}
proc next_frame {{count 1}} {
set t [expr {[get_start_of_frame_time] + $count * [vdp::get_frame_duration]}]
after time [expr {$t - [machine_info time]}] "set ::pause on"
set ::pause off
return ""
}
set_help_text start_of_frame \
{Rewind to the start of the current frame.
See also prev_frame and next_frame.}
proc start_of_frame {} {
prev_frame 0
}
set_help_text advance_frame \
{Emulate forward for the duration of one frame. The relative
timing position within the frame remains unchanged. You can also
advance N frames if you add N as the optional argument.}
proc advance_frame {{count 1}} {
after time [expr {$count * [vdp::get_frame_duration]}] "set ::pause on"
set ::pause off
return ""
}
set_help_text reverse_frame \
{Emulate backward for the duration of one frame. The relative
timing position within the frame remains unchanged. You can also
reverse N frames if you add N as the optional argument.}
proc reverse_frame {{count 1}} {
set t [expr {[machine_info time] - $count * [vdp::get_frame_duration]}]
if {$t < 0} {set t 0}
reverse goto $t
}
proc load_replay {name} {
reverse loadreplay -goto savetime $name
return ""
}
### Very basic replay slot selector ###
user_setting create string current_replay_slot "Name of the current replay slot." slot0
proc list_slots {} {
set slots [list]
for {set i 0} {$i <= 9} {incr i} {
lappend slots "slot$i"
}
return $slots
}
proc menu_create_slot_menu {} {
set items [list_slots]
set menu_def \
{ execute tas::set_slot
font-size 8
border-size 2
width 100
xpos 100
ypos 100
header { text "Select Replay Slot"
font-size 10
post-spacing 6 }}
return [osd_menu::prepare_menu_list $items 10 $menu_def]
}
proc set_slot {item} {
osd_menu::menu_close_all
set ::current_replay_slot $item
}
proc open_select_slot_menu {} {
osd_menu::do_menu_open [menu_create_slot_menu]
osd_menu::select_menu_item $::current_replay_slot
for {set i 0} {$i < [llength [tas::list_slots]]} {incr i} {
bind -layer slot_menu "$i" "tas::set_slot [lindex [tas::list_slots] $i]; tas::unbind_number_keys"
}
activate_input_layer slot_menu
}
proc unbind_number_keys {} {
deactivate_input_layer slot_menu
}
proc save_replay_slot {} {
reverse savereplay $::current_replay_slot
}
proc load_replay_slot {} {
load_replay $::current_replay_slot
}
### Show Cursor Keys / 'fire buttons and others' ###
variable keys
proc show_keys {} {
variable keys
# get joysticka values
set joy [debug read joystickports 0]
foreach key $keys {
show_key_press [dict get $key name] [eval [dict get $key check_expr]]
}
}
#move to other TCL script?
proc is_key_pressed {row bit} {
expr {!([debug read keymatrix $row] & (1 << $bit))}
}
proc show_key_press {key state} {
set keycol [expr {$state ? 0xff000080 : "0x0044aa80 0x2266dd80 0x0055cc80 0x44aaff80"}]
osd configure cursors.$key -rgba $keycol
}
proc create_key {name x y} {
osd create rectangle cursors.$name -x $x -y $y -w 16 -h 7 \
-rgba "0x0044aa80 0x2266dd80 0x0055cc80 0x44aaff80" \
-bordersize 0.5 -borderrgba 0x00000040
osd create text cursors.$name.text -x 2 -y 1 -text $name -size 4 -rgba 0xffffffff
}
# you can setup your own key definitions by loading a script which defines a proc like this:
#
# proc define_custom_keys {} {
# variable tas::keys
#
# set tas::keys {{
# name up
# x 20
# y 2
# check_expr {expr {([is_key_pressed 8 5] || !($joy & 1))}}
# } {
# name shift
# x 186
# y 8
# check_expr {is_key_pressed 6 0}
# }}
#}
#
proc toggle_cursors {} {
variable keys
if {[osd exists cursors]} {
disable_periodic show_keys
osd destroy cursors
} else {
osd create rectangle cursors -x 64 -y 219 -h 26 -w 204 -scaled true -rgba 0x00000000
if {[info procs ::define_custom_keys] eq "::define_custom_keys"} {
define_custom_keys
} else {
define_default_keys
}
foreach key $keys {
create_key [dict get $key name] [dict get $key x] [dict get $key y]
}
enable_periodic show_keys
}
}
proc define_default_keys {} {
variable keys
set keys {{
name up
x 20
y 2
check_expr {expr {([is_key_pressed 8 5] || !($joy & 1))}}
} {
name down
x 20
y 14
check_expr {expr {([is_key_pressed 8 6] || !($joy & 2))}}
} {
name left
x 2
y 8
check_expr {expr {([is_key_pressed 8 4] || !($joy & 4))}}
} {
name right
x 38
y 8
check_expr {expr {([is_key_pressed 8 7] || !($joy & 8))}}
} {
name space
x 60
y 8
check_expr {expr {([is_key_pressed 8 0] || !($joy & 16))}}
} {
name m
x 78
y 8
check_expr {expr {([is_key_pressed 4 2] || !($joy & 32))}}
} {
name n
x 96
y 8
check_expr {is_key_pressed 4 3}
} {
name z
x 114
y 8
check_expr {is_key_pressed 5 7}
} {
name x
x 132
y 8
check_expr {is_key_pressed 5 5}
} {
name graph
x 150
y 8
check_expr {is_key_pressed 6 2}
} {
name ctrl
x 168
y 8
check_expr {is_key_pressed 6 1}
} {
name shift
x 186
y 8
check_expr {is_key_pressed 6 0}
}}
}
### RAM Watch ###
# TODO:
# - be smarter with coordinates, by using negative ones
# - maybe put description on separate line to make window narrow again?
variable addr_watches [dict create] ;# dict of RAM watches
# TODO move to utils?
proc dict_insert_sorted {dictname key value} {
upvar $dictname d
set i 0
dict for {k v} $d {
if {$key <= $k} {
if {$key == $k} {
dict set d $key $value
return $d
}
break
}
incr i 2
}
set d [linsert $d $i $key $value]
}
proc ram_watch_add {addr_str args} {
variable addr_watches
set type_dict [dict create byte {peek 2} b {peek 2} \
u8 {peek 2} s8 {peek_s8 2} \
word {peek16 4} w {peek16 4} \
u16 {peek16 4} s16 {peek_s16 4} \
u16_LE {peek16 4} s16_LE {peek_s16 4} \
u16_BE {peek16_BE 4} s16_BE {peek_s16_BE 4}]
set format_dict [dict create dec "%d" hex "0x%0SX"]
# sanitize input
set addr [format 0x%04X $addr_str]
if {($addr < 0) || ($addr > 0xffff)} {
error "Address must be in range 0x0..0xffff, got: $addr_str"
}
set addr_already_watched [dict exists $addr_watches $addr]
# defaults
set desc "?"
set type "byte"
set format "hex"
if {$addr_already_watched} {
# start from the previously set values
set desc [dict get $addr_watches $addr -desc]
set type [dict get $addr_watches $addr -type]
set format [dict get $addr_watches $addr -format]
}
while {[llength $args] > 0} {
set option [lindex $args 0]
switch -- $option {
"-desc" {
set desc [lindex $args 1]
set args [lrange $args 2 end]
}
"-type" {
set type [lindex $args 1]
if {![dict exists $type_dict $type]} {
error "Unsupported type: $type. Choose from: [dict keys $type_dict]"
}
set args [lrange $args 2 end]
}
"-format" {
set format [lindex $args 1]
if {![dict exists $format_dict $format]} {
error "Unsupported format: $format. Choose from: [dict keys $format_dict]"
}
set args [lrange $args 2 end]
}
"default" {
error "Invalid option: $option."
}
}
}
lassign [dict get $type_dict $type] peek_method num_hex_digits
set fmtStr1 [dict get $format_dict $format]
set fmtStr2 [string map [list S $num_hex_digits] $fmtStr1]
set exprStr "set v \[$peek_method $addr\]; set r \"\[expr {(\$v < 0) ? \"-\" : \"\"}\]\[format $fmtStr2 \[expr {abs(\$v)}\]\]\"; set r"
# add watch to watches
set old_nof_watches [dict size $addr_watches]
dict_insert_sorted addr_watches $addr [dict create -desc $desc -format $format -type $type exprStr $exprStr]
# if OSD doesn't exist yet create it
if {$old_nof_watches == 0} {
ram_watch_init_widget
}
# (possibly) add one extra entry
if {!$addr_already_watched} {
ram_watch_add_to_widget $old_nof_watches
ram_watch_update_widget_size
}
ram_watch_update_addresses
if {$old_nof_watches == 0} {
enable_periodic ram_watch_update_values
}
return ""
}
proc ram_watch_init_widget {} {
osd create rectangle ram_watch \
-x 0 -y 0 -h 240 -w 320 -scaled true -rgba 0x00000000
osd create rectangle ram_watch.addr \
-x 257 -y 1 -w 62 -h 221 \
-rgba "0x0044aa80 0x2266dd80 0x0055cc80 0x44aaff80" \
-borderrgba 0x00000040 -bordersize 0.5
osd create text ram_watch.addr.title -text "RAM Watch" -x 2 -y 1 -size 4 -rgba 0xffffffff
}
proc ram_watch_update_widget_size {} {
variable addr_watches
set nr [dict size $addr_watches]
osd configure ram_watch.addr -h [expr {8 + ($nr * 6)}]
}
proc ram_watch_add_to_widget {nr} {
osd create rectangle ram_watch.addr.mem$nr \
-x 2 -y [expr {8 + ($nr * 6)}] -h 5 -w 16 -rgba 0x40404080
osd create text ram_watch.addr.mem$nr.text \
-size 4 -rgba 0xffffffff
osd create rectangle ram_watch.addr.val$nr \
-x 19 -y [expr {8 + ($nr * 6)}] -h 5 -w 17 -rgba 0x40404080
osd create text ram_watch.addr.val$nr.text \
-size 4 -rgba 0xffffffff
osd create rectangle ram_watch.addr.desc$nr \
-x 37 -y [expr {8 + ($nr * 6)}] -h 5 -w 23 -rgba 0x40404080 -clip true
osd create text ram_watch.addr.desc$nr.text \
-size 4 -rgba 0xffffffff
}
proc ram_watch_remove {addr_str} {
variable addr_watches
# sanitize input
set addr [format 0x%04X $addr_str]
# check watch exists
if {![dict exists $addr_watches $addr]} {
# not an error
return ""
}
#remove address
dict unset addr_watches $addr
set i [dict size $addr_watches]
#remove one OSD entry
osd destroy ram_watch.addr.mem$i
osd destroy ram_watch.addr.val$i
osd destroy ram_watch.addr.desc$i
#if all elements are gone don't display anything anymore.
if {$i == 0} {
disable_periodic ram_watch_update_values
osd destroy ram_watch
} else {
ram_watch_update_addresses
ram_watch_update_widget_size
}
return ""
}
proc ram_watch_clear {} {
variable addr_watches
set addr_watches [dict create]
disable_periodic ram_watch_update_values
osd destroy ram_watch
return ""
}
proc ram_watch_update_addresses {} {
variable addr_watches
set i 0
dict for {addr v} $addr_watches {
osd configure ram_watch.addr.mem$i.text -text $addr
osd configure ram_watch.addr.desc$i.text -text [dict get $v -desc]
incr i
}
}
proc ram_watch_update_values {} {
variable addr_watches
set i 0
dict for {addr v} $addr_watches {
set exprStr [dict get $v exprStr]
osd configure ram_watch.addr.val$i.text -text [eval $exprStr]
incr i
}
}
proc ram_watch_save {name} {
variable addr_watches
# exprStr property doesn't need to be saved
set filtered_watches [dict create]
dict for {addr v} $addr_watches {
dict set filtered_watches $addr [dict filter $v key -*]
}
set directory [file normalize $::env(OPENMSX_USER_DATA)/../ramwatches]
file mkdir $directory
set fullname [file join $directory ${name}.wch]
if {[catch {
set the_file [open $fullname {WRONLY TRUNC CREAT}]
puts $the_file $filtered_watches
close $the_file
} errorText]} {
error "Failed to save to $fullname: $errorText"
}
return "Successfully saved RAM watch to $fullname"
}
proc ram_watch_load {name} {
variable addr_watches
set directory [file normalize $::env(OPENMSX_USER_DATA)/../ramwatches]
set fullname [file join $directory ${name}.wch]
if {[catch {
set the_file [open $fullname {RDONLY}]
set new_addr_watches [read $the_file]
close $the_file
} errorText]} {
error "Failed to load from $fullname: $errorText"
}
ram_watch_clear
dict for {addr v} $new_addr_watches {
ram_watch_add $addr {*}$v
}
return "Successfully loaded $fullname"
}
proc list_ram_watch_files {} {
set directory [file normalize $::env(OPENMSX_USER_DATA)/../ramwatches]
set results [list]
foreach f [lsort [glob -tails -directory $directory -type f -nocomplain *.wch]] {
lappend results [file rootname $f]
}
return $results
}
proc ram_watch {subcmd args} {
switch -- $subcmd {
"add" {ram_watch_add {*}$args}
"remove" {ram_watch_remove {*}$args}
"clear" {ram_watch_clear {*}$args}
"load" {ram_watch_load {*}$args}
"save" {ram_watch_save {*}$args}
default {error "Invalid subcommand: $subcmd"}
}
}
set_help_proc ram_watch [namespace code ram_watch_help]
proc ram_watch_help {args} {
switch -- [lindex $args 1] {
"add" {return {Add an address to the list of RAM watch addresses on the right side of the screen. The list will be updated in real time, whenever a value changes.
Syntax: ram_watch add <address> [<options>...]
Possible options are:
-desc <description> describes the address
-type <type> datatype: byte, word, u8, s8, u16, s16, u16_BE, ...
-format <format> formatting: dec, hex
}}
"remove" {return {Remove an address from the list of RAM watch addresses from the list of RAM watch addresses on the right side of the screen. When the last address is removed, the list will disappear automatically.
Syntax: ram_watch remove <address>
}}
"clear" {return {Removes all RAM watches.
Syntax: ram_watch clear
}}
"save" {return {Save the current list of RAM watches to a file.
Syntax: ram_watch save <filename>
}}
"load" {return {Load a list of RAM watches from file.
Syntax: ram_watch load <filename>
}}
default {return {Control the RAM watch functionality.
Syntax: ram_watch <sub-command> [<arguments>]
Where sub-command is one of:
add Add (or modify) a new RAM watch address
remove Remove a previously added address
clear Shortcut to remove all addresses
save Save current list of RAM watches to a file
load Load a previously saved list of RAM watches
Use 'help ram_watch <sub-command>' to get more detailed help on a specific sub-command.
}}
}
}
set_tabcompletion_proc ram_watch [namespace code ram_watch_tabcompletion]
proc ram_watch_tabcompletion {args} {
if {[llength $args] == 2} {
return [list "add" "remove" "clear" "save" "load"]
}
switch -- [lindex $args 1] {
"add" {return [list -desc -type -format]}
"load" -
"save" {return [list_ram_watch_files]}
default {return [list]}
}
}
### Lag counter ###
variable lag_counter
variable lag_counter_wp
variable previous_frame_count 0
variable input_read_in_frame false
proc space_read {} {
variable input_read_in_frame
set input_read_in_frame true
}
proc toggle_lag_counter {} {
variable lag_counter
variable lag_counter_wp
if {[osd exists lag_counter]} {
osd destroy lag_counter
debug remove_watchpoint $lag_counter_wp
return ""
}
# we set it to -1, because the updater is always called at the start
# and there the incr is present, so it will always incr. We compensate
# for that by setting it to -1. See also on other places where we
# force a call to the updater.
set lag_counter -1
set lag_counter_wp [debug set_watchpoint read_io 0xa9 {[expr [debug read ioports 0xaa] & 0x0f] == 0x08} {tas::space_read}]
osd create rectangle lag_counter \
-x 269 -y 220 -h 7 -w 42 -scaled true \
-borderrgba 0x00000040 -bordersize 0.5
osd create text lag_counter.text -x 3 -y 1 -size 4 -rgba 0xffffffff
update_lag_counter ;# can't use enable_periodic
return ""
}
proc update_lag_counter {} {
update_lag_counter2
after frame [namespace code update_lag_counter]
}
proc update_lag_counter2 {} {
variable lag_counter
variable previous_frame_count
variable input_read_in_frame
if {![osd exists lag_counter]} return
set new_frame_count [machine_info VDP_frame_count]
if {$new_frame_count == 1} {
# reset lag counter if frame counter is reset (e.g. after reset, or loading replay)
set lag_counter -1
}
# GFX9000 also triggers frame ends, so we should check if we
# actually advanced a V99x8 frame here
# Also, we check whether it was reset to force updating the display
if { $previous_frame_count != $new_frame_count || $lag_counter == -1} {
set previous_frame_count $new_frame_count
set col [expr {!$input_read_in_frame ? 0xff000080 : "0x0044aa80 0x2266dd80 0x0055cc80 0x44aaff80"}]
osd configure lag_counter -rgba $col
if {!$input_read_in_frame} {
incr lag_counter
osd configure lag_counter.text -text "Lag fr.: $lag_counter"
} else {
set input_read_in_frame false
}
}
}
proc reset_lag_counter {} {
variable lag_counter
set lag_counter -1
update_lag_counter2
return ""
}
### movie length display ###
set_help_text toggle_movie_length_display\
{Toggles display of the movie length in the upper right corner.}
proc toggle_movie_length_display {} {
if {[osd exists movielength]} {
disable_periodic movielength_update
osd destroy movielength
return ""
}
osd create rectangle movielength \
-x 269 -y 234 -h 7 -w 42 -scaled true \
-rgba "0x0044aa80 0x2266dd80 0x0055cc80 0x44aaff80" \
-borderrgba 0x00000040 -bordersize 0.5
osd create text movielength.text -x 3 -y 1 -size 4 -rgba 0xffffffff
enable_periodic movielength_update
return ""
}
proc movielength_update {} {
osd configure movielength.text -text "Length: [utils::format_time_subseconds [dict get [reverse status] last_event]]"
}
namespace export toggle_frame_counter
namespace export prev_frame
namespace export next_frame
namespace export start_of_frame
namespace export advance_frame
namespace export reverse_frame
namespace export toggle_cursors
namespace export ram_watch
namespace export toggle_lag_counter
namespace export reset_lag_counter
namespace export toggle_movie_length_display
}
namespace import tas::*
|