you actually have to build the prx.
If you cant get trickbrick v5 and delete the eboot then put yours in and see if it runs.
Printable View
tried dont work :down:
my computers acting up atm tho so... :Argh::Argh::Argh:
~!SlasheR!~
Hi
I'm having troubles using FontLoader. I tried to include it in my project but since it is a c++ project I had to rename fontloader.c to fontloader.cpp. Now when I try to compile he tells me
but line 83 is justZitat:
fontloader.cpp (83) : multiple definition of `ft_library'
main.cpp (30) : first defined here
and there's no ft_library used in my main.cpp at all! In fact 'ft_library' is only used 3 times in the whole project, and only in fontloader.h:Code:u32* fbLine = framebuffer + xofs + yofs * lineSize;
for (y = 0; y < bitmap->rows; y++) { // Line 83
u8* column = line;
and fontloader.cpp:Code:FT_Library ft_library;
and there's only 1 definition. All I did was change the filename to .cpp.Code:initError = FT_Init_FreeType( &ft_library ); // line 26
// [...]
int error = FT_New_Memory_Face(ft_library, fontData, filesize, 0, &font->face); // line 48
PS: Are there any other libraries for displaying fonts than fontloader? I was told pgeFont is pretty good and fast and stuff, but it doesn't work with Psilocybeing's graphic library on which the rest of the project is heavily built on already.
This is in a header file? If so, change it to:Code:FT_Library ft_library;
and addCode:extern FT_Library ft_library;
To the top after the includes in FontLibrary.cpp.Code:FT_Library ft_library;
It compiles and works! Thanks a lot yaustar! :)
Okay i got my men working but now im having problems with audio playback.
Is there an audio library that is compatible with dax's vlf library.
still no luck with the vlf library, could someone please answer my question on the next page?
~!SlasheR!~
How do I allocate memory to the first dimension of an array?
Something like
?Code:char *array[256];
array = ?
This only works in initialization, but you can do this:
If there are entries absent, they are set to zero.Code:char hex[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
So well, another one of my endless troubles.
So, i'm toying with samples in pspsdk samples.
The clut sample in gu folder is quite interesting, but i have to get it working with Oslib library at once.
So now, with no guessing what i'm doing i just copy&pasted the sample, removed what was unneded (guessing) and put in with oslib.
When compiling to check whenever it works, i have that error -
And now, i have no idea, i'm literraly at dark now. So, any help appreciated.PHP-Code:main.cpp:(.text+0x1dc): relocation truncated to fit: R_MIPS_GPREL16 against `osl_quit'
main.cpp:(.text+0x1e8): relocation truncated to fit: R_MIPS_GPREL16 against `osl_skip'
main.cpp:(.text+0x22c): relocation truncated to fit: R_MIPS_GPREL16 against `osl_frameskip'
main.cpp:(.text+0x230): relocation truncated to fit: R_MIPS_GPREL16 against `osl_maxFrameskip'
main.cpp:(.text+0x238): relocation truncated to fit: R_MIPS_GPREL16 against `osl_vsyncEnabled'
main.cpp:(.text+0x23c): relocation truncated to fit: R_MIPS_GPREL16 against `osl_quit'
Source in the attachement.
Also, if somebody was kind enough to help me make it use only Oslib functions then i would be very grateful.
drop oslib, trying to use the oslib and direct GU clut is not going to work like you want, trust me, if your going to use the clut than simple drop oslib competly and begin learning the gu, also the CLUT is damn amazing, no worry of my rendering being an issue on my end=-), but like i said competly drop oslib if you plan to use CLUT=-)
Too bad, but i have to use oslib. I'm just making a game, and clut will be a background on some maps, so i have to use them both at once, and my pspsdk knowledge isn't good enough to drop oslib, let alone do what i want :(
So, the question is - direct GU drawing with oslib with no conflicts. How?
I got interested when I saw your message, so I tried to include the clut sample into my oslib application, and was successful, I can draw the clut sample and an OSL_IMAGE on top of it.
clutoslib.cpp, where the function is:my makefile (cleaned, only relevant parts):PHP-Code:#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspdebug.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <pspgu.h>
#include <oslib/oslib.h>
//static unsigned int __attribute__((aligned(16))) clut_list[262144];
struct Vertex
{
float u,v;
float x,y,z;
};
#define NUM_SLICES 128
#define NUM_ROWS 128
#define RING_SIZE 2.0f
#define RING_RADIUS 1.0f
#define SPRITE_SIZE 0.025f
unsigned int colors[8] =
{
0xffff0000,
0xffff00ff,
0xff0000ff,
0xff00ffff,
0xff00ff00,
0xffffff00,
0xffffffff,
0xff00ffff
};
unsigned int __attribute__((aligned(16))) clut256[256];
unsigned char __attribute__((aligned(16))) tex256[256*256];
int test_clut()
{
OSL_IMAGE *image=oslLoadImageFilePNG((char *)"test.png", OSL_IN_RAM|OSL_SWIZZLED, OSL_PF_8888);
unsigned int i,j;
for (j = 0; j < 256; ++j)
{
for (i = 0; i < 256; ++i)
{
tex256[i + j * 256] = j ^ i;
}
}
sceKernelDcacheWritebackAll();
int offset = 0;
while(!osl_quit)
{
// animate palette
unsigned int* clut = (unsigned int*)(((unsigned int)clut256)|0x40000000);
for (i = 0; i < 256; ++i)
{
unsigned int j = (i + offset)&0xff;
*(clut++) = (j << 24)|(j << 16)|(j << 8)|(j);
}
oslStartDrawing();
// clear screen
sceGuClearColor(0xff00ff);
sceGuClear(GU_COLOR_BUFFER_BIT);
// setup CLUT texture
sceGuClutMode(GU_PSM_8888,0,0xff,0); // 32-bit palette
sceGuClutLoad((256/8),clut256); // upload 32*8 entries (256)
sceGuTexMode(GU_PSM_T8,0,0,0); // 8-bit image
sceGuTexImage(0,256,256,256,tex256);
sceGuTexFunc(GU_TFX_REPLACE,GU_TCC_RGB);
sceGuTexFilter(GU_LINEAR,GU_LINEAR);
sceGuTexScale(1.0f,1.0f);
sceGuTexOffset(0.0f,0.0f);
sceGuAmbientColor(0xffffffff);
// render sprite
sceGuColor(0xffffffff);
struct Vertex* vertices = (struct Vertex*)sceGuGetMemory(2 * sizeof(struct Vertex));
vertices[0].u = 0; vertices[0].v = 0;
vertices[0].x = 0; vertices[0].y = 0; vertices[0].z = 0;
vertices[1].u = 256; vertices[1].v = 256;
vertices[1].x = 480; vertices[1].y = 272; vertices[1].z = 0;
sceGuDrawArray(GU_SPRITES,GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D,2,0,vertices);
// oslib drawings
oslDrawImageXY(image, 215, 111);
// wait for next frame
oslEndDrawing();
oslEndFrame();
oslSyncFrame();
offset++;
}
oslDeleteImage(image);
return 0;
}
try to call the test_clut() function into your main(), don't forget to put an image named "test.png" next to the eboot.PHP-Code:TARGET = clutoslib
OBJS = code/main.o
BUILD_PRX = 1
PSP_FW_VERSION = 371
INCDIR =
CFLAGS = -G0 -Wall -O3 -fsingle-precision-constant -falign-functions=64
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LDFLAGS =
STDLIBS= -losl -lpng -lz -lpspsdk -lpspctrl -lpspumd -lpsprtc -lpsppower -lpspgu -lpspaudiolib -lpspaudio -lm -lstdc++ -lpspmpeg -lpspaudiocodec
LIBS=$(STDLIBS)$(YOURLIBS)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = clut oslib
PSP_EBOOT_ICON = ICON0.png
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
if you want to know, I'm using oslibmod by sakya, and I'm initializing it like this:I provide my own callbacks.PHP-Code:oslInitAudioME(OSL_FMT_MP3);
scePowerSetClockFrequency(333, 333, 166);
oslInit(OSL_IF_USEOWNCALLBACKS);
oslInitGfx(OSL_PF_8888, true);
oslSetDithering(false);
oslSetFrameskip(1);
oslSetMaxFrameskip(3);
oslSetTextColor(RGBA(255,255,255,255));
oslSetBkColor(RGBA(0,0,0,0));
Note that I first tried to write the benchmarks from oslib, but the text & bg were white, I don't know why...
I'm having an annoying compiler issue with some code of mine...
makefile:
main.cpp:Code:...
OBJS =\
PBPDepack.o\
...
depack.h:Code:#include "depack.h"
...
FILE *fp;
fp = fopen("ms0:/test.pbp", "r");
long int one = 0;
long int two = 0;
getOffsets(fp, 0, &one, &two);
fclose(fp);
PBPDepack.s:Code:#include <stdio.h>
void getOffsets(FILE *pbp, int position, long int *pointerStart, long int *pointerEnd);
Error:Code:.set noreorder
#include "pspstub.s"
STUB_START "PBPDepack",0x40090000,0x00010005
STUB_FUNC 0x5FF3D8D7,getOffsets
STUB_END
No idea what is going on, its not exclusive to PBPDepack either, I've tried a couple of modules and exports, all giving the same problem that its undefined. Anyone know whats going on here?Zitat:
main.o: In function `loadOption(int)':
...:381: undefined reference to `getOffsets(
__sFILE*, int, long*, long*)'
-Aura
Quoting THAT much of a post, it would have been nice if you said something constructive rather than "is rly stupid"... Why is it stupid? What can he do to achieve the same thing (ease of coding with clut)? Your post is just as pointless as this one.
Actually, my post isn't pointless because I'm gonna ask a question. Isn't OSLib just a bunch of functions working with the GU? So how is using the GU with the GU dumb?
-Aura
no, it's not that, which i meant, while yes oslib uses the GU, it's the way he used it their, they wish to take advantage of the CLUT with oslib, and AFAIK oslib doesn't take advantage of a CLUT, and their's no way to change that, oslib's internal functions take care of handling an image, and displaying it, which makes it not possible(to my knowledge) to be able to use a CLUT with oslib, the only other option is to get oslib's source, and include CLUT handling into oslib, than re-compile oslib with CLUT capabilitie's internally, otherwise it's just one huge big PITA to try and use oslib, with native gu commands, which at that point, your better off using the GU than cluttering up your code with a bunch of oslib calls as well, which is why, it's rly stupid PERIOD.
secondly, i also question if they understand what the CLUT is, copy and pasting code isn't going to help like their doing
edit: and lastly, my post wasn't pointless, do you only take the most negative thing in a post, and immediately think a post is meaningless, when that's said, perhaps you forgot the first part:
Zitat:
Zitat von slicer4ever
Netaro wants to include the clut code into his project, which uses oslib. my post just shows him how to integrate it, how is that stupid?
Yep, the graphical part is using the GU, I basically just had to remove all the initialization instructions because it's already done by oslib + subsituing some functions...
Edit: beaten by Slicer :)
You have a point Slicer, but I think what Netaro wants is the pretty effect, nothing more.
-=Double Post Merge =-
I took a look on wikipedia before trying the code... it's helping having a nice background effect, and knowing how to use the GU with oslib, to sometimes do things oslib doesn't allow by itself.
Because its another post that you've given no real advice only said that its stupid, as I said you never explained why, if someone is wanting to use that method they obviously think its a good idea and giving them some real proof as to why its stupid would be better than just coming out with it and having no evidence.
I'd like to see though how you get this bit:
What other times have I ever looked at a post and made it appear negative without good reason? As I said, there was NOTHING constructive about your post at all, it held no real help just a blatent "this is stupid" remark to it. Yes this is negative in my opinion because its a help thread and you just appear to be throwing your knowledge around without offering advice or showing where people make their mistakes. It wouldn't have been difficult to have compiled your second post into your first and avoid my comment. A help thread is for help.
-Aura
if it's the effect he's going after, than it doesn't require the use of the CLUT, but just manipulation of the data field inside of OSL_IMAGE, trying to use the CLUT for the same effect, which yes is pretty intresting, is alot of waste of code
@aura, i could have gone about it at a nicer way indeed
guys im having some trouble...
how can i fix:
?Code:$ ./toolchain.sh 3 6
ERROR: Add C:/PSP/pspdev/bin to your path before continuing.
../depends/check-pspdev.sh: Failed.
~!SlasheR!~
did u even google your problem?
googled: ERROR: Add C:/PSP/pspdev/bin to your path before continuing.
2 results, second one:
http://ubuntuforums.org/showthread.php?t=554423
solution:
export PATH=$PATH:/usr/local/pspdev/bin
before you run the toolchain
IIRC, doing that is in the readme of the tootchain as well as another command you have to do in bash first, maybe checking the readme would help to
slicer i did google,
my pspdev folder is actuallt located at C:\psp\pspdev\
so i do:
?Code:export PATH=$PATH:C:\\psp\\pspdev\\
~!SlasheR!~
psptoolchain readme:
specifically "How do i use?" number 2.Zitat:
Zitat von readme
try it before u ask again please
ok srry i thought becuase i installed in dif location!
:tup: THX!!!
~!SlasheR!~
I posted this earlier but I've done some extra work now (check the bottom)
I'm having an annoying compiler issue with some code of mine...
makefile:
main.cpp:Code:...
OBJS =\
PBPDepack.o\
...
depack.h:Code:#include "depack.h"
...
FILE *fp;
fp = fopen("ms0:/test.pbp", "r");
long int one = 0;
long int two = 0;
getOffsets(fp, 0, &one, &two);
fclose(fp);
PBPDepack.s:Code:#include <stdio.h>
void getOffsets(FILE *pbp, int position, long int *pointerStart, long int *pointerEnd);
Error:Code:.set noreorder
#include "pspstub.s"
STUB_START "PBPDepack",0x40090000,0x00010005
STUB_FUNC 0x5FF3D8D7,getOffsets
STUB_END
No idea what is going on, its not exclusive to PBPDepack either, I've tried a couple of modules and exports, all giving the same problem that its undefined. Anyone know whats going on here?Zitat:
main.o: In function `loadOption(int)':
...:381: undefined reference to `getOffsets(
__sFILE*, int, long*, long*)'
*
I've attempted to use a "wrapper" function in a c file, as I've noticed errors compiling modules in cpp I wondered if linking to a c file and running would work - epic fail. Same error as above with the wrapper function (I.E. the function in the c file) although strangely the wrapper file compiled fine :Argh:
I compiled the exact same code on my Ubuntu setup, which as an up-to-date toolchain, sdk, etc (my PC is running on maybe 18 month old one). The same thing occurs on there, same error everything.
I attempted to change my cpp file to c but seeing as I'm using lots of class functions it'd be very time consuming to get it compiling in c and calling on c++ files, although I'm certain this would work its just not worth the effort.
Is there anything that needs adding to the makefile to compile c++ files correctly without this onslaught of random errors? I've included -lstdc++ but its not made any difference that I can see.
*
-Aura
Try:
MyCppFile.cpp
That is if myCFunc() is in a file that is compiled as a C file, and not a C++ file.Code:
extern "C" {
#include "MyCFile.h"
}
int myCppFunc()
{
return myCFunc();
}
i did ./toolchain 3 6 and left it for an hour when i came back it hadnt finished but it stopped and said
what wrong??Code:make: *** [all] Error 2
../scripts/006-pspsdk-stage2.sh: Failed.
~!SlasheR!~
that's the only thing it outputed?
Hi Guys,
Trying to grab a colour screen and convert it to black & white, and write that to an image.
Something wrong here.. any ideas?
The image is b&W, but some bright colours turn out really dark.Zitat:
void blackwhite() {
u8 b; u8 g; u8 r; int xxx;
for (pxx=0; pxx<480; pxx++) { // image width
for (pyy=0; pyy<272; pyy++) { // image height
pixel = getPixelScreen(pxx, pyy);
r = pixel & 0xFF;
g = (pixel & 0xFF00) >> 8;
b = (pixel & 0xFF0000) >> 16;
xxx = r + b + g;
pixel = xxx * 0x10000;
pixel = pixel + (xxx * 0x100);
pixel = pixel + xxx;
putPixelImage(pixel,pxx,p yy,bwscreen);
}}
}
Oh yeah.. the idea is to add the values of R,G & B, then divide that by three for each pixel.
Then write that value back to R,G & B for the greyscale colour.
You may get an overflow by adding all three components (e.g. 3x255). Also, for RGB to gray scale conversion you should use weights for the components, IIRC gray = .3 * r + .59 * g + .11 * b (I could be wrong, has been a while). To be safe you should clip the values against [0..255].
HTH
Thanks _dysfunctional that worked, I feel a bit stupid now because I've done this in the past but completely forgot about it :o
-Aura
Hi, I've just started PSP programming, and I have a problem.
I'm trying to display an image, but the application seems to skip lines and go directly to sceKernelSleepThread!
Never mind about those printf's, i just used them to see the app's flow. Ikona is declared as blitAlphaImagetoScreen. The problem is loadimage, for whatever reason. Getkey() is also a function I wrote.Code:int main(){
SceCtrlData reqpad;
char imgadr[20];
Image* loamg;
pspDebugScreenInit();
SetupCallbacks();
initGraphics();
printf("press x");
reqpad.Buttons = PSP_CTRL_CROSS;
getkey(reqpad);
printf("exit");
sprintf(imgadr,"imgi.png");
printf("www");
// ---Skips here
loamg = loadImage(imgaddr);
printf("xc");
ikona(0,0,480,272,loamg,0,0);
printf("ikona");
flipScreen();
sceKernelSleepThread();
return 0;
}
Can someone help me? Thanks.
In this case, it might be heplful to check if loadImage() is returning NULL. If so, then it may be a problem with the path.Zitat:
The problem is loadimage, for whatever reason
See? You declare imgadr but you pass imgaddr to the function. I'd be surprised if you didn't get any errors compiling.Code:...
char imgadr[20];
...
sprintf(imgadr,"imgi.png");
printf("www");
// ---Skips here
loamg = loadImage(imgaddr);
Also, I don't see any reason to use sprintf when your just writing a plain string to a buffer.
Code:sprintf(imgadr,"imgi.png");
I tried checking for NULL, but it seems that it's correct.
I've also entered a plain string to loadImage, but it still gets stuck there.
You said it skips to the sleep function, but do you get output with printf? And have you tried blitImage instead of blitAlphaImage, the alpha can sometimes have problems so it'd be a 1 time check to see if that changes anything.
Also, for safety add a check that the image loads as standard (even if it loads now, someone might not copy the file or whatever in the future) and hard code the path instead of using a buffer as its just a waste of code.
Whats in Getkey()? Experiance also tells me that doing reqpad.Buttons = PSP_CTRL_CROSS; won't have the effect you want it to.
-Aura
Getkey is just a function that ends when a specified button is pressed and released. That reqpad.Buttons = PSP_CTRL_CROSS actually works for me, at least using the X button.
From other tests I have come to realise it stops at loadimage. Perhaps I should take a look with the address or something.Code:void getkey(SceCtrlData butid){
SceCtrlData pad,lastpad;
while (1){
sceCtrlReadBufferPositive(&pad, 1);
if (lastpad.Buttons != pad.Buttons){
if (pad.Buttons & butid.Buttons){
return;
lastpad.Buttons = pad.Buttons;
}
else{
lastpad.Buttons = 0;}
}
}
}
Does it sleep or crash? Have you tried running it inside PSPLink? You may be better able to pinpoint the time of the problem inside there.
If it crashes post the picture on here as that may be the cause.
-Aura