Author Topic: Turn off IPU downscaling in-game?  (Read 1668 times)

David Knight (OP)

  • Posts: 577
Turn off IPU downscaling in-game?
« on: February 01, 2015, 12:43:47 pm »
Handy currently uses the IPU to upscale from 160x102 to 320x204.

The problem is when I change resolution to 320x240 (eg for the menu) you only see the top left quadrant of the screen upscaled to 320x204.

Is there anyway to communicate with the IPU to toggle upscaling on or off with SDL/C/C++ whilst a programme is running?

I am aware the upscale setting is stored in /sys/devices/platform/jz-lcd.0/allow_downscaling. Changing this value to zero in game doesn't alter the scaling, it's still switched on (I am aware not to do this in a release version but I was just testing this).

pcercuei

  • Posts: 1689
    • My devblog
Re: Turn off IPU downscaling in-game?
« Reply #1 on: February 01, 2015, 12:57:07 pm »
The bug is in your code. PocketSNES and ReGBA switch between resolutions when opening the menu, without problems.

David Knight (OP)

  • Posts: 577
Re: Turn off IPU downscaling in-game?
« Reply #2 on: February 01, 2015, 01:08:30 pm »
Yeah, just realised the problem, it works fine now.

hi-ban

  • Posts: 889
Re: Turn off IPU downscaling in-game?
« Reply #3 on: February 01, 2015, 01:20:07 pm »
The IPU works automatically, always.
When you change the video mode and request any resolution, the IPU always scales the screen.

Code: [Select]
screen = SDL_SetVideoMode(160, 102, 16, SDL_HWSURFACE | SDL_DOUBLEBUF);
Here i requested the screen resolution to be 160x102. Then, the IPU will automatically scale it to fill the GCW's 320x240 screen (keeping the aspect ratio). No need to do anything else, other than blitting the appropiate (160x102) images/areas to the screen (because at this point we are working at 160x102, not at 320x240).
Of course, if i do this:
Code: [Select]
screen = SDL_SetVideoMode(320, 240, 16, SDL_HWSURFACE | SDL_DOUBLEBUF);then, no scaling will be applied because 320x240 is the same resolution as GCW's 320x240 screen.

In your case, it seems that, after returning to 320x240 mode, you are still blitting a smaller 160x102 area to your screen surface. You probably made a SDL_Rect with x=160 and y=102 for blitting into the smaller screen surface, and you forgot that, after returning to 320x240, you should return to a 320x240-sized SDL_Rect.

The /sys/devices/platform/jz-lcd.0/allow_downscaling setting is not needed for your emulator. That's only needed for apps which work at a higher resolution than 320x240. Handy only changes to lower resolutions, so that is not needed at all.

David Knight (OP)

  • Posts: 577
Re: Turn off IPU downscaling in-game?
« Reply #4 on: February 01, 2015, 01:24:39 pm »
I misunderstood and thought the setting was for both upscaling and downscaling.

I had forgotten to change the video resolution, only the surfaces!

Thanks for the help.

 

Post a new topic