Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
Stella
Commits
ff654269
Commit
ff654269
authored
Apr 01, 2019
by
thrust26
Browse files
safety fix for unusual small ROMs.
parent
8c812893
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/emucore/ControllerDetector.cxx
View file @
ff654269
...
...
@@ -85,21 +85,22 @@ string ControllerDetector::autodetectPort(const uInt8* image, uInt32 size,
bool
ControllerDetector
::
searchForBytes
(
const
uInt8
*
image
,
uInt32
imagesize
,
const
uInt8
*
signature
,
uInt32
sigsize
)
{
for
(
uInt32
i
=
0
;
i
<
imagesize
-
sigsize
;
++
i
)
{
uInt32
matches
=
0
;
for
(
uInt32
j
=
0
;
j
<
sigsize
;
++
j
)
{
if
(
image
[
i
+
j
]
==
signature
[
j
])
++
matches
;
else
break
;
}
if
(
matches
==
sigsize
)
if
(
imagesize
>=
sigsize
)
for
(
uInt32
i
=
0
;
i
<
imagesize
-
sigsize
;
++
i
)
{
return
true
;
uInt32
matches
=
0
;
for
(
uInt32
j
=
0
;
j
<
sigsize
;
++
j
)
{
if
(
image
[
i
+
j
]
==
signature
[
j
])
++
matches
;
else
break
;
}
if
(
matches
==
sigsize
)
{
return
true
;
}
}
}
return
false
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment