mirror of
https://github.com/JetSetIlly/Gopher2600.git
synced 2025-04-02 11:02:17 -04:00
o television
- setVisibility() now takes showOverscan argument
This commit is contained in:
parent
b39ff8ce60
commit
0da75cc3ef
6 changed files with 30 additions and 19 deletions
|
@ -122,7 +122,7 @@ var commandTemplate = input.CommandTemplate{
|
|||
KeywordMissile: "",
|
||||
KeywordBall: "",
|
||||
KeywordPlayfield: "",
|
||||
KeywordDisplay: "[|OFF]",
|
||||
KeywordDisplay: "[|OFF|OVERSCAN]",
|
||||
KeywordMouse: "[|X|Y]",
|
||||
KeywordScript: "%F",
|
||||
KeywordDisassemble: "",
|
||||
|
@ -560,17 +560,20 @@ func (dbg *Debugger) parseCommand(userInput string) (bool, error) {
|
|||
|
||||
case KeywordDisplay:
|
||||
visibility := true
|
||||
showOverscan := false
|
||||
action, present := tokens.Get()
|
||||
if present {
|
||||
action = strings.ToUpper(action)
|
||||
switch action {
|
||||
case "OFF":
|
||||
visibility = false
|
||||
case "OVERSCAN":
|
||||
showOverscan = true
|
||||
default:
|
||||
return false, fmt.Errorf("unknown display action (%s)", action)
|
||||
}
|
||||
}
|
||||
err := dbg.vcs.TV.SetVisibility(visibility)
|
||||
err := dbg.vcs.TV.SetVisibility(visibility, showOverscan)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ func fps(cartridgeFile string, justTheVCS bool) error {
|
|||
return fmt.Errorf("error preparing television: %s", err)
|
||||
}
|
||||
}
|
||||
tv.SetVisibility(true)
|
||||
tv.SetVisibility(true, false)
|
||||
|
||||
vcs, err := hardware.NewVCS(tv)
|
||||
if err != nil {
|
||||
|
@ -162,7 +162,7 @@ func run(cartridgeFile string) error {
|
|||
if err != nil {
|
||||
return fmt.Errorf("error preparing television: %s", err)
|
||||
}
|
||||
tv.SetVisibility(true)
|
||||
tv.SetVisibility(true, false)
|
||||
|
||||
vcs, err := hardware.NewVCS(tv)
|
||||
if err != nil {
|
||||
|
|
|
@ -207,7 +207,7 @@ func (tv *HeadlessTV) Signal(attr SignalAttributes) {
|
|||
}
|
||||
|
||||
// SetVisibility does nothing for the HeadlessTV
|
||||
func (tv *HeadlessTV) SetVisibility(visible bool) error {
|
||||
func (tv *HeadlessTV) SetVisibility(visible, showOverscan bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ func (tv *SDLTV) guiLoop() {
|
|||
// close window
|
||||
case *sdl.QuitEvent:
|
||||
// SetVisibility is outside of the critical section
|
||||
tv.SetVisibility(false)
|
||||
tv.SetVisibility(false, false)
|
||||
|
||||
// *CRITICAL SECTION*
|
||||
// (R) tv.onWindowClose
|
||||
|
@ -26,17 +26,15 @@ func (tv *SDLTV) guiLoop() {
|
|||
if ev.Type == sdl.KEYDOWN {
|
||||
switch ev.Keysym.Sym {
|
||||
case sdl.K_BACKQUOTE:
|
||||
var showOverscan bool
|
||||
|
||||
// *CRITICAL SECTION*
|
||||
// (W) tv.scr
|
||||
// (R) tv.playScr, tv.dbgScr
|
||||
// (R) tv.scr, tv.dbgScr
|
||||
tv.guiLoopLock.Lock()
|
||||
if tv.scr == tv.dbgScr {
|
||||
tv.scr = tv.playScr
|
||||
} else {
|
||||
tv.scr = tv.dbgScr
|
||||
}
|
||||
tv.setWindowSize(tv.scr.width, tv.scr.height)
|
||||
showOverscan = tv.scr != tv.dbgScr
|
||||
tv.guiLoopLock.Unlock()
|
||||
|
||||
tv.SetVisibility(true, showOverscan)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,10 +34,20 @@ func (tv *SDLTV) Signal(attr television.SignalAttributes) {
|
|||
}
|
||||
|
||||
// SetVisibility toggles the visiblity of the SDLTV window
|
||||
func (tv *SDLTV) SetVisibility(visible bool) error {
|
||||
// *NON-CRITICAL SECTION* called from guiLoop but SDL handles its own
|
||||
// concurrency conflicts
|
||||
func (tv *SDLTV) SetVisibility(visible, showOverscan bool) error {
|
||||
// *CRITICAL SECTION*
|
||||
// (W) tv.scr
|
||||
// (R) tv.playScr, tv.dbgScr
|
||||
tv.guiLoopLock.Lock()
|
||||
if showOverscan {
|
||||
tv.scr = tv.dbgScr
|
||||
} else {
|
||||
tv.scr = tv.playScr
|
||||
}
|
||||
tv.setWindowSize(tv.scr.width, tv.scr.height)
|
||||
tv.guiLoopLock.Unlock()
|
||||
|
||||
// *NON-CRITICAL SECTION* SDL handles its own concurrency conflicts
|
||||
if visible {
|
||||
tv.window.Show()
|
||||
} else {
|
||||
|
|
|
@ -43,7 +43,7 @@ type Television interface {
|
|||
MachineInfoTerse() string
|
||||
MachineInfo() string
|
||||
Signal(SignalAttributes)
|
||||
SetVisibility(visible bool) error
|
||||
SetVisibility(visible, showOverscan bool) error
|
||||
SetPause(pause bool) error
|
||||
|
||||
RequestTVState(TVStateReq) (*TVState, error)
|
||||
|
@ -74,7 +74,7 @@ func (tv DummyTV) String() string {
|
|||
func (DummyTV) Signal(SignalAttributes) {}
|
||||
|
||||
// SetVisibility (with dummyTV reciever) is the null implementation
|
||||
func (DummyTV) SetVisibility(visible bool) error {
|
||||
func (DummyTV) SetVisibility(visible, showOverscan bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue