Skip to content

Commit

Permalink
Merge pull request #73 from DCurrent/malik-wii-update
Browse files Browse the repository at this point in the history
Pak Selection Fix
  • Loading branch information
DCurrent authored Aug 10, 2018
2 parents be0a5fe + d6938ee commit 3bf70c1
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 96 deletions.
5 changes: 5 additions & 0 deletions engine/openbor.c
Original file line number Diff line number Diff line change
Expand Up @@ -2446,7 +2446,12 @@ void clearsettings()
savedata.uselog = 1;
savedata.debuginfo = 0;
savedata.fullscreen = 0;

#if WII
savedata.stretch = 1;
#else
savedata.stretch = 0;
#endif

savedata.swfilter = 0;

Expand Down
86 changes: 43 additions & 43 deletions engine/psp/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Image *getPreview(char *filename)
if(!loadscreen("data/bgs/title", packfile, pal, PIXEL_x8, &title)) return NULL;
if((scaledown = allocscreen(width, height, title->pixelformat)) == NULL) return NULL;
if((preview = createImage(width, height)) == NULL) return NULL;
scalescreen(scaledown, title);
scalescreen(scaledown, title);
//memcpy(scaledown->palette, title->palette, PAL_BYTES);

// Load Pallete for preview
Expand All @@ -114,14 +114,14 @@ Image *getPreview(char *filename)
dp = (void*)preview->data;
for(y=0; y<height; y++)
{
for(x=0; x<width; x++) dp[x] = palette[((int)(sp[x])) & 0xFF];
for(x=0; x<width; x++) dp[x] = palette[((int)(sp[x])) & 0xFF];
sp += scaledown->width;
dp += preview->textureWidth;
}

// ScreenShots within Menu will be saved as "Menu"
strncpy(packfile,"Menu.xxx",MAX_LABEL_LEN);

strncpy(packfile,"Menu.xxx",MAX_LABEL_LEN);

// Free Images and Terminiate Filecaching
freescreen(&title);
freescreen(&scaledown);
Expand Down Expand Up @@ -230,37 +230,37 @@ void sortList()
}
}

static int findPaks(void)
{
int i = 0;
DIR* dp = NULL;
struct dirent* ds;
dp = opendir(dListPath);
if(dp != NULL)
{
while((ds = readdir(dp)) != NULL)
{
if(packfile_supported(ds->d_name))
{
fileliststruct *copy = NULL;
if(filelist == NULL) filelist = malloc(sizeof(fileliststruct));
else
{
copy = malloc((i + 1) * sizeof(fileliststruct));
memcpy(copy, filelist, (i + 1) * sizeof(fileliststruct));
free(filelist);
filelist = malloc((i + 1) * sizeof(fileliststruct));
memcpy(filelist, copy, (i + 1) * sizeof(fileliststruct));
free(copy); copy = NULL;
}
memset(&filelist[i], 0, sizeof(fileliststruct));
strcpy(filelist[i].filename, ds->d_name);
i++;
}
}
closedir(dp);
}
return i;
static int findPaks(void)
{
int i = 0;
DIR* dp = NULL;
struct dirent* ds;
dp = opendir(dListPath);
if(dp != NULL)
{
while((ds = readdir(dp)) != NULL)
{
if(packfile_supported(ds->d_name))
{
fileliststruct *copy = NULL;
if(filelist == NULL) filelist = malloc(sizeof(fileliststruct));
else
{
copy = malloc(i * sizeof(fileliststruct));
memcpy(copy, filelist, i * sizeof(fileliststruct));
free(filelist);
filelist = malloc((i + 1) * sizeof(fileliststruct));
memcpy(filelist, copy, i * sizeof(fileliststruct));
free(copy); copy = NULL;
}
memset(&filelist[i], 0, sizeof(fileliststruct));
strcpy(filelist[i].filename, ds->d_name);
i++;
}
}
closedir(dp);
}
return i;
}

void drawMenu()
Expand Down Expand Up @@ -787,12 +787,12 @@ void menu(char *path)
ctrl = Control();
switch(ctrl)
{
case 1:
if (dListTotal > 0) done = 1;
break;

case 2:
done = 1;
case 1:
if (dListTotal > 0) done = 1;
break;

case 2:
done = 1;
break;

case -1:
Expand All @@ -814,8 +814,8 @@ void menu(char *path)
case -5:
drawLogs();
break;

default:

default:
break;
}
}
Expand Down
6 changes: 3 additions & 3 deletions engine/sdl/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ static int findPaks(void)
if(filelist == NULL) filelist = malloc(sizeof(fileliststruct));
else
{
copy = malloc((i + 1) * sizeof(fileliststruct));
memcpy(copy, filelist, (i + 1) * sizeof(fileliststruct));
copy = malloc(i * sizeof(fileliststruct));
memcpy(copy, filelist, i * sizeof(fileliststruct));
free(filelist);
filelist = malloc((i + 1) * sizeof(fileliststruct));
memcpy(filelist, copy, (i + 1) * sizeof(fileliststruct));
memcpy(filelist, copy, i * sizeof(fileliststruct));
free(copy); copy = NULL;
}
memset(&filelist[i], 0, sizeof(fileliststruct));
Expand Down
12 changes: 6 additions & 6 deletions engine/vita/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,12 @@ static int findPaks(void)
if (filelist == NULL) filelist = malloc(sizeof(fileliststruct));
else
{
copy = malloc((i + 1) * sizeof(fileliststruct));
memcpy(copy, filelist, (i + 1) * sizeof(fileliststruct));
free(filelist);
filelist = malloc((i + 1) * sizeof(fileliststruct));
memcpy(filelist, copy, (i + 1) * sizeof(fileliststruct));
free(copy); copy = NULL;
copy = malloc(i * sizeof(fileliststruct));
memcpy(copy, filelist, i * sizeof(fileliststruct));
free(filelist);
filelist = malloc((i + 1) * sizeof(fileliststruct));
memcpy(filelist, copy, i * sizeof(fileliststruct));
free(copy); copy = NULL;
}
memset(&filelist[i], 0, sizeof(fileliststruct));
strncpy(filelist[i].filename, ds.d_name, strlen(ds.d_name));
Expand Down
86 changes: 42 additions & 44 deletions engine/wii/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,37 +331,35 @@ void sortList()
}
}

static int findPaks(void)
{
int i = 0;
DIR* dp = NULL;
struct dirent* ds;
dp = opendir(paksDir);
if(dp != NULL)
{
while((ds = readdir(dp)) != NULL)
{
if(packfile_supported(ds->d_name))
{
fileliststruct *copy = NULL;
if(filelist == NULL) filelist = malloc(sizeof(fileliststruct));
else
{
copy = malloc((i + 1) * sizeof(fileliststruct));
memcpy(copy, filelist, (i + 1) * sizeof(fileliststruct));
free(filelist);
filelist = malloc((i + 1) * sizeof(fileliststruct));
memcpy(filelist, copy, (i + 1) * sizeof(fileliststruct));
free(copy); copy = NULL;
}
memset(&filelist[i], 0, sizeof(fileliststruct));
strcpy(filelist[i].filename, ds->d_name);
i++;
}
}
closedir(dp);
}
return i;
static int findPaks(void)
{
int i = 0;
DIR* dp = NULL;
struct dirent* ds;
dp = opendir(paksDir);
if(dp != NULL)
{
while((ds = readdir(dp)) != NULL)
{
if(packfile_supported(ds->d_name))
{
fileliststruct *copy = NULL;
if(filelist == NULL) filelist = malloc(sizeof(fileliststruct));
else
copy = malloc(i * sizeof(fileliststruct));
memcpy(copy, filelist, i * sizeof(fileliststruct));
free(filelist);
filelist = malloc((i + 1) * sizeof(fileliststruct));
memcpy(filelist, copy, i * sizeof(fileliststruct));
free(copy); copy = NULL;
memset(&filelist[i], 0, sizeof(fileliststruct));
strcpy(filelist[i].filename, ds->d_name);
i++;
}
}
closedir(dp);
}
return i;
}

void copyScreens(s_screen *Image)
Expand Down Expand Up @@ -453,9 +451,9 @@ s_screen *getPreview(char *filename)
if(!loadscreen("data/bgs/title", packfile, NULL, PIXEL_x8, &title)) return NULL;
if((scale = allocscreen(width, height, title->pixelformat)) == NULL) return NULL;

scalescreen(scale, title);
memcpy(scale->palette, title->palette, PAL_BYTES);

scalescreen(scale, title);
memcpy(scale->palette, title->palette, PAL_BYTES);

// ScreenShots within Menu will be saved as "Menu"
strncpy(packfile,"Menu.ext",MAX_FILENAME_LEN);

Expand Down Expand Up @@ -583,7 +581,7 @@ void drawMenu()
if(list == dListCurrentPosition)
{
shift = 2;
colors = RED;
colors = RED;
//Image = getPreview(filelist[list+dListScrollPosition].filename);
if(Image)
{
Expand Down Expand Up @@ -761,12 +759,12 @@ void Menu()
ctrl = Control();
switch(ctrl)
{
case 1:
if (dListTotal > 0) done = 1;
break;

case 2:
done = 1;
case 1:
if (dListTotal > 0) done = 1;
break;

case 2:
done = 1;
break;

case 3:
Expand All @@ -779,9 +777,9 @@ void Menu()

case -2:
// BGM player isn't supported
break;

default:
break;

default:
break;
}
}
Expand Down
Binary file modified tools/devkitpro/devkitPro.7z
Binary file not shown.

0 comments on commit 3bf70c1

Please sign in to comment.