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
e88c51a1
Verified
Commit
e88c51a1
authored
1 year ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
chore: support for emulator options
parent
a97e6437
No related branches found
No related tags found
No related merge requests found
Pipeline
#2764
passed
1 year ago
Stage: build
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontends/sdl/src/main.rs
+22
-4
22 additions, 4 deletions
frontends/sdl/src/main.rs
with
22 additions
and
4 deletions
frontends/sdl/src/main.rs
+
22
−
4
View file @
e88c51a1
...
@@ -48,6 +48,11 @@ impl Default for Benchmark {
...
@@ -48,6 +48,11 @@ impl Default for Benchmark {
}
}
}
}
pub
struct
EmulatorOptions
{
auto_mode
:
bool
,
features
:
Option
<
Vec
<&
'static
str
>>
,
}
pub
struct
Emulator
{
pub
struct
Emulator
{
system
:
GameBoy
,
system
:
GameBoy
,
auto_mode
:
bool
,
auto_mode
:
bool
,
...
@@ -65,10 +70,10 @@ pub struct Emulator {
...
@@ -65,10 +70,10 @@ pub struct Emulator {
}
}
impl
Emulator
{
impl
Emulator
{
pub
fn
new
(
system
:
GameBoy
,
auto_mode
:
bool
)
->
Self
{
pub
fn
new
(
system
:
GameBoy
,
options
:
EmulatorOptions
)
->
Self
{
Self
{
Self
{
system
,
system
,
auto_mode
,
auto_mode
:
options
.
auto_mode
,
graphics
:
None
,
graphics
:
None
,
audio
:
None
,
audio
:
None
,
title
:
TITLE
,
title
:
TITLE
,
...
@@ -77,7 +82,9 @@ impl Emulator {
...
@@ -77,7 +82,9 @@ impl Emulator {
visual_frequency
:
GameBoy
::
VISUAL_FREQ
,
visual_frequency
:
GameBoy
::
VISUAL_FREQ
,
next_tick_time
:
0.0
,
next_tick_time
:
0.0
,
next_tick_time_i
:
0
,
next_tick_time_i
:
0
,
features
:
vec!
[
"video"
,
"audio"
,
"no-vsync"
],
features
:
options
.features
.unwrap_or
(
vec!
[
"video"
,
"audio"
,
"no-vsync"
]),
palettes
:
[
palettes
:
[
PaletteInfo
::
new
(
PaletteInfo
::
new
(
"basic"
,
"basic"
,
...
@@ -486,6 +493,9 @@ struct Args {
...
@@ -486,6 +493,9 @@ struct Args {
#[arg(long,
default_value_t
=
false
)]
#[arg(long,
default_value_t
=
false
)]
no_timer
:
bool
,
no_timer
:
bool
,
#[arg(long,
default_value_t
=
false
)]
headless
:
bool
,
#[arg(short,
long,
default_value_t
=
String::from(
"../../res/roms/demo/pocket.gb"
))]
#[arg(short,
long,
default_value_t
=
String::from(
"../../res/roms/demo/pocket.gb"
))]
rom_path
:
String
,
rom_path
:
String
,
}
}
...
@@ -518,7 +528,15 @@ fn main() {
...
@@ -518,7 +528,15 @@ fn main() {
// creates a new generic emulator structure then starts
// creates a new generic emulator structure then starts
// both the video and audio sub-systems, loads default
// both the video and audio sub-systems, loads default
// ROM file and starts running it
// ROM file and starts running it
let
mut
emulator
=
Emulator
::
new
(
game_boy
,
auto_mode
);
let
options
=
EmulatorOptions
{
auto_mode
,
features
:
if
args
.headless
{
Some
(
vec!
[])
}
else
{
Some
(
vec!
[
"video"
,
"audio"
,
"no-vsync"
])
},
};
let
mut
emulator
=
Emulator
::
new
(
game_boy
,
options
);
emulator
.start
(
SCREEN_SCALE
);
emulator
.start
(
SCREEN_SCALE
);
emulator
.load_rom
(
Some
(
&
args
.rom_path
));
emulator
.load_rom
(
Some
(
&
args
.rom_path
));
emulator
.toggle_palette
();
emulator
.toggle_palette
();
...
...
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