Skip to content
This repository was archived by the owner on Apr 25, 2026. It is now read-only.

Commit 21290af

Browse files
committed
PicoArch:
- Moved previous patch in the package folder - Added a patch that fixes Scaled mode for resolutions up to 320x224 - Removed "NONE" scaler that was useless imho and harmonized their naming between the FunKey menu and PicoArch settings (now "Scaled", "Stretched" and "Native" for both)
1 parent d571ef9 commit 21290af

3 files changed

Lines changed: 176 additions & 0 deletions

File tree

FunKey/board/funkey/patches/picoarch/0005-fix-case-sensitive-sorting.patch renamed to FunKey/package/picoarch/0003-fix-case-sensitive-sorting.patch

File renamed without changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
diff --git a/scale.c b/scale.c
2+
index 5857589..2f61594 100644
3+
--- a/scale.c
4+
+++ b/scale.c
5+
@@ -423,7 +423,15 @@ static void scale_select_scaler(unsigned w, unsigned h, size_t pitch) {
6+
return;
7+
};
8+
9+
- current_aspect_ratio = aspect_ratio > 0 ? aspect_ratio : ((double)w / (double)h);
10+
+ double real_ratio = (double)w / (double)h;
11+
+
12+
+ /* Scaled mode: set correct aspect ratio for resolutions up to 320x224 */
13+
+ if (real_ratio <= 10.0f / 7.0f) {
14+
+ current_aspect_ratio = real_ratio;
15+
+ } else {
16+
+ /* 4:3 aspect ratio is forced for exotic resolutions (384x224 for CPS systems, 640x240 for PS1...) */
17+
+ current_aspect_ratio = aspect_ratio > 0 ? aspect_ratio : real_ratio;
18+
+ }
19+
20+
/* mame2000 sets resolutions / aspect ratio without notifying
21+
* of changes, new should always override old */
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
diff --git a/config.c b/config.c
2+
index beab9a9..e65ad95 100644
3+
--- a/config.c
4+
+++ b/config.c
5+
@@ -108,6 +108,16 @@ void config_read(const char* cfg)
6+
}
7+
8+
parse_num_val(config_data[i].val, tmp);
9+
+
10+
+ /* Backward compatibility fix:
11+
+ scale_size == 3 → replace by 2 (NATIVE) */
12+
+ if (!strcmp(config_data[i].name, "scale_size")) {
13+
+ uint32_t *val = (uint32_t *)config_data[i].val;
14+
+ if (*val == 3) {
15+
+ PA_INFO("config: scale_size=3 (obsolete) -> remapped to 2\n");
16+
+ *val = 2;
17+
+ }
18+
+ }
19+
}
20+
21+
for (size_t i = 0; i < core_options.len; i++) {
22+
diff --git a/funkey/fk_menu.c b/funkey/fk_menu.c
23+
index 1983dd9..030cebb 100644
24+
--- a/funkey/fk_menu.c
25+
+++ b/funkey/fk_menu.c
26+
@@ -217,9 +217,9 @@ static void read_aspect_ratio(void)
27+
case SCALE_SIZE_CROP:
28+
menu_aspect_ratio = ASPECT_RATIOS_TYPE_CROPPED;
29+
break;
30+
- case SCALE_SIZE_NONE:
31+
+ /*case SCALE_SIZE_NONE:
32+
menu_aspect_ratio = ASPECT_RATIOS_TYPE_NONE;
33+
- break;
34+
+ break;*/
35+
}
36+
}
37+
38+
@@ -238,10 +238,10 @@ static void update_aspect_ratio(void)
39+
scale_size = SCALE_SIZE_CROP;
40+
scale_filter = SCALE_FILTER_SMOOTH;
41+
break;
42+
- case ASPECT_RATIOS_TYPE_NONE:
43+
+ /*case ASPECT_RATIOS_TYPE_NONE:
44+
scale_size = SCALE_SIZE_NONE;
45+
scale_filter = SCALE_FILTER_NEAREST;
46+
- break;
47+
+ break;*/
48+
}
49+
scale_update_scaler();
50+
}
51+
diff --git a/funkey/fk_menu.h b/funkey/fk_menu.h
52+
index 8b9e7a4..893a9ef 100644
53+
--- a/funkey/fk_menu.h
54+
+++ b/funkey/fk_menu.h
55+
@@ -82,9 +82,9 @@ typedef enum{
56+
#define ASPECT_RATIOS \
57+
/* X(ASPECT_RATIOS_TYPE_MANUAL, "MANUAL ZOOM") */ \
58+
X(ASPECT_RATIOS_TYPE_STRETCHED, "STRETCHED") \
59+
- X(ASPECT_RATIOS_TYPE_CROPPED, "CROPPED") \
60+
+ X(ASPECT_RATIOS_TYPE_CROPPED, "NATIVE") \
61+
X(ASPECT_RATIOS_TYPE_SCALED, "SCALED") \
62+
- X(ASPECT_RATIOS_TYPE_NONE, "NONE") \
63+
+ /* X(ASPECT_RATIOS_TYPE_NONE, "NONE") */ \
64+
X(NB_ASPECT_RATIOS_TYPES, "")
65+
66+
////------ Enumeration of the different aspect ratios ------
67+
diff --git a/main.c b/main.c
68+
index 5883bee..d0d26f4 100644
69+
--- a/main.c
70+
+++ b/main.c
71+
@@ -212,8 +212,8 @@ void set_defaults(void)
72+
enable_drc = 1;
73+
use_srm = 0;
74+
audio_buffer_size = 5;
75+
- scale_size = SCALE_SIZE_NONE;
76+
- scale_filter = SCALE_FILTER_NEAREST;
77+
+ scale_size = SCALE_SIZE_FULL;
78+
+ scale_filter = SCALE_FILTER_SMOOTH;
79+
80+
/* Sets better defaults for small screen */
81+
if (SCREEN_WIDTH == 240) {
82+
diff --git a/menu.c b/menu.c
83+
index 1d68619..4c0cf38 100644
84+
--- a/menu.c
85+
+++ b/menu.c
86+
@@ -556,10 +556,10 @@ static const char h_audio_buffer_size[] =
87+
"crackling at the cost of delayed sound.";
88+
89+
static const char h_scale_size[] =
90+
- "How to fill the display. Native does\n"
91+
- "no stretching. Aspect keeps the correct\n"
92+
- "aspect ratio. Full uses the whole\n"
93+
- "screen. Crop hides pixels on the sides.";
94+
+ "How to fill the display. Scaled keeps\n"
95+
+ "the correct aspect ratio. Stretched\n"
96+
+ "uses the whole screen. Native does\n"
97+
+ "no stretching.";
98+
99+
static const char h_scale_filter[] =
100+
"When stretching, how missing pixels\n"
101+
@@ -573,7 +573,7 @@ static const char h_use_srm[] =
102+
"retroarch saves. Save file compression\n"
103+
"needs to be off in retroarch.";
104+
105+
-static const char *men_scale_size[] = { "Native", "Aspect", "Full", "Crop", NULL};
106+
+static const char *men_scale_size[] = { "Scaled", "Stretched", "Native", NULL};
107+
#endif
108+
109+
static const char *men_scale_filter[] = { "Nearest", "Sharp", "Smooth", NULL};
110+
diff --git a/scale.c b/scale.c
111+
index 5857589..a7186bf 100644
112+
--- a/scale.c
113+
+++ b/scale.c
114+
@@ -479,8 +487,8 @@ static void scale_select_scaler(unsigned w, unsigned h, size_t pitch) {
115+
dst_w = SCREEN_WIDTH;
116+
dst_h = SCREEN_HEIGHT;
117+
dst_offs = 0;
118+
- } else if (scale_size == SCALE_SIZE_ASPECT ||
119+
- (scale_size == SCALE_SIZE_NONE && (w > SCREEN_WIDTH || h > SCREEN_HEIGHT))) {
120+
+ } else if (scale_size == SCALE_SIZE_ASPECT/* ||
121+
+ (scale_size == SCALE_SIZE_NONE && (w > SCREEN_WIDTH || h > SCREEN_HEIGHT))*/) {
122+
dst_w = SCREEN_WIDTH;
123+
dst_h = SCREEN_WIDTH / current_aspect_ratio + 0.5;
124+
dst_offs = ((SCREEN_HEIGHT-dst_h)/2) * SCREEN_PITCH;
125+
@@ -490,7 +498,7 @@ static void scale_select_scaler(unsigned w, unsigned h, size_t pitch) {
126+
dst_h = SCREEN_HEIGHT;
127+
dst_offs = ((SCREEN_WIDTH-dst_w)/2) * SCREEN_BPP;
128+
}
129+
- } else if (scale_size == SCALE_SIZE_NONE) {
130+
+ /*} else if (scale_size == SCALE_SIZE_NONE) {
131+
unsigned dst_x = ((SCREEN_WIDTH - w) * SCREEN_BPP / 2);
132+
unsigned dst_y = ((SCREEN_HEIGHT - h) / 2);
133+
dst_offs = dst_y * SCREEN_PITCH + dst_x;
134+
@@ -501,7 +509,7 @@ static void scale_select_scaler(unsigned w, unsigned h, size_t pitch) {
135+
scaler = scale_1x;
136+
}
137+
138+
- return;
139+
+ return;*/
140+
}
141+
142+
if (!scaler && w == 160 && h == 144) {
143+
diff --git a/scale.h b/scale.h
144+
index fe02d92..fb0ce14 100644
145+
--- a/scale.h
146+
+++ b/scale.h
147+
@@ -18,7 +18,7 @@
148+
#define SCREEN_PITCH (SCREEN_BPP * SCREEN_WIDTH)
149+
150+
enum scale_size {
151+
- SCALE_SIZE_NONE,
152+
+ //SCALE_SIZE_NONE,
153+
SCALE_SIZE_ASPECT,
154+
SCALE_SIZE_FULL,
155+
SCALE_SIZE_CROP,

0 commit comments

Comments
 (0)