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
dc24a533
Verified
Commit
dc24a533
authored
2 years ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
fix: title offset calculus
parent
214ea837
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#2178
passed
2 years ago
Stage: build
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontends/sdl/src/main.rs
+1
-1
1 addition, 1 deletion
frontends/sdl/src/main.rs
src/rom.rs
+9
-6
9 additions, 6 deletions
src/rom.rs
with
10 additions
and
7 deletions
frontends/sdl/src/main.rs
+
1
−
1
View file @
dc24a533
...
@@ -59,7 +59,7 @@ impl Emulator {
...
@@ -59,7 +59,7 @@ impl Emulator {
);
);
self
.graphics
self
.graphics
.window_mut
()
.window_mut
()
.set_title
(
format!
(
"{}
-
{}"
,
TITLE
,
rom
.title
())
.as_str
())
.set_title
(
format!
(
"{}
[
{}
]
"
,
TITLE
,
rom
.title
())
.as_str
())
.unwrap
();
.unwrap
();
}
}
...
...
This diff is collapsed.
Click to expand it.
src/rom.rs
+
9
−
6
View file @
dc24a533
...
@@ -335,12 +335,11 @@ impl Cartridge {
...
@@ -335,12 +335,11 @@ impl Cartridge {
pub
fn
set_title_offset
(
&
mut
self
)
{
pub
fn
set_title_offset
(
&
mut
self
)
{
let
mut
offset
:
usize
=
0
;
let
mut
offset
:
usize
=
0
;
for
byte
in
&
self
.rom_data
[
0x0134
..
0x0143
]
{
for
byte
in
&
self
.rom_data
[
0x0134
..=
0x0143
]
{
if
*
byte
!=
0u8
{
if
*
byte
==
0u8
{
offset
+=
1
;
break
;
continue
;
}
}
break
;
offset
+=
1
;
}
}
self
.title_offset
=
0x0134
+
offset
;
self
.title_offset
=
0x0134
+
offset
;
}
}
...
@@ -354,7 +353,11 @@ impl Cartridge {
...
@@ -354,7 +353,11 @@ impl Cartridge {
#[cfg_attr(feature
=
"wasm"
,
wasm_bindgen)]
#[cfg_attr(feature
=
"wasm"
,
wasm_bindgen)]
impl
Cartridge
{
impl
Cartridge
{
pub
fn
title
(
&
self
)
->
String
{
pub
fn
title
(
&
self
)
->
String
{
String
::
from
(
std
::
str
::
from_utf8
(
&
self
.rom_data
[
0x0134
..
self
.title_offset
])
.unwrap
())
String
::
from
(
std
::
str
::
from_utf8
(
&
self
.rom_data
[
0x0134
..
self
.title_offset
])
.unwrap
()
.trim
(),
)
}
}
pub
fn
rom_type
(
&
self
)
->
RomType
{
pub
fn
rom_type
(
&
self
)
->
RomType
{
...
...
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