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
6965009f
Verified
Commit
6965009f
authored
2 years ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
feat: new cartridge methods
parent
51be83f0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/gb.rs
+4
-0
4 additions, 0 deletions
src/gb.rs
src/rom.rs
+25
-0
25 additions, 0 deletions
src/rom.rs
with
29 additions
and
0 deletions
src/gb.rs
+
4
−
0
View file @
6965009f
...
...
@@ -138,6 +138,10 @@ impl GameBoy {
self
.frame_buffer
()
.to_vec
()
}
pub
fn
cartridge_eager
(
&
mut
self
)
->
Cartridge
{
self
.mmu
()
.rom
()
.clone
()
}
pub
fn
registers
(
&
mut
self
)
->
Registers
{
let
ppu_registers
=
self
.ppu
()
.registers
();
Registers
{
...
...
This diff is collapsed.
Click to expand it.
src/rom.rs
+
25
−
0
View file @
6965009f
...
...
@@ -410,6 +410,31 @@ impl Cartridge {
pub
fn
ram_size_s
(
&
self
)
->
String
{
String
::
from
(
self
.ram_size
()
.description
())
}
pub
fn
has_battery
(
&
self
)
->
bool
{
match
self
.rom_type
()
{
RomType
::
Mbc1RamBattery
=>
true
,
RomType
::
Mbc2Battery
=>
true
,
RomType
::
RomRamBattery
=>
true
,
RomType
::
Mmm01RamBattery
=>
true
,
RomType
::
Mbc3TimerBattery
=>
true
,
RomType
::
Mbc3TimerRamBattery
=>
true
,
RomType
::
Mbc3RamBattery
=>
true
,
RomType
::
Mbc5RamBattery
=>
true
,
RomType
::
Mbc5RumbleRamBattery
=>
true
,
RomType
::
Mbc7SensorRumbleRamBattery
=>
true
,
RomType
::
HuC1RamBattery
=>
true
,
_
=>
false
,
}
}
pub
fn
ram_data_eager
(
&
self
)
->
Vec
<
u8
>
{
self
.ram_data
.clone
()
}
pub
fn
set_ram_data
(
&
mut
self
,
ram_data
:
Vec
<
u8
>
)
{
self
.ram_data
=
ram_data
;
}
}
impl
Default
for
Cartridge
{
...
...
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