+void platform_apply_config(void)
+{
+ static int prev_cpuclock = 200, prev_gamma = 100, prev_vsync = 0, prev_pal = 0;
+ if (Settings.cpuclock != 0 && Settings.cpuclock != prev_cpuclock)
+ {
+ set_FCLK(Settings.cpuclock);
+ prev_cpuclock = Settings.cpuclock;
+ }
+
+ if (Settings.gamma != 0 && Settings.gamma != prev_gamma)
+ {
+ set_gamma(Settings.gamma);
+ prev_gamma = Settings.gamma;
+ }
+
+ if (Settings.perfect_vsync != prev_vsync || (Settings.perfect_vsync && prev_pal != PAL))
+ {
+ if (Settings.perfect_vsync)
+ {
+ set_LCD_custom_rate(PAL ? LCDR_100_02 : LCDR_120_20);
+ prev_pal = PAL;
+ }
+ else
+ {
+ unset_LCD_custom_rate();
+ }
+ prev_vsync = Settings.perfect_vsync;
+ }
+
+ gp2x_video_changemode(Settings.scaling == 3 ? 15 : 8);
+ switch (Settings.scaling & 3) {
+ case 0: gp2x_video_set_offs(0); gp2x_video_RGB_setscaling(320, 240); break;
+ case 1: gp2x_video_set_offs(32); gp2x_video_RGB_setscaling(256, 240); break;
+ case 2: gp2x_video_set_offs(32+srendline*320); gp2x_video_RGB_setscaling(256, erendline-srendline); break;
+ case 3: gp2x_video_set_offs(32); gp2x_video_RGB_setscaling(320, 240); break;
+ }
+}
+
+