Zeige Ergebnis 10.141 bis 10.170 von 10174
C/C++ Programming Help Thread
This is a discussion on C/C++ Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; Nvm got it fixed...
-
07-22-2010, 10:17 AM #10141QJ Gamer Green
- Registriert seit
- May 2008
- Beiträge
- 96
- Points
- 3.008
- Level
- 33
- Downloads
- 0
- Uploads
- 0
Nvm got it fixed
Geändert von Predricted (07-26-2010 um 07:10 PM Uhr)
-
08-17-2010, 10:57 AM #10142QJ Gamer Green
- Registriert seit
- Mar 2009
- Beiträge
- 48
- Points
- 2.521
- Level
- 30
- Downloads
- 0
- Uploads
- 0
Zip-support
Hi!
I would like to add a zip-support for my homebrew. Would anyone be able to give me a clear tutorial how to do this. I know that xreader uses unzip.h file to provide the zip-support. I might be able to figure this out by studying the source, but your help would be much appreciated.
First, I need to open a zip file from a specific folder. Then check whether an image file exist. If it does exist, I need to store the image using oslLoadImageFilePNG command. Finally, I am going to draw the image with oslDrawImage command.
I know how to draw the image and store an image that has not been zipped. But how do I get to the point to store the image from the zip?
-
08-17-2010, 12:00 PM #10143Developer
- Registriert seit
- Jul 2008
- Ort
- Grand Rapids! MI
- Beiträge
- 125
- Points
- 8.092
- Level
- 60
- Downloads
- 5
- Uploads
- 2
batanen i would use the unzip lib i believe it comes with its own example code
-
08-18-2010, 08:52 AM #10144QJ Gamer Green
- Registriert seit
- Mar 2009
- Beiträge
- 48
- Points
- 2.521
- Level
- 30
- Downloads
- 0
- Uploads
- 0
Ok. Yes, Ruka had done some zip library. I quickly glanced it but I don't think it fits my purposes. I guess I will leave zip support out; it's not that necessary and I don't have much free time to do additional features. It will just take some time to move those 6000 images... Though, I know the kind of zip support I am looking for is possible (Wagic and Xreader has it integrated).
-
08-18-2010, 11:59 AM #10145Developer
- Registriert seit
- Jul 2008
- Ort
- Grand Rapids! MI
- Beiträge
- 125
- Points
- 8.092
- Level
- 60
- Downloads
- 5
- Uploads
- 2
What kind do you need? also i believe there is more then one unzip lib
-
08-18-2010, 08:00 PM #10146QJ Gamer Green
- Registriert seit
- Mar 2009
- Beiträge
- 48
- Points
- 2.521
- Level
- 30
- Downloads
- 0
- Uploads
- 0
Thanks for the help. I think I described the situation earlier, but here it's a little more clearly:
- There exist a zip file that has 6000 images.
- I need to open that zip file temporarily.
- Then I want to locate a specific image (named like 4A35) from the zip-file.
- If it does exist, I want to store that image using oslLoadImageFilePNG.
- Then I'm going to close the zip file.
(- Finally, I am going to draw the image with olsDrawImage.)
I would have liked to have a working example code how to accomplish this.
Yes, you're right. There exist more than one zip library. Xreader uses something different; and I am sure it would have fit my purposes. Unfortunately, I could not find a direct example for my purpose from the file nor internet; and I did not have enough time to study the sources and looking into library dependies. But that's ok. For now, I decided to drop that feature out. It will take 10-15 minutes to transfer all the files to PSP, but well...
-
08-18-2010, 08:05 PM #10147Developer
- Registriert seit
- Jul 2008
- Ort
- Grand Rapids! MI
- Beiträge
- 125
- Points
- 8.092
- Level
- 60
- Downloads
- 5
- Uploads
- 2
if im not mistaken you have to take the file out of the zip file and save it to the mem stick before you can use it in osl cause its gonna read the image from the mem stick
i get what your saying it doesnt seem that hard to do its just the zipped part that seems like its throwing you off why not just take the image out the zip on your comp and just putting it with your app?
-
08-19-2010, 08:28 AM #10148QJ Gamer Green
- Registriert seit
- Mar 2009
- Beiträge
- 48
- Points
- 2.521
- Level
- 30
- Downloads
- 0
- Uploads
- 0
It may be true that Oslib does not support the idea I had in mind. Probably I would have needed to use another method that is capable of showing an image from a buffer. That can be done somehow (just not with Oslib), I am sure of it.
For simplicity, I decided to release PSPedict V0.6 without the zip support; all images are unzipped.
-
08-19-2010, 11:58 AM #10149Developer
- Registriert seit
- Jul 2008
- Ort
- Grand Rapids! MI
- Beiträge
- 125
- Points
- 8.092
- Level
- 60
- Downloads
- 5
- Uploads
- 2
-
09-23-2010, 11:45 AM #10150QJ Gamer Green
- Registriert seit
- Mar 2010
- Ort
- America
- Beiträge
- 402
- Points
- 5.956
- Level
- 50
- My Mood
-
- Downloads
- 11
- Uploads
- 3
Need help with a plugin.
I am working on Andromida R5 and i want a function to show your WLAN is on.
but it wont compile?
I have everything typed right even have #include <pspwlan.h>?
(ALSO - printf is defined as 'pspDebugScreenKprintf')
EXAMPLE.
printf("WLAN: ");
if (sceWlanGetSwitchState() == 0)
{
printf("OFF");
}else if (sceWlanGetSwitchState() == 1)
{
printf("ON");
}Geändert von CODE_R3D (11-09-2010 um 04:56 AM Uhr)
-
09-24-2010, 08:20 AM #10151QJ Gamer Gold

- Registriert seit
- Nov 2008
- Ort
- CAD
- Beiträge
- 693
- Points
- 13.372
- Level
- 75
- Downloads
- 19
- Uploads
- 4
Code:printf("WLAN: %s", sceWlanGetSwitchState() == 0 ? "OFF" : "ON");Spoiler for the harsh truth:Geändert von mootjeuh (09-29-2010 um 06:21 AM Uhr)
That epic dude.
-
09-27-2010, 03:53 AM #10152QJ Gamer Green
- Registriert seit
- Mar 2010
- Ort
- America
- Beiträge
- 402
- Points
- 5.956
- Level
- 50
- My Mood
-
- Downloads
- 11
- Uploads
- 3
thanks for the help.
-
11-06-2010, 04:59 PM #10153Developer

- Registriert seit
- Feb 2006
- Ort
- Norway
- Beiträge
- 384
- Points
- 5.359
- Level
- 47
- Downloads
- 0
- Uploads
- 0
Hi,
I'm trying to compile a program that uses the boost::shared_ptr class. I'm compiling using MINPSPW and include boost/shared_ptr.hpp.
I get the following error:
(.text+0xe80): undefined reference to `boost::throw_exception(s td::exception const&)'
Does anyone have any idea how to fix this? I'm guessing I probably need to add a library to my makefile, but I can't figure out which.
Any advice would be much appreciated.
-
01-15-2011, 02:43 AM #10154QJ Gamer Green
- Registriert seit
- Jun 2009
- Beiträge
- 61
- Points
- 2.003
- Level
- 27
- Downloads
- 0
- Uploads
- 0
Hi i was looking for some way to view the FW/CFW versio (not kernel version(like 6xx) but the real name like 5.00m33) Could someone help me please?
-
05-28-2011, 06:49 PM #10155
- Registriert seit
- May 2011
- Ort
- usa
- Beiträge
- 3
- Points
- 400
- Level
- 7
- Downloads
- 0
- Uploads
- 0
I think I have this stupid problem
, I've been searching for hours and hours to figure out the solution .. and finally I'm just gonna write it here .. with hope to find a solution :
when I debug my psp program using Code::Blocks and Minimalist PSPSDK, the following error comes :
my source code is :Code:main.c|| undefined reference to `initGraphics'| main.c|| undefined reference to `loadImage'| main.c|| undefined reference to `blitAlphaImageToScreen'| main.c|| undefined reference to `flipScreen'| ||=== Build finished: 4 errors, 0 warnings ===|
and my makefile is :Code:#include <pspkernel.h> #include <pspdebug.h> #include <pspcallbacks.h> #include "graphics.h" #define printf pspDebugScreenPrintf PSP_MODULE_INFO("Hello World", 0, 1, 1); int main() { SetupCallbacks(); initGraphics(); Image* background = loadImage("ourImage.png"); blitAlphaImageToScreen(0,0,480,272,background,0,0); flipScreen(); sceKernelSleepThread(); return 0; }
the graphics.h and the other files that comes with it (lesson04.zip) are in the right folder , and I think everything is right , but I don't know nothing about that problem and where it comes from .Code:TARGET = image OBJS = main.o graphics.o framebuffer.o CFLAGS = -O2 -G0 -Wall CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti ASFLAGS = $(CFLAGS) BUILD_PRX=1 LIBS = -lpspgu -lpng -lz -lm EXTRA_TARGETS = EBOOT.PBP PSP_EBOOT_TITLE = Image Example PSPSDK=$(shell psp-config --pspsdk-path) include $(PSPSDK)/lib/build.mak
if there is no hope in solving this problem , is there a better graphics library
than this one (graphics.h) ??
-
05-29-2011, 04:13 AM #10156Developer
- Registriert seit
- Jul 2008
- Ort
- Grand Rapids! MI
- Beiträge
- 125
- Points
- 8.092
- Level
- 60
- Downloads
- 5
- Uploads
- 2
if thats your whole code then you should also get an error for the "SetupCallbacks();" thats one problem
another is you didnt follow the tut close enough (if you are talking about lesson 4 from the tuts on psp-programming.com)
the main.c should look like this (from that tut):
and of course the Makefile:Code:#include <pspdisplay.h> #include <pspctrl.h> #include <pspkernel.h> #include <pspdebug.h> #include <pspgu.h> #include <png.h> #include <stdio.h> #include "graphics.h" #define printf pspDebugScreenPrintf #define MAX(X, Y) ((X) > (Y) ? (X) : (Y)) PSP_MODULE_INFO("Image Display Program", 0, 1, 1); /* Exit callback */ int exit_callback(int arg1, int arg2, void *common) { sceKernelExitGame(); return 0; } /* Callback thread */ int CallbackThread(SceSize args, void *argp) { int cbid; cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL); sceKernelRegisterExitCallback(cbid); sceKernelSleepThreadCB(); return 0; } /* Sets up the callback thread and returns its thread id */ int SetupCallbacks(void) { int thid = 0; thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0); if(thid >= 0) { sceKernelStartThread(thid, 0, 0); } return thid; } int main() { char buffer[200]; Image* ourImage; pspDebugScreenInit(); SetupCallbacks(); initGraphics(); sprintf(buffer, "ourImage.png"); ourImage = loadImage(buffer); if (!ourImage) { //Image load failed printf("Image load failed!\n"); } else { int x = 0; int y = 0; sceDisplayWaitVblankStart(); while (x < 480) { while (y < 272) { blitAlphaImageToScreen(0 ,0 ,32 , 32, ourImage, x, y); y += 32; } x += 32; y = 0; } flipScreen(); } sceKernelSleepThread(); return 0; }
In the main.c you can see they are very different. but my question is do you have the graphics.c, .h, and the framebuffer.c, .h in the same folder as your source with the main.c? And what tut are you following?Code:TARGET = hello OBJS = main.o graphics.o framebuffer.o CFLAGS = -O2 -G0 -Wall CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti ASFLAGS = $(CFLAGS) LIBDIR = LIBS = -lpspgu -lpng -lz -lm LDFLAGS = EXTRA_TARGETS = EBOOT.PBP PSP_EBOOT_TITLE = Image Example PSPSDK=$(shell psp-config --pspsdk-path) include $(PSPSDK)/lib/build.mak
-
05-29-2011, 08:07 AM #10157
- Registriert seit
- May 2011
- Ort
- usa
- Beiträge
- 3
- Points
- 400
- Level
- 7
- Downloads
- 0
- Uploads
- 0
yes I have them in the same folder .
I'm following this one ( [TUT] Beginner C Programming Tutorials ) .
also I have other question . is it ok to debug using code::blocks ??
one more thing , since I'm using Minimalist PSPSDK I have no idea how to use subversion and download the zlib and pnglib
but when I search in my include and lib folder I found them there .
I just copied your code to my main.c and the same problem happened with the same error !!!!!Geändert von virus7 (05-29-2011 um 08:18 AM Uhr)
-
08-09-2011, 05:27 PM #10158
- Registriert seit
- Jul 2011
- Ort
- Pluto
- Beiträge
- 11
- Points
- 246
- Level
- 4
- Downloads
- 0
- Uploads
- 0
Is there a comprehensive guide where to start about coding for PSP?
I am a programmer and excellent on C but I need a guide how to start with coding for PSP
If someone can shed a light what tools to use etc.
-
08-10-2011, 05:16 AM #10159Developer
- Registriert seit
- Jul 2008
- Ort
- Grand Rapids! MI
- Beiträge
- 125
- Points
- 8.092
- Level
- 60
- Downloads
- 5
- Uploads
- 2
-
04-17-2012, 06:26 AM #10160
- Registriert seit
- Apr 2012
- Ort
- Italy
- Beiträge
- 8
- Points
- 133
- Level
- 2
- Downloads
- 0
- Uploads
- 0
i'm working on min sdk jetdrone and i have installed only OSLib.
i'm trying to create a homebrew that extract the iso game file from the umd to the memory stick.
when i start the homebrew it give me error.
he doesn't finds the disc0: directory.
Have anyone the correct code for extract an iso from umd and save it to the memory stick?
-
04-18-2012, 04:11 AM #10161Developer
- Registriert seit
- Jul 2008
- Ort
- Grand Rapids! MI
- Beiträge
- 125
- Points
- 8.092
- Level
- 60
- Downloads
- 5
- Uploads
- 2
what does your code look like right now? also are you putting your brew in user mode or kernel mode?
when you call to the umd it should look something like this
Code:int fd; fd = sceIoOpen("disc0:/PSP_GAME", PSP_O_RDONLY, 0777); if (fd <= 0) { //return error } else { //make me a cheeseburger } sceClose(fd);
-
04-18-2012, 05:40 AM #10162
- Registriert seit
- Apr 2012
- Ort
- Italy
- Beiträge
- 8
- Points
- 133
- Level
- 2
- Downloads
- 0
- Uploads
- 0
i don't know how to post code:
he says "you must have 999 posts in order to post links"
-
04-19-2012, 04:45 AM #10163Developer
- Registriert seit
- Jul 2008
- Ort
- Grand Rapids! MI
- Beiträge
- 125
- Points
- 8.092
- Level
- 60
- Downloads
- 5
- Uploads
- 2
-
04-19-2012, 07:41 AM #10164
- Registriert seit
- Apr 2012
- Ort
- Italy
- Beiträge
- 8
- Points
- 133
- Level
- 2
- Downloads
- 0
- Uploads
- 0
I have attached my actually code, because i couldn't use [ CODE ] [ / CODE ] because he gives me error of link.
The homebrew should copy the iso game file from umd to memory stick.
I don't know the difference between user mode or kernel mode.
-
04-19-2012, 08:27 AM #10165Developer
- Registriert seit
- Jul 2008
- Ort
- Grand Rapids! MI
- Beiträge
- 125
- Points
- 8.092
- Level
- 60
- Downloads
- 5
- Uploads
- 2
you were close but it just seemed odd but here is your code with some adjustments i have highlighted in red
try that and then let me know but for a few explinations to what i changed and why. i put your vars in one nice bunch cause idk im ocd i guess. i noticed you didnt have your callbacks set up properly so i put them in for you. i put sceumdCheckMedium(); outside the if statment and had it referenced to by a var. i changed the first sceUmdWaitDriveStat(); value from "UMD_WAITFORDISC" to "PSP_UMD_PRESENT" because thats how its shown in the example in the pspumd.h file and the second one from "UMD_WAITFORINIT" to "PSP_UMD_READY" and the same reason as the first also it seems all the vars have the "PSP_" prefix so it just seemed right. i added one second delays (the sceKernelDelayThread(1000 000); //wait one second please) for where it cheacks your umd so it dosent go to fast and gives you time to put the umd in. i changed umd = sceIoOpen("umd0:", PSP_O_RDONLY, 0777); to umd = sceIoOpen("disc0:", PSP_O_RDONLY, 0777); cause the psp doesnt know what umd0 is its not allocated anywhere on the system. other then that it looks ok. i have added your new file please take a look and see what was changedCode:#include <pspkernel.h> #include <pspcallbacks.h> #include <pspumd.h> #include <stdlib.h> #include <string.h> #include <stdio.h> #include <pspdebug.h> #include <pspdisplay.h> #include <pspiofilemgr.h> #define printf pspDebugScreenPrintf PSP_MODULE_INFO("Save and Load Test", 0, 1, 1); //Global Vars int read, fd, umdsize, dir, umd, iso; char umdbuffer[1048576],isopath[25]; /* Exit callback old fasion */ int exit_callback(int arg1, int arg2, void *common) { sceKernelExitGame(); return 0; } /* Callback thread */ int CallbackThread(SceSize args, void *argp) { int cbid; cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL); sceKernelRegisterExitCallback(cbid); sceKernelSleepThreadCB(); return 0; } /* Sets up the callback thread and returns its thread id */ int SetupCallbacks(void) { int thid = 0; thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0); if(thid >= 0) { sceKernelStartThread(thid, 0, 0); } return thid; } int main(){ pspDebugScreenInit(); int jew; jew = sceumdCheckMedium(); if(jew == 0) { printf("Insert umd!"); sceUmdWaitDriveStat(PSP_UMD_PRESENT); sceKernelDelayThread(1000000); //wait one second please } else { printf("Umd detected!"); sceUmdActivate(1, "disc0:"); sceUmdWaitDriveStat(PSP_UMD_READY); sceKernelDelayThread(1000000); //wait one second please printf("umd ready!"); fd = sceIoOpen("umd0:", PSP_O_RDONLY, 0777); if(fd >= 0){ umdsize=sceIoLseek(fd,0,SEEK_END); sceIoClose(fd); } printf("Size: %l",umdsize); umd = sceIoOpen("disc0:", PSP_O_RDONLY, 0777); if(umd<0){ printf("Impossible to open umd.."); sceKernelDelayThread(1000000); //wait one second please } dir = sceIoDopen("ms0:/ISO/"); if(dir < 0){ sceIoMkdir("ms0:/ISO",0777); } sprintf(isopath, "ms0:/ISO/game.iso"); iso= sceIoOpen(isopath, PSP_O_WRONLY| PSP_O_CREAT | PSP_O_TRUNC, 0777); if(iso<0){ printf("Impossible to access the ms.."); } read=sceIoRead(umd, umdbuffer,512); sceIoWrite(iso, umdbuffer, read * 2048); } sceKernelSleepThread(); return 0; }
-
04-19-2012, 09:51 AM #10166
- Registriert seit
- Apr 2012
- Ort
- Italy
- Beiträge
- 8
- Points
- 133
- Level
- 2
- Downloads
- 0
- Uploads
- 0
it doesn't works.
the brew detected my umd, printed the text "umd detected" and nothing other.
another question how can i get the current date in my brew?
-
04-21-2012, 04:42 AM #10167Developer
- Registriert seit
- Jul 2008
- Ort
- Grand Rapids! MI
- Beiträge
- 125
- Points
- 8.092
- Level
- 60
- Downloads
- 5
- Uploads
- 2
oh i see where i myself messed up
sorry for the mess up and the late reply its been a busy couple of mornings lol.Code:#include <pspkernel.h> #include <pspcallbacks.h> #include <pspumd.h> #include <stdlib.h> #include <string.h> #include <stdio.h> #include <pspdebug.h> #include <pspdisplay.h> #include <pspiofilemgr.h> #define printf pspDebugScreenPrintf PSP_MODULE_INFO("Save and Load Test", 0, 1, 1); //Global Vars ]int read, fd, umdsize, dir, umd, iso;[/COLOR] char umdbuffer[1048576],isopath[25]; /* Exit callback */ int exit_callback(int arg1, int arg2, void *common) { sceKernelExitGame(); return 0; } /* Callback thread */ int CallbackThread(SceSize args, void *argp) { int cbid; cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL); sceKernelRegisterExitCallback(cbid); sceKernelSleepThreadCB(); return 0; } /* Sets up the callback thread and returns its thread id */ int SetupCallbacks(void) { int thid = 0; thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0); if(thid >= 0) { sceKernelStartThread(thid, 0, 0); } return thid; } int main(){ pspDebugScreenInit(); int jew; jew = sceumdCheckMedium(); if(jew == 0) { printf("Insert umd!"); sceUmdWaitDriveStat(PSP_UMD_PRESENT); sceKernelDelayThread(1000000); //wait one second please } else { printf("Umd detected!"); sceUmdActivate(1, "disc0:"); sceUmdWaitDriveStat(PSP_UMD_READY); sceKernelDelayThread(1000000); //wait one second please printf("umd ready!"); fd = sceIoOpen("disc0:", PSP_O_RDONLY, 0777); if(fd >= 0){ umdsize=sceIoLseek(fd,0,SEEK_END); sceIoClose(fd); } printf("Size: %l",umdsize); umd = sceIoOpen("disc0:", PSP_O_RDONLY, 0777); if(umd<0){ printf("Impossible to open umd.."); sceKernelDelayThread(1000000); //wait one second please } dir = sceIoDopen("ms0:/ISO/"); if(dir < 0){ sceIoMkdir("ms0:/ISO",0777); } sprintf(isopath, "ms0:/ISO/game.iso"); iso= sceIoOpen(isopath, PSP_O_WRONLY| PSP_O_CREAT | PSP_O_TRUNC, 0777); if(iso<0){ printf("Impossible to access the ms.."); } read=sceIoRead(umd, umdbuffer,512); sceIoWrite(iso, umdbuffer, read * 2048); } sceKernelSleepThread(); return 0; }
but as of right now idk how to show the time but im sure there is something in one of the sdk that can help you ill even look cause i my self wanna know lol
i actually didnt cnhange where it tried to open umd0 instead of disc0 so the app was getting confused and most likely froze or crash. edits marked in red (the right one this time lol) and the new attachment is also updated
try that
-
04-22-2012, 06:27 AM #10168
- Registriert seit
- Apr 2012
- Ort
- Italy
- Beiträge
- 8
- Points
- 133
- Level
- 2
- Downloads
- 0
- Uploads
- 0
ok i tried the code.
the psp stopped working on sceUmdActivate.
i don't know why
-
04-22-2012, 06:02 PM #10169Developer
- Registriert seit
- Jul 2008
- Ort
- Grand Rapids! MI
- Beiträge
- 125
- Points
- 8.092
- Level
- 60
- Downloads
- 5
- Uploads
- 2
-
04-23-2012, 03:05 AM #10170
- Registriert seit
- Apr 2012
- Ort
- Italy
- Beiträge
- 8
- Points
- 133
- Level
- 2
- Downloads
- 0
- Uploads
- 0
just hangs there.


LinkBack URL
About LinkBacks
Mit Zitat antworten

Hello everyone I am new here and I am glad to be part of this amazing community and I think there...
New to forum