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; Depends if you have enabled double buffering or not. Code: void oslInitGfx(int pixelFormat, int bDoubleBuffer); 0 for single or 1 ...
-
08-17-2008, 11:31 PM #8911QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
Depends if you have enabled double buffering or not.
0 for single or 1 four double buffering for bDoubleBufferCode:void oslInitGfx(int pixelFormat, int bDoubleBuffer);
-
08-18-2008, 01:39 AM #8912QJ Gamer Blue
- Registriert seit
- Dec 2007
- Ort
- Netherlands
- Beiträge
- 148
- Points
- 5.672
- Level
- 48
- Downloads
- 0
- Uploads
- 0
Hi,
I want to print an image onto my screen this is my code:
Code:#include <pspdisplay.h> #include <pspctrl.h> #include <pspkernel.h> #include <pspdebug.h> #include <pspgu.h> #include <png.h> #include <stdio.h> #include "callbacks.h" #include "graphics.h" PSP_MODULE_INFO("ufosample", 0, 1, 1); //PSP_HEAP_SIZE_MAX(); #define printf pspDebugScreenPrintf #define MAX(X, Y) ((X) > (Y) ? (X) : (Y)) int ufoX = 0; int ufoY = 0; int main() { pspDebugScreenInit(); SetupCallbacks(); initGraphics(); Image *ufo; ufo = loadImage("ufo.png"); if(!ufo) { printf("You'r version of the sample is incomplete!"); sceKernelDelayThread(100000); sceKernelExitGame(); } else { sceDisplayWaitVblankStart(); blitAlphaImageToScreen(0 ,0 ,583 , 83, ufo, ufoX, ufoY); flipScreen(); } sceKernelSleepThread(); return 0; }But everytime i try it on my PSP it says thhe sample is incomplete.Code:TARGET = sample 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 = sample PSPSDK=$(shell psp-config --pspsdk-path) include $(PSPSDK)/lib/build.mak
But im sure my ufo.png is in the same directory as my eboot.pbp?
Can someone please help me?
:Punk:
-
08-18-2008, 07:20 AM #8913QJ Gamer Bronze
- Registriert seit
- May 2007
- Ort
- Ireland
- Beiträge
- 56
- Points
- 5.304
- Level
- 46
- Downloads
- 0
- Uploads
- 0
Try uncommenting PSP_HEAP_SIZE_MAX();
-
08-18-2008, 08:23 AM #8914QJ Gamer Blue
- Registriert seit
- Dec 2007
- Ort
- Netherlands
- Beiträge
- 148
- Points
- 5.672
- Level
- 48
- Downloads
- 0
- Uploads
- 0
Nope, don't work either.
[SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
[i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]
-
08-18-2008, 02:20 PM #8915I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
-
08-19-2008, 05:12 AM #8916QJ Gamer Blue
- Registriert seit
- Dec 2007
- Ort
- Netherlands
- Beiträge
- 148
- Points
- 5.672
- Level
- 48
- Downloads
- 0
- Uploads
- 0
Nope isn't interlaced :S
[SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
[i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]
-
08-19-2008, 05:44 AM #8917
Achievements:
- Registriert seit
- Aug 2008
- Beiträge
- 3
- Points
- 2.307
- Level
- 29
- Downloads
- 0
- Uploads
- 0
over my head lol
-
08-19-2008, 05:45 AM #8918Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
Is the 583 argument an error?Code:blitAlphaImageToScreen(0 ,0 ,583 , 83, ufo, ufoX, ufoY);
The maximum size of a texture you can load is 512x512 using graphics.c.
Check out my homebrew & C tutorials at http://insomniac.0x89.org/
Coder formerly known as Insomniac197
tshirtz: what is irshell ??
Atarian_: it's where people who work for the IRS go when they die
-
08-19-2008, 05:47 AM #8919QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
IWN! irc, NAO! have question
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
08-19-2008, 05:51 AM #8920QJ Gamer Blue
- Registriert seit
- Dec 2007
- Ort
- Netherlands
- Beiträge
- 148
- Points
- 5.672
- Level
- 48
- Downloads
- 0
- Uploads
- 0
Of course! forgot to scale my ufo down, but still doesn't work.
Arggg... going crazy![SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
[i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]
-
08-19-2008, 06:01 AM #8921Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0

Check out my homebrew & C tutorials at http://insomniac.0x89.org/
Coder formerly known as Insomniac197
tshirtz: what is irshell ??
Atarian_: it's where people who work for the IRS go when they die
-
08-19-2008, 06:14 AM #8922QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
ARG, alright guess i'll have to ask via forum
anywho, trying to get adhoc into one of my games, and i'm having a problem with sceNetAdhocctlAddHandler
it works fine under 4.01, and it had worked under 3.40, however one of my psp's is running 3.90 and it keeps returning error's1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
08-19-2008, 06:15 AM #8923Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
What's the error it returns?

Check out my homebrew & C tutorials at http://insomniac.0x89.org/
Coder formerly known as Insomniac197
tshirtz: what is irshell ??
Atarian_: it's where people who work for the IRS go when they die
-
08-19-2008, 06:20 AM #8924QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
it's returning < 0
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
08-19-2008, 06:27 AM #8925Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
Obviously ;)
The exact error number would help. Use 0x%08X as the format string for printf() or whatever.
Check out my homebrew & C tutorials at http://insomniac.0x89.org/
Coder formerly known as Insomniac197
tshirtz: what is irshell ??
Atarian_: it's where people who work for the IRS go when they die
-
08-19-2008, 06:31 AM #8926QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
0x8002013A
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
08-19-2008, 07:07 AM #8927Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
Helped on IRC after all ;)

Check out my homebrew & C tutorials at http://insomniac.0x89.org/
Coder formerly known as Insomniac197
tshirtz: what is irshell ??
Atarian_: it's where people who work for the IRS go when they die
-
08-19-2008, 08:26 AM #8928
Alright, I've been doing some research, and I can't seem to find out how to remap the buttons (ex. Analog up = triangle). If someone could tell me of a method of how to do it, which I'm pretty sure uses button masking, what are the values for the buttons, and would it be the same values as while looking at a memory editor, every game has a controller address. (ex. Square is 0x8000).
I gone and made that one power spoofer and that gay cheat device.
-
08-19-2008, 08:59 AM #8929
-- Code Monkey : Sarien, Fishguts, Cracks and Crevices --
"Did IQ's just drop sharply while I was away?" (Ripley)
-
08-19-2008, 09:16 AM #8930Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
You need to hook the button reading functions (sceCtrl*) and replace them with your own.
I'm not aware of your skill level, but it's not really a task for someone with little programming knowledge or who's not used to hooking functions.
Check out my homebrew & C tutorials at http://insomniac.0x89.org/
Coder formerly known as Insomniac197
tshirtz: what is irshell ??
Atarian_: it's where people who work for the IRS go when they die
-
08-19-2008, 09:20 AM #8931QJ Gamer Silver
- Registriert seit
- Sep 2006
- Ort
- Perth, Scotland
- Beiträge
- 1.094
- Points
- 8.475
- Level
- 62
- Downloads
- 0
- Uploads
- 0
-
08-19-2008, 08:29 PM #8932lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
I get that when I try to use pspDebugScreenPrintf()Code:crt0_prx.c:(.text+0x1f8): undefined reference to `pspDebugScreenPprintf'/usr/local/pspdev/psp/sdk/lib/libpspdebug.a(pspDebugScreenPrintf.o): In function `pspDebugScreenPrintf':/home/Owner/source/psptoolchain/build/pspsdk/src/debug/scr_printf.c:403: undefin ed reference to `vsnprintf'
That's how I used it.Code:pspDebugScreenPrintf("%-14s: %d%% (%02dh%02dm) \n", "Charge", scePowerGetBatteryLifePercent(), batteryLifeTime/60, batteryLifeTime-(batteryLifeTime/60*60));
-
08-19-2008, 08:33 PM #8933
I have the same exact problem. The only difference is that I'm trying to load up the psp's keyboard, yet it will not compile because of the printf errors. Same as QJ's,
-
08-19-2008, 09:56 PM #8934QJ Gamer Silver

- Registriert seit
- Jan 2006
- Ort
- Germany
- Beiträge
- 926
- Points
- 14.087
- Level
- 77
- Downloads
- 0
- Uploads
- 0
I guess you're linking against KERNEL_LIBC? In that case you can't use pspDebugScreenPrintf for the sole reason that it depends on vsnprintf from varargs, which isn't in kernel libc. You'd have to create a macro to wrap the variable arguments into a sprintf like that:
If you have lines that may exceed the 256 chars increase the buf.Code:#define pspDebugScreenPrintf(...) { char buf[256]; sprintf(buf,__VA_ARGS__); pspDebugScreenPuts( buf ); }Raphs board rules #31: Excessive use of punctuation is either a sign of a lesser ego or a small mind. Avoid it if you don't want to look like a total moron.
Raphs board rules #17: When you need to ask whether you are capable of doing something, you are not.
Raphs board rules #2: Exploits aren't found by changing version numbers, blindly merging data into a file or turning your PSP upside down.
Raphs board rules #1: If you have no clue how exploits work, don't come up with ideas about them.
-
08-19-2008, 10:04 PM #8935lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
Yea I was thanx alot for the help Rapheal.
-
08-19-2008, 11:44 PM #8936
So, in that conclusion, it would not be possible(or require a lot of bs) to load the sce keyboard...Ex.
because that whole thing is a printf whore.Code:pspDebugKbInit(buffer);
-
08-20-2008, 12:15 AM #8937QJ Gamer Silver

- Registriert seit
- Jan 2006
- Ort
- Germany
- Beiträge
- 926
- Points
- 14.087
- Level
- 77
- Downloads
- 0
- Uploads
- 0
You could recompile pspdebug.a with the macro I posted. With that it should work. Just don't define the macro inside scr_printf.c or pspdebug.h.
-=Double Post Merge =-
I just noticed, there's already a special kernel mode printf function in pspdebug:
pspDebugScreenKprintf
So Anti-Quickjay you can just use that function instead and NoEffex, you still have to recompile pspdebug, but can just put this define at the top of pspdebugkb.c:
Code:#define pspDebugScreenPrintf pspDebugScreenKprintf
Geändert von Raphael (08-20-2008 um 12:24 AM Uhr) Grund: Automerged Doublepost
Raphs board rules #31: Excessive use of punctuation is either a sign of a lesser ego or a small mind. Avoid it if you don't want to look like a total moron.
Raphs board rules #17: When you need to ask whether you are capable of doing something, you are not.
Raphs board rules #2: Exploits aren't found by changing version numbers, blindly merging data into a file or turning your PSP upside down.
Raphs board rules #1: If you have no clue how exploits work, don't come up with ideas about them.
-
08-20-2008, 12:56 AM #8938
Thanks, I just went ahead and grabbed the thing out of the pspsdk source, since my thing is ever-so-open-source, I don't think many people will be able to compile if I do otherwise. Nevertheless, thank you very much.
EDIT: It requires snprintf, which is not available with the kernel crap. Is there a macro available to emulate what it does?Geändert von NoEffex (08-20-2008 um 01:39 AM Uhr)
-
08-20-2008, 05:25 AM #8939QJ Gamer Silver

- Registriert seit
- Jan 2006
- Ort
- Germany
- Beiträge
- 926
- Points
- 14.087
- Level
- 77
- Downloads
- 0
- Uploads
- 0
Raphs board rules #31: Excessive use of punctuation is either a sign of a lesser ego or a small mind. Avoid it if you don't want to look like a total moron.
Raphs board rules #17: When you need to ask whether you are capable of doing something, you are not.
Raphs board rules #2: Exploits aren't found by changing version numbers, blindly merging data into a file or turning your PSP upside down.
Raphs board rules #1: If you have no clue how exploits work, don't come up with ideas about them.
-
08-20-2008, 06:29 AM #8940QJ Gamer Blue
- Registriert seit
- Dec 2007
- Ort
- Netherlands
- Beiträge
- 148
- Points
- 5.672
- Level
- 48
- Downloads
- 0
- Uploads
- 0


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