Exactly. The IPU automatically scales whatever screen resolution you throw at it. Of course if you set the screen resolution to 320x240, it wont scale anything for obvious reasons.
Lets say you want to scale a 256x224 screen: Then you simply do:
screen = SDL_SetVideoMode(256, 224, 16, SDL_HWSURFACE | SDL_DOUBLEBUF);
or if you want to use triple buffering (which is actually recommended to do):
screen = SDL_SetVideoMode(256, 224, 16, SDL_HWSURFACE | SDL_TRIPLEBUF);
Aditionally, you can also force the IPU to keep the aspect ratio when scaling, or force it to stretch to full screen.
By default it is set to keep the aspect ratio. You can alternate the modes by pressing power+A, but i found it painful to have to use that every time you start a new game, so you can make 2 different scalers (an "aspect ratio" one, and a "fullscreen" one) selectable from the emulator menu:
if (aspect_ratio_scaling)
{
FILE* aspect_ratio_file = fopen("/sys/devices/platform/jz-lcd.0/keep_aspect_ratio", "w");
if (aspect_ratio_file)
{
fwrite("1", 1, 1, aspect_ratio_file);
fclose(aspect_ratio_file);
}
}
if (fullscreen_scaling)
{
FILE* aspect_ratio_file = fopen("/sys/devices/platform/jz-lcd.0/keep_aspect_ratio", "w");
if (aspect_ratio_file)
{
fwrite("0", 1, 1, aspect_ratio_file);
fclose(aspect_ratio_file);
}
}
Also, if you need the IPU to use downscaling at any point (in the case of MAME, you will need it at least for CPS games), you must reflect that in the .desktop file which comes packed into the OPK, by adding the following line in the .desktop file:
X-OD-NeedsDownscaling=true