Skip to content

Commit

Permalink
implemented loading files from uma0:
Browse files Browse the repository at this point in the history
  • Loading branch information
rsn8887 committed Feb 7, 2018
1 parent c3d780a commit 3d65eb4
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 29 deletions.
5 changes: 5 additions & 0 deletions Readme.txt
Expand Up @@ -125,6 +125,11 @@ single finger drag = move the mouse pointer
dual finger drag = drag'n'drop (left mouse button is held down)

CHANGELOG:
1.60

- support for uma0: added
- prevent suspend mode because it can corrupt hdf files

1.59

- implemented touchpad-style pointer controls. Touch controls are configured under 'More Options/Touch.' Choices are 'Touch Off', 'Front only', or 'Front and Back.' The default is to use only the front panel. Both panels work the same, using relative touch mode. How far a certain finger motion moves the pointer depends on the Mouse Speed setting, which also affects how fast the analog stick moves the mouse.
Expand Down
83 changes: 54 additions & 29 deletions src/gp2x/menu/menu_load.cpp
Expand Up @@ -220,38 +220,55 @@ static int menuLoadLoop(char *curr_path)
max_in_dir=SHOW_MAX_FILES;

#ifdef __PSP2__
if(strcmp(curr_path, "/") == 0)
strcpy(curr_path, "ux0:/");

if ((dir = opendir(curr_path)) == NULL)
if(strcmp(curr_path, "/") == 0 || curr_path[0] == 0)
{
printf("opendir failed: %s\n", curr_path);
char *p;
for (p = curr_path + strlen(curr_path) - 1; p > curr_path && *p != '/'; p--);
*p = 0;
fname = p+1;
dir = opendir(curr_path);
struct dirent *ent = NULL;
n = 0;
namelist = (struct dirent **)malloc(3*1024 * sizeof(struct dirent *)); // < 3*1024 files
namelist[0] = (struct dirent *)malloc(sizeof(struct dirent));
strcpy(namelist[0]->d_name, ".");
namelist[0]->d_type = DT_DIR; n++;
namelist[1] = (struct dirent *)malloc(sizeof(struct dirent));
strcpy(namelist[1]->d_name, "ux0:");
namelist[1]->d_type = DT_DIR; n++;
namelist[2] = (struct dirent *)malloc(sizeof(struct dirent));
strcpy(namelist[2]->d_name, "uma0:");
namelist[2]->d_type = DT_DIR; n++;

curr_path[0] == 0;
}
else
{
if ((dir = opendir(curr_path)) == NULL)
{
printf("opendir failed: %s\n", curr_path);
char *p;
for (p = curr_path + strlen(curr_path) - 1; p > curr_path && *p != '/'; p--);
*p = 0;
fname = p+1;
dir = opendir(curr_path);
}

struct dirent *ent = NULL;
n = 0;
namelist = (struct dirent **)malloc(3*1024 * sizeof(struct dirent *)); // < 3*1024 files
namelist[0] = (struct dirent *)malloc(sizeof(struct dirent));
strcpy(namelist[0]->d_name, ".");
namelist[0]->d_type = DT_DIR; n++;
namelist[1] = (struct dirent *)malloc(sizeof(struct dirent));
strcpy(namelist[1]->d_name, "..");
namelist[1]->d_type = DT_DIR; n++;

while ((ent = readdir (dir)) != NULL) {
if(n >= 3*1024-1)
break;
namelist[n] = (struct dirent *)malloc(sizeof(struct dirent));
memcpy(namelist[n], ent, sizeof(struct dirent));
n++;
struct dirent *ent = NULL;
n = 0;
namelist = (struct dirent **)malloc(3*1024 * sizeof(struct dirent *)); // < 3*1024 files
namelist[0] = (struct dirent *)malloc(sizeof(struct dirent));
strcpy(namelist[0]->d_name, ".");
namelist[0]->d_type = DT_DIR; n++;
namelist[1] = (struct dirent *)malloc(sizeof(struct dirent));
strcpy(namelist[1]->d_name, "..");
namelist[1]->d_type = DT_DIR; n++;

while ((ent = readdir (dir)) != NULL) {
if(n >= 3*1024-1)
break;
namelist[n] = (struct dirent *)malloc(sizeof(struct dirent));
memcpy(namelist[n], ent, sizeof(struct dirent));
n++;
}
closedir(dir);
}
closedir(dir);


if(n <= 0) {
return 0;
}
Expand Down Expand Up @@ -409,7 +426,7 @@ static int menuLoadLoop(char *curr_path)
else
{
newdir=(char*)malloc(newlen);
if (strcmp(namelist[sel+1]->d_name, "..") == 0)
if (strcmp(namelist[sel+1]->d_name, "..") == 0)
{
char *start = curr_path;
p = start + strlen(start) - 1;
Expand All @@ -418,6 +435,14 @@ static int menuLoadLoop(char *curr_path)
if (p <= start) strcpy(newdir, "/");
else { strncpy(newdir, start, p-start); newdir[p-start] = 0; }
}
else if (strcmp(namelist[sel+1]->d_name, "ur0:") == 0)
{
strcpy(newdir, "ur0:/");
}
else if (strcmp(namelist[sel+1]->d_name, "ux0:") == 0)
{
strcpy(newdir, "ux0:/");
}
else
{
strcpy(newdir, curr_path);
Expand Down

1 comment on commit 3d65eb4

@xadox-1st
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finaly uma0: support. Thx!

Please sign in to comment.