Open discussions on programming specifically for the PS Vita.
Forum rules: Forum rule Nº 15 is strictly enforced in this subforum.
#417818 by domis4
Fri Apr 14, 2017 5:18 pm
Hello everyone,

i tried to get in touch with c++ for the first time and used one of the vitasdk samples in order to create some basic SDL2 application. Currently, i can't get past image loading using SDL2_image, as the image format is always unsupported no matter what format and properties i use (png, jpg, bmp). The small code behind loading and rendering is:
Code: Select allSDL_Texture* image = IMG_LoadTexture(gRenderer, path.c_str()); ... module.cpp
which throws
Code: Select allUnsupported image format

and results in an application crash due to texture nullpointer in SDL_RenderCopy().

After some research i thought to include libpng and zlib headers and use IMG_init(flags), but the application still throws and crashes.

Maybe a experienced Dev can see my mistake.
#417819 by noname120
Fri Apr 14, 2017 9:05 pm
Your homebrew runs in safe mode, this means that it can only access ux0:data/* and ux0:app/YOURTITLEID/*.

If you're willing to embed resources in your app, add them here: ... ts.txt#L49
#417824 by domis4
Sat Apr 15, 2017 8:52 am
thank you. This should have crossed my mind sooner. I wasn't too sure how i'd embed my assets.

While including it with
Code: Select allFILE src/assets/test.png assets/test.png
worked like a charm and is totally fine for me, the file got installed to ux0:/app/ap-id/assets/test.png but It still throws Unsupported Image format using either

i figured, that even a wrong path specified to either of those dirs would throw "unsuported image format" while a completely different, wrong directory would throw "could not open file". Besides that, i'm still a bit worried why it would let me write to "ux0:domis4/log.txt" in safe mode.
#417829 by noname120
Sat Apr 15, 2017 2:13 pm
Strange. I don't have much experience with SDL2, you should probably ask xerpi on

By the way, you should change your VITA_TITLEID because "VSDK00013" is already used by a Vita sample.
#420373 by nop90
Sun Oct 15, 2017 8:48 pm
This post is some months old, but I startes coding for the vita only a couple of weeks ago, and I had the same problem. Since no one answered to the problem, reporting the solution could be of help to other developers.

I found that SDL2_Image is compiled without the flags that enable the supported file formats, this maked that lib useless.

Adding that flags (-DLOAD_BMP -DLOAD_GIF -DLOAD_LBM -DLOAD_PCX -DLOAD_PNM -DLOAD_TGA -DLOAD_XCF -DLOAD_XPM -DLOAD_XV -DLOAD_JPG -DLOAD_PNG) and compiling again the lib solved the problem.

Hope this helps.
#420385 by noname120
Tue Oct 17, 2017 2:36 am
Feel free to make a pull request here with modified compilations params: ... SDL2_image

The change will then make its way to the sdk.
#420933 by Red-j
Thu Nov 30, 2017 8:54 am
Hi all I have try to use png but with no luck. I have compiled with new library but it doesn't work for me :(
I have replace the lib.a with the new file.
anyone can explain or show is cmakelist and explaine which includes used in their main.c
I have try to include png.h in my main.c and png flag in cmakelist
Best regards

Who is online

Users browsing this forum: No registered users and 5 guests