projects
/
hackover2013-badge-firmware.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix email
[hackover2013-badge-firmware.git]
/
badge
/
jumpnrun
/
starter.c
diff --git
a/badge/jumpnrun/starter.c
b/badge/jumpnrun/starter.c
index
93e769c
..
d35c5fa
100644
(file)
--- a/
badge/jumpnrun/starter.c
+++ b/
badge/jumpnrun/starter.c
@@
-15,7
+15,9
@@
static uint8_t jumpnrun_load_progress(void) {
uint8_t progress = 0;
FIL fd;
uint8_t progress = 0;
FIL fd;
- if(FR_OK == f_open(&fd, PROGRESS_FNAME, FA_OPEN_EXISTING | FA_READ)) {
+
+ if(FR_OK == f_chdir(JUMPNRUN_PATH) &&
+ FR_OK == f_open(&fd, PROGRESS_FNAME, FA_OPEN_EXISTING | FA_READ)) {
UINT bytes;
f_read(&fd, &progress, sizeof(progress), &bytes);
f_close(&fd);
UINT bytes;
f_read(&fd, &progress, sizeof(progress), &bytes);
f_close(&fd);
@@
-27,7
+29,8
@@
static uint8_t jumpnrun_load_progress(void) {
static void jumpnrun_save_progress(uint8_t progress) {
FIL fd;
static void jumpnrun_save_progress(uint8_t progress) {
FIL fd;
- if(FR_OK == f_open(&fd, PROGRESS_FNAME, FA_CREATE_ALWAYS | FA_WRITE)) {
+ if(FR_OK == f_chdir(JUMPNRUN_PATH) &&
+ FR_OK == f_open(&fd, PROGRESS_FNAME, FA_CREATE_ALWAYS | FA_WRITE)) {
UINT bytes;
f_write(&fd, &progress, sizeof(progress), &bytes);
f_close(&fd);
UINT bytes;
f_write(&fd, &progress, sizeof(progress), &bytes);
f_close(&fd);
@@
-73,14
+76,16
@@
static uint8_t jumpnrun_pick_level_from_fd(char *buf, size_t *first_visible, siz
}
*selected = choice;
}
*selected = choice;
- strcpy(buf, fnames[*selected]);
+ strncpy(buf, fnames[*selected], LEVELFILE_MAX);
+ buf[LEVELFILE_MAX] = '\0';
return 0;
}
static uint8_t jumpnrun_pick_level(char *buf, size_t *first_visible, size_t *selected, uint8_t progress) {
FIL fd;
return 0;
}
static uint8_t jumpnrun_pick_level(char *buf, size_t *first_visible, size_t *selected, uint8_t progress) {
FIL fd;
- if(FR_OK != f_open(&fd, "levels.lst", FA_OPEN_EXISTING | FA_READ)) {
+ if(FR_OK != f_chdir(JUMPNRUN_PATH) ||
+ FR_OK != f_open(&fd, "levels.lst", FA_OPEN_EXISTING | FA_READ)) {
return JUMPNRUN_ERROR;
}
return JUMPNRUN_ERROR;
}
This page took
0.023113 seconds
and
4
git commands to generate.