Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
boytacean
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
João Magalhães
boytacean
Commits
60f4836e
Verified
Commit
60f4836e
authored
1 year ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
chore: new settings panel for debug
parent
8d297efe
No related branches found
No related tags found
1 merge request
!16
Support for Game Boy Color (CGB) 😎🖍️
Pipeline
#2593
failed
1 year ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontends/web/react/components/debug/debug.tsx
+101
-1
101 additions, 1 deletion
frontends/web/react/components/debug/debug.tsx
frontends/web/ts/gb.ts
+12
-3
12 additions, 3 deletions
frontends/web/ts/gb.ts
with
113 additions
and
4 deletions
frontends/web/react/components/debug/debug.tsx
+
101
−
1
View file @
60f4836e
import
React
,
{
FC
}
from
"
react
"
;
import
React
,
{
FC
,
useEffect
,
useState
}
from
"
react
"
;
import
{
ButtonSwitch
,
Info
,
Pair
}
from
"
emukit
"
;
import
{
AudioGB
}
from
"
../audio-gb/audio-gb
"
;
import
{
AudioGB
}
from
"
../audio-gb/audio-gb
"
;
import
{
RegistersGB
}
from
"
../registers-gb/registers-gb
"
;
import
{
RegistersGB
}
from
"
../registers-gb/registers-gb
"
;
import
{
TilesGB
}
from
"
../tiles-gb/tiles-gb
"
;
import
{
TilesGB
}
from
"
../tiles-gb/tiles-gb
"
;
...
@@ -63,3 +64,102 @@ export const DebugAudio: FC<EmulatorProps> = ({ emulator }) => {
...
@@ -63,3 +64,102 @@ export const DebugAudio: FC<EmulatorProps> = ({ emulator }) => {
</>
</>
);
);
};
};
export
const
DebugSettings
:
FC
<
EmulatorProps
>
=
({
emulator
})
=>
{
return
(
<>
<
DebugSettingsContent
emulator
=
{
emulator
}
></
DebugSettingsContent
>
</>
);
};
const
DebugSettingsContent
:
FC
<
EmulatorProps
>
=
({
emulator
})
=>
{
const
[
updated
,
setUpdated
]
=
useState
(
Date
.
now
());
useEffect
(()
=>
{
const
onAudioState
=
()
=>
{
setUpdated
(
Date
.
now
());
};
emulator
.
bind
(
"
audio-state
"
,
onAudioState
);
return
()
=>
{
emulator
.
unbind
(
"
audio-state
"
,
onAudioState
);
};
},
[]);
const
onPpuChange
=
(
option
:
string
)
=>
{
emulator
.
instance
?.
set_ppu_enabled
(
option
===
"
on
"
);
};
const
onApuChange
=
(
option
:
string
)
=>
{
emulator
.
instance
?.
set_apu_enabled
(
option
===
"
on
"
);
};
const
onTimerChange
=
(
option
:
string
)
=>
{
emulator
.
instance
?.
set_timer_enabled
(
option
===
"
on
"
);
};
const
onSerialChange
=
(
option
:
string
)
=>
{
emulator
.
instance
?.
set_serial_enabled
(
option
===
"
on
"
);
};
return
(
<
Info
key
=
{
updated
}
>
<
Pair
name
=
{
"
PPU
"
}
valueNode
=
{
<
ButtonSwitch
options
=
{
[
"
on
"
,
"
off
"
]
}
value
=
{
emulator
.
instance
?.
ppu_enabled
()
?
"
on
"
:
"
off
"
}
uppercase
=
{
true
}
size
=
{
"
large
"
}
style
=
{
[
"
simple
"
]
}
onChange
=
{
onPpuChange
}
/>
}
/>
<
Pair
name
=
{
"
APU
"
}
valueNode
=
{
<
ButtonSwitch
options
=
{
[
"
on
"
,
"
off
"
]
}
value
=
{
emulator
.
instance
?.
apu_enabled
()
?
"
on
"
:
"
off
"
}
uppercase
=
{
true
}
size
=
{
"
large
"
}
style
=
{
[
"
simple
"
]
}
onChange
=
{
onApuChange
}
/>
}
/>
<
Pair
name
=
{
"
Timer
"
}
valueNode
=
{
<
ButtonSwitch
options
=
{
[
"
on
"
,
"
off
"
]
}
value
=
{
emulator
.
instance
?.
timer_enabled
()
?
"
on
"
:
"
off
"
}
uppercase
=
{
true
}
size
=
{
"
large
"
}
style
=
{
[
"
simple
"
]
}
onChange
=
{
onTimerChange
}
/>
}
/>
<
Pair
name
=
{
"
Serial
"
}
valueNode
=
{
<
ButtonSwitch
options
=
{
[
"
on
"
,
"
off
"
]
}
value
=
{
emulator
.
instance
?.
serial_enabled
()
?
"
on
"
:
"
off
"
}
uppercase
=
{
true
}
size
=
{
"
large
"
}
style
=
{
[
"
simple
"
]
}
onChange
=
{
onSerialChange
}
/>
}
/>
</
Info
>
);
};
This diff is collapsed.
Click to expand it.
frontends/web/ts/gb.ts
+
12
−
3
View file @
60f4836e
...
@@ -20,6 +20,7 @@ import { PALETTES, PALETTES_MAP } from "./palettes";
...
@@ -20,6 +20,7 @@ import { PALETTES, PALETTES_MAP } from "./palettes";
import
{
base64ToBuffer
,
bufferToBase64
}
from
"
./util
"
;
import
{
base64ToBuffer
,
bufferToBase64
}
from
"
./util
"
;
import
{
import
{
DebugAudio
,
DebugAudio
,
DebugSettings
,
DebugVideo
,
DebugVideo
,
HelpFaqs
,
HelpFaqs
,
HelpKeyboard
,
HelpKeyboard
,
...
@@ -446,6 +447,10 @@ export class GameboyEmulator extends EmulatorBase implements Emulator {
...
@@ -446,6 +447,10 @@ export class GameboyEmulator extends EmulatorBase implements Emulator {
this
.
cartridge
=
cartridge
;
this
.
cartridge
=
cartridge
;
}
}
get
instance
():
GameBoy
|
null
{
return
this
.
gameBoy
;
}
get
name
():
string
{
get
name
():
string
{
return
"
Boytacean
"
;
return
"
Boytacean
"
;
}
}
...
@@ -493,9 +498,7 @@ export class GameboyEmulator extends EmulatorBase implements Emulator {
...
@@ -493,9 +498,7 @@ export class GameboyEmulator extends EmulatorBase implements Emulator {
{
{
name
:
"
Serial
"
,
name
:
"
Serial
"
,
icon
:
require
(
"
../res/serial.svg
"
),
icon
:
require
(
"
../res/serial.svg
"
),
node
:
SerialSection
({
node
:
SerialSection
({
emulator
:
this
})
emulator
:
this
})
}
}
];
];
}
}
...
@@ -522,6 +525,10 @@ export class GameboyEmulator extends EmulatorBase implements Emulator {
...
@@ -522,6 +525,10 @@ export class GameboyEmulator extends EmulatorBase implements Emulator {
{
{
name
:
"
Audio
"
,
name
:
"
Audio
"
,
node
:
DebugAudio
({
emulator
:
this
})
node
:
DebugAudio
({
emulator
:
this
})
},
{
name
:
"
Settings
"
,
node
:
DebugSettings
({
emulator
:
this
})
}
}
];
];
}
}
...
@@ -736,10 +743,12 @@ export class GameboyEmulator extends EmulatorBase implements Emulator {
...
@@ -736,10 +743,12 @@ export class GameboyEmulator extends EmulatorBase implements Emulator {
pauseAudio
()
{
pauseAudio
()
{
this
.
gameBoy
?.
set_apu_enabled
(
false
);
this
.
gameBoy
?.
set_apu_enabled
(
false
);
this
.
trigger
(
"
audio-state
"
,
{
state
:
"
paused
"
,
stateBool
:
false
});
}
}
resumeAudio
()
{
resumeAudio
()
{
this
.
gameBoy
?.
set_apu_enabled
(
true
);
this
.
gameBoy
?.
set_apu_enabled
(
true
);
this
.
trigger
(
"
audio-state
"
,
{
state
:
"
resumed
"
,
stateBool
:
true
});
}
}
getAudioState
():
boolean
{
getAudioState
():
boolean
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment