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
dc2a6992
Verified
Commit
dc2a6992
authored
1 year ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
chore: more serialization structure
parent
80d5939c
No related branches found
No related tags found
1 merge request
!31
System state save
Pipeline
#3203
failed
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
+51
-3
51 additions, 3 deletions
src/state.rs
with
51 additions
and
3 deletions
src/state.rs
+
51
−
3
View file @
dc2a6992
#[repr(packed)]
pub
struct
BeesBlock
{
pub
struct
BeesState
{
pub
name
:
BeesName
,
pub
info
:
BeesInfo
,
pub
core
:
BeesCore
,
}
#[repr(packed)]
pub
struct
BeesBlockHeader
{
pub
magic
:
u32
,
pub
size
:
u32
,
}
...
...
@@ -16,9 +23,22 @@ pub struct BeesFooter {
pub
magic
:
u32
,
}
#[repr(packed)]
pub
struct
BeesName
{
pub
header
:
BeesBlockHeader
,
pub
name
:
String
,
}
#[repr(packed)]
pub
struct
BeesInfo
{
pub
header
:
BeesBlockHeader
,
pub
title
:
[
u8
;
16
],
pub
checksum
:
[
u8
;
2
],
}
#[repr(packed)]
pub
struct
BeesCore
{
pub
header
:
BeesBlock
,
pub
header
:
BeesBlock
Header
,
pub
major
:
u16
,
pub
minor
:
u16
,
...
...
@@ -38,7 +58,7 @@ pub struct BeesCore {
pub
execution_mode
:
u8
,
_padding
:
u8
,
pub
io_registers
:
[
u8
;
0x80
],
pub
io_registers
:
[
u8
;
128
],
pub
ram
:
BeesBuffer
,
pub
vram
:
BeesBuffer
,
...
...
@@ -48,3 +68,31 @@ pub struct BeesCore {
pub
background_palettes
:
BeesBuffer
,
pub
object_palettes
:
BeesBuffer
,
}
trait
Serialize
{
fn
store
(
&
self
,
buffer
:
&
mut
Vec
<
u8
>
);
fn
load
(
&
self
,
data
:
&
[
u8
]);
}
impl
Serialize
for
BeesState
{
fn
store
(
&
self
,
buffer
:
&
mut
Vec
<
u8
>
)
{
self
.info
.store
(
buffer
);
}
fn
load
(
&
self
,
data
:
&
[
u8
])
{
todo!
()
}
}
impl
Serialize
for
BeesName
{
fn
store
(
&
self
,
buffer
:
&
mut
Vec
<
u8
>
)
{
}
fn
load
(
&
self
,
data
:
&
[
u8
])
{}
}
impl
Serialize
for
BeesInfo
{
fn
store
(
&
self
,
buffer
:
&
mut
Vec
<
u8
>
)
{}
fn
load
(
&
self
,
data
:
&
[
u8
])
{}
}
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