Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dreamcast
DCInfo
Commits
3652a0cf
Commit
3652a0cf
authored
Feb 18, 2024
by
Donald Haase
Browse files
Demagic the maple buffer size
parent
295cf7a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
MapleTest.c
View file @
3652a0cf
...
...
@@ -13,9 +13,10 @@
#include
<dc/maple.h>
/* The spec size of the maple receive buffer is 1024. A bit is added, just in case */
#define MAPLE_BUFF_SIZE (1024 + 32)
/* Local copy of the returned buffer for maple stuff */
unsigned
char
recv_buff
[
1024
+
32
]
__attribute__
((
aligned
(
32
)));
unsigned
char
recv_buff
[
MAPLE_BUFF_SIZE
]
__attribute__
((
aligned
(
32
)));
static
void
vbl_allinfo_callback
(
maple_frame_t
*
frm
)
{
...
...
@@ -28,7 +29,7 @@ static void vbl_allinfo_callback(maple_frame_t * frm)
{
printf
(
"Received proper maple response
\n
"
);
/* Copy in the new buff */
memcpy
(
recv_buff
,
resp
,
1024
+
32
);
memcpy
(
recv_buff
,
resp
,
MAPLE_BUFF_SIZE
);
}
else
printf
(
"maple: bad response %d on device
\n
"
,
resp
->
response
);
...
...
@@ -93,7 +94,7 @@ void print_device_allinfo(maple_device_t *dev, int extra)
if
(
dev
==
NULL
)
return
;
/* Clear the old buffer */
memset
(
recv_buff
,
0
,
1024
+
32
);
memset
(
recv_buff
,
0
,
MAPLE_BUFF_SIZE
);
printf
(
"Trying to get the allinfo for device %c%c:
\n
"
,
'A'
+
(
dev
->
port
),
'0'
+
(
dev
->
unit
));
fflush
(
stdout
);
vbl_send_allinfo
((
dev
->
port
),
(
dev
->
unit
));
...
...
@@ -104,8 +105,8 @@ void print_device_allinfo(maple_device_t *dev, int extra)
if
(
extra
==
0
)
return
;
else
if
(
extra
==
1
)
size
+=
4
;
/* Just grab the amount told we were getting + tiny pad */
else
if
(
extra
==
2
)
size
=
((
size
+
64
)
<
(
1024
+
32
))
?
(
size
+
64
)
:
(
1024
+
32
)
;
/* Grab just a little more */
else
if
(
extra
==
3
)
size
=
1024
+
32
;
/* Grab the max amount */
else
if
(
extra
==
2
)
size
=
((
size
+
64
)
<
MAPLE_BUFF_SIZE
)
?
(
size
+
64
)
:
MAPLE_BUFF_SIZE
;
/* Grab just a little more */
else
if
(
extra
==
3
)
size
=
MAPLE_BUFF_SIZE
;
/* Grab the max amount */
printf
(
"Extra data:
\n
"
);
/* Really disgusting loop to print out a pretty copy of the data first in hex then ascii (if it is) */
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment