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
5d9334c6
Verified
Commit
5d9334c6
authored
1 year ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
chore: added more bess writting
parent
5deb7ba9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!31
System state save
Pipeline
#3228
passed
1 year ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/state.rs
+35
-2
35 additions, 2 deletions
src/state.rs
with
35 additions
and
2 deletions
src/state.rs
+
35
−
2
View file @
5d9334c6
...
...
@@ -160,6 +160,9 @@ impl Serialize for BeesBuffer {
fn
save
(
&
self
,
buffer
:
&
mut
Vec
<
u8
>
)
{
buffer
.write_all
(
&
self
.size
.to_le_bytes
())
.unwrap
();
buffer
.write_all
(
&
self
.offset
.to_le_bytes
())
.unwrap
();
// @TODO need to seek the file to the beginning and write the
// associated buffer into that section
}
fn
load
(
&
mut
self
,
data
:
&
mut
Cursor
<
Vec
<
u8
>>
)
{
...
...
@@ -403,6 +406,36 @@ impl BeesCore {
impl
Serialize
for
BeesCore
{
fn
save
(
&
self
,
buffer
:
&
mut
Vec
<
u8
>
)
{
self
.header
.save
(
buffer
);
buffer
.write_all
(
&
self
.major
.to_le_bytes
())
.unwrap
();
buffer
.write_all
(
&
self
.minor
.to_le_bytes
())
.unwrap
();
buffer
.write_all
(
self
.model
.as_bytes
())
.unwrap
();
buffer
.write_all
(
&
self
.pc
.to_le_bytes
())
.unwrap
();
buffer
.write_all
(
&
self
.af
.to_le_bytes
())
.unwrap
();
buffer
.write_all
(
&
self
.bc
.to_le_bytes
())
.unwrap
();
buffer
.write_all
(
&
self
.de
.to_le_bytes
())
.unwrap
();
buffer
.write_all
(
&
self
.hl
.to_le_bytes
())
.unwrap
();
buffer
.write_all
(
&
self
.sp
.to_le_bytes
())
.unwrap
();
buffer
.write_all
(
&
(
self
.ime
as
u8
)
.to_le_bytes
())
.unwrap
();
buffer
.write_all
(
&
self
.ie
.to_le_bytes
())
.unwrap
();
buffer
.write_all
(
&
self
.execution_mode
.to_le_bytes
())
.unwrap
();
buffer
.write_all
(
&
self
._padding
.to_le_bytes
())
.unwrap
();
buffer
.write_all
(
&
self
.io_registers
)
.unwrap
();
// @TODO requires support for writing of the underlying buffers
self
.ram
.save
(
buffer
);
self
.vram
.save
(
buffer
);
self
.mbc_ram
.save
(
buffer
);
self
.oam
.save
(
buffer
);
self
.hram
.save
(
buffer
);
self
.background_palettes
.save
(
buffer
);
self
.object_palettes
.save
(
buffer
);
}
fn
load
(
&
mut
self
,
data
:
&
mut
Cursor
<
Vec
<
u8
>>
)
{
...
...
@@ -494,8 +527,8 @@ impl State for BeesCore {
//@TODO the MBC is missing
gb
.mmu
()
.write_many
(
0xfe00
,
&
self
.oam.buffer
);
gb
.mmu
()
.write_many
(
0xff80
,
&
self
.hram.buffer
);
//@TODO the background palettes are missing
//@TODO the object palettes are missing
//@TODO the background palettes are missing
- CGB only
//@TODO the object palettes are missing
- CGB only
}
}
...
...
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