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
cd615ce9
You need to sign in or sign up before continuing.
Verified
Commit
cd615ce9
authored
1 year ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
fix: issue related to the `update_tile()` method
In restoring the VRAM
parent
69062de0
No related branches found
No related tags found
1 merge request
!31
System state save
Pipeline
#3272
passed
1 year ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mmu.rs
+1
-1
1 addition, 1 deletion
src/mmu.rs
src/ppu.rs
+19
-5
19 additions, 5 deletions
src/ppu.rs
with
20 additions
and
6 deletions
src/mmu.rs
+
1
−
1
View file @
cd615ce9
...
...
@@ -250,7 +250,7 @@ impl Mmu {
// @TODO: Implement DMA transfer in a better way
// only runs the DMA transfer if the system is in CGB mode
// this avoid issues when writing to DMG unmapped registers
// this avoid
s
issues when writing to DMG unmapped registers
// that would otherwise cause the system to crash
if
self
.mode
==
GameBoyMode
::
Cgb
{
let
data
=
self
.read_many
(
self
.dma
.source
(),
self
.dma
.length
());
...
...
This diff is collapsed.
Click to expand it.
src/ppu.rs
+
19
−
5
View file @
cd615ce9
...
...
@@ -1175,22 +1175,36 @@ impl Ppu {
/// to the VRAM values, this should be called whenever the VRAM
/// is replaced.
pub
fn
update_vram
(
&
mut
self
)
{
// "saves" the old values of the VRAM bank and offset
// as they are going to be needed later, this is required
// as we're going to trick the PPU into switching banks
// over the update of the calculated values for the new VRAM,
// essentially required for the `update_tile()` method
let
(
vram_bank_old
,
vram_offset_old
)
=
(
self
.vram_bank
,
self
.vram_offset
);
// determines the number of VRAM banks available according
// to the running Game Boy running mode (CGB vs DMG)
let
vram_banks
=
if
self
.gb_mode
==
GameBoyMode
::
Cgb
{
2u
16
2u
8
}
else
{
1u
16
1u
8
};
for
vram_bank
in
0
..
vram_banks
{
let
vram_offset
=
vram_bank
*
0x2000
;
self
.vram_bank
=
vram_bank
;
self
.vram_offset
=
self
.vram_bank
as
u16
*
0x2000
;
for
addr
in
0x8000
..=
0x9fff
{
let
value
=
self
.vram
[(
vram_offset
+
(
addr
&
0x1fff
))
as
usize
];
let
value
=
self
.vram
[(
self
.
vram_offset
+
(
addr
&
0x1fff
))
as
usize
];
if
addr
<
0x9800
{
self
.update_tile
(
addr
,
value
);
}
else
if
vram_bank
==
0x1
{
}
else
if
self
.
vram_bank
==
0x1
{
self
.update_bg_map_attrs
(
addr
,
value
);
}
}
}
// restores the "old" values for VRAM bank and offset
(
self
.vram_bank
,
self
.vram_offset
)
=
(
vram_bank_old
,
vram_offset_old
);
}
/// Updates the tile structure with the value that has
...
...
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