Skip to content

Commit 3bf70c1

Browse files
authored
Merge pull request #73 from DCurrent/malik-wii-update
Pak Selection Fix
2 parents be0a5fe + d6938ee commit 3bf70c1

6 files changed

Lines changed: 99 additions & 96 deletions

File tree

engine/openbor.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2446,7 +2446,12 @@ void clearsettings()
24462446
savedata.uselog = 1;
24472447
savedata.debuginfo = 0;
24482448
savedata.fullscreen = 0;
2449+
2450+
#if WII
24492451
savedata.stretch = 1;
2452+
#else
2453+
savedata.stretch = 0;
2454+
#endif
24502455

24512456
savedata.swfilter = 0;
24522457

engine/psp/menu.c

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Image *getPreview(char *filename)
102102
if(!loadscreen("data/bgs/title", packfile, pal, PIXEL_x8, &title)) return NULL;
103103
if((scaledown = allocscreen(width, height, title->pixelformat)) == NULL) return NULL;
104104
if((preview = createImage(width, height)) == NULL) return NULL;
105-
scalescreen(scaledown, title);
105+
scalescreen(scaledown, title);
106106
//memcpy(scaledown->palette, title->palette, PAL_BYTES);
107107

108108
// Load Pallete for preview
@@ -114,14 +114,14 @@ Image *getPreview(char *filename)
114114
dp = (void*)preview->data;
115115
for(y=0; y<height; y++)
116116
{
117-
for(x=0; x<width; x++) dp[x] = palette[((int)(sp[x])) & 0xFF];
117+
for(x=0; x<width; x++) dp[x] = palette[((int)(sp[x])) & 0xFF];
118118
sp += scaledown->width;
119119
dp += preview->textureWidth;
120120
}
121121

122122
// ScreenShots within Menu will be saved as "Menu"
123-
strncpy(packfile,"Menu.xxx",MAX_LABEL_LEN);
124-
123+
strncpy(packfile,"Menu.xxx",MAX_LABEL_LEN);
124+
125125
// Free Images and Terminiate Filecaching
126126
freescreen(&title);
127127
freescreen(&scaledown);
@@ -230,37 +230,37 @@ void sortList()
230230
}
231231
}
232232

233-
static int findPaks(void)
234-
{
235-
int i = 0;
236-
DIR* dp = NULL;
237-
struct dirent* ds;
238-
dp = opendir(dListPath);
239-
if(dp != NULL)
240-
{
241-
while((ds = readdir(dp)) != NULL)
242-
{
243-
if(packfile_supported(ds->d_name))
244-
{
245-
fileliststruct *copy = NULL;
246-
if(filelist == NULL) filelist = malloc(sizeof(fileliststruct));
247-
else
248-
{
249-
copy = malloc((i + 1) * sizeof(fileliststruct));
250-
memcpy(copy, filelist, (i + 1) * sizeof(fileliststruct));
251-
free(filelist);
252-
filelist = malloc((i + 1) * sizeof(fileliststruct));
253-
memcpy(filelist, copy, (i + 1) * sizeof(fileliststruct));
254-
free(copy); copy = NULL;
255-
}
256-
memset(&filelist[i], 0, sizeof(fileliststruct));
257-
strcpy(filelist[i].filename, ds->d_name);
258-
i++;
259-
}
260-
}
261-
closedir(dp);
262-
}
263-
return i;
233+
static int findPaks(void)
234+
{
235+
int i = 0;
236+
DIR* dp = NULL;
237+
struct dirent* ds;
238+
dp = opendir(dListPath);
239+
if(dp != NULL)
240+
{
241+
while((ds = readdir(dp)) != NULL)
242+
{
243+
if(packfile_supported(ds->d_name))
244+
{
245+
fileliststruct *copy = NULL;
246+
if(filelist == NULL) filelist = malloc(sizeof(fileliststruct));
247+
else
248+
{
249+
copy = malloc(i * sizeof(fileliststruct));
250+
memcpy(copy, filelist, i * sizeof(fileliststruct));
251+
free(filelist);
252+
filelist = malloc((i + 1) * sizeof(fileliststruct));
253+
memcpy(filelist, copy, i * sizeof(fileliststruct));
254+
free(copy); copy = NULL;
255+
}
256+
memset(&filelist[i], 0, sizeof(fileliststruct));
257+
strcpy(filelist[i].filename, ds->d_name);
258+
i++;
259+
}
260+
}
261+
closedir(dp);
262+
}
263+
return i;
264264
}
265265

266266
void drawMenu()
@@ -787,12 +787,12 @@ void menu(char *path)
787787
ctrl = Control();
788788
switch(ctrl)
789789
{
790-
case 1:
791-
if (dListTotal > 0) done = 1;
792-
break;
793-
794-
case 2:
795-
done = 1;
790+
case 1:
791+
if (dListTotal > 0) done = 1;
792+
break;
793+
794+
case 2:
795+
done = 1;
796796
break;
797797

798798
case -1:
@@ -814,8 +814,8 @@ void menu(char *path)
814814
case -5:
815815
drawLogs();
816816
break;
817-
818-
default:
817+
818+
default:
819819
break;
820820
}
821821
}

engine/sdl/menu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,11 @@ static int findPaks(void)
185185
if(filelist == NULL) filelist = malloc(sizeof(fileliststruct));
186186
else
187187
{
188-
copy = malloc((i + 1) * sizeof(fileliststruct));
189-
memcpy(copy, filelist, (i + 1) * sizeof(fileliststruct));
188+
copy = malloc(i * sizeof(fileliststruct));
189+
memcpy(copy, filelist, i * sizeof(fileliststruct));
190190
free(filelist);
191191
filelist = malloc((i + 1) * sizeof(fileliststruct));
192-
memcpy(filelist, copy, (i + 1) * sizeof(fileliststruct));
192+
memcpy(filelist, copy, i * sizeof(fileliststruct));
193193
free(copy); copy = NULL;
194194
}
195195
memset(&filelist[i], 0, sizeof(fileliststruct));

engine/vita/menu.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,12 @@ static int findPaks(void)
188188
if (filelist == NULL) filelist = malloc(sizeof(fileliststruct));
189189
else
190190
{
191-
copy = malloc((i + 1) * sizeof(fileliststruct));
192-
memcpy(copy, filelist, (i + 1) * sizeof(fileliststruct));
193-
free(filelist);
194-
filelist = malloc((i + 1) * sizeof(fileliststruct));
195-
memcpy(filelist, copy, (i + 1) * sizeof(fileliststruct));
196-
free(copy); copy = NULL;
191+
copy = malloc(i * sizeof(fileliststruct));
192+
memcpy(copy, filelist, i * sizeof(fileliststruct));
193+
free(filelist);
194+
filelist = malloc((i + 1) * sizeof(fileliststruct));
195+
memcpy(filelist, copy, i * sizeof(fileliststruct));
196+
free(copy); copy = NULL;
197197
}
198198
memset(&filelist[i], 0, sizeof(fileliststruct));
199199
strncpy(filelist[i].filename, ds.d_name, strlen(ds.d_name));

engine/wii/menu.c

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -331,37 +331,35 @@ void sortList()
331331
}
332332
}
333333

334-
static int findPaks(void)
335-
{
336-
int i = 0;
337-
DIR* dp = NULL;
338-
struct dirent* ds;
339-
dp = opendir(paksDir);
340-
if(dp != NULL)
341-
{
342-
while((ds = readdir(dp)) != NULL)
343-
{
344-
if(packfile_supported(ds->d_name))
345-
{
346-
fileliststruct *copy = NULL;
347-
if(filelist == NULL) filelist = malloc(sizeof(fileliststruct));
348-
else
349-
{
350-
copy = malloc((i + 1) * sizeof(fileliststruct));
351-
memcpy(copy, filelist, (i + 1) * sizeof(fileliststruct));
352-
free(filelist);
353-
filelist = malloc((i + 1) * sizeof(fileliststruct));
354-
memcpy(filelist, copy, (i + 1) * sizeof(fileliststruct));
355-
free(copy); copy = NULL;
356-
}
357-
memset(&filelist[i], 0, sizeof(fileliststruct));
358-
strcpy(filelist[i].filename, ds->d_name);
359-
i++;
360-
}
361-
}
362-
closedir(dp);
363-
}
364-
return i;
334+
static int findPaks(void)
335+
{
336+
int i = 0;
337+
DIR* dp = NULL;
338+
struct dirent* ds;
339+
dp = opendir(paksDir);
340+
if(dp != NULL)
341+
{
342+
while((ds = readdir(dp)) != NULL)
343+
{
344+
if(packfile_supported(ds->d_name))
345+
{
346+
fileliststruct *copy = NULL;
347+
if(filelist == NULL) filelist = malloc(sizeof(fileliststruct));
348+
else
349+
copy = malloc(i * sizeof(fileliststruct));
350+
memcpy(copy, filelist, i * sizeof(fileliststruct));
351+
free(filelist);
352+
filelist = malloc((i + 1) * sizeof(fileliststruct));
353+
memcpy(filelist, copy, i * sizeof(fileliststruct));
354+
free(copy); copy = NULL;
355+
memset(&filelist[i], 0, sizeof(fileliststruct));
356+
strcpy(filelist[i].filename, ds->d_name);
357+
i++;
358+
}
359+
}
360+
closedir(dp);
361+
}
362+
return i;
365363
}
366364

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

456-
scalescreen(scale, title);
457-
memcpy(scale->palette, title->palette, PAL_BYTES);
458-
454+
scalescreen(scale, title);
455+
memcpy(scale->palette, title->palette, PAL_BYTES);
456+
459457
// ScreenShots within Menu will be saved as "Menu"
460458
strncpy(packfile,"Menu.ext",MAX_FILENAME_LEN);
461459

@@ -583,7 +581,7 @@ void drawMenu()
583581
if(list == dListCurrentPosition)
584582
{
585583
shift = 2;
586-
colors = RED;
584+
colors = RED;
587585
//Image = getPreview(filelist[list+dListScrollPosition].filename);
588586
if(Image)
589587
{
@@ -761,12 +759,12 @@ void Menu()
761759
ctrl = Control();
762760
switch(ctrl)
763761
{
764-
case 1:
765-
if (dListTotal > 0) done = 1;
766-
break;
767-
768-
case 2:
769-
done = 1;
762+
case 1:
763+
if (dListTotal > 0) done = 1;
764+
break;
765+
766+
case 2:
767+
done = 1;
770768
break;
771769

772770
case 3:
@@ -779,9 +777,9 @@ void Menu()
779777

780778
case -2:
781779
// BGM player isn't supported
782-
break;
783-
784-
default:
780+
break;
781+
782+
default:
785783
break;
786784
}
787785
}

tools/devkitpro/devkitPro.7z

-9.12 MB
Binary file not shown.

0 commit comments

Comments
 (0)