Zitat:
Zitat von hotrocker
Ok, I'll check that out in a little while, I gotta go for a couple hours, if anyone has tips for me though, feel free to post 'em ;)
Printable View
Zitat:
Zitat von hotrocker
Ok, I'll check that out in a little while, I gotta go for a couple hours, if anyone has tips for me though, feel free to post 'em ;)
Your trying to take a number away from a type of data, not actual data, a fix would be...
Although, I doubt that will work purely because x and y are already defined, using that function they are being defined twice, but you get the basic idea by that exmaple.Code:void oslDrawLine(int x, int y, int x, int y, OSL_COLOR color);
void oslDrawLineAlt(int x, int y, int x, int y, OSL_COLOR color)
{
oslDrawLine(x - 1, y - 1, x - 1, y - 1, color);
return;
}
-Aura
Has anyone been able to use intraFont with triEngine? I keep trying to get intraFont to work with the triEngine, but it keeps crashing. I have been using the triEngine graphics example and copy and pasted the intraFont GU example (without the initialization of the GU) into the triEngine example. Here's what I've got.
Spoiler for Current Code:
the screen is black and when you try to exit with the home button, it freezes on the "Please Wait" screen.
I've never actually used triEngine before, so I can't really help out with that, I know I've personally had no problems with intraFont using graphics.c, you could try working with that for now to check that it all works like that, and then switch around (I think I had a problem with the example, can't remember why though). Also, I'm not sure if this is right or not, as I rarely work in pure user mode, but I'm not 100% sure you can access flash0:/ in user... or is that just read/write access?
The probable reason as to why the "Exit Screen" is crashing is due to the loop, there is no processing power given to the exiting, try adding a delay into the while loop, something like sceKernelDelayThread(10*1 000); (10k micro seconds).
-Aura
You are right, that is still invalid syntax.Zitat:
Zitat von Auraomega
Code:void oslDrawLineOffsetByOne(int fromX, int fromY, int toX, int toY, OSL_COLOR color)
{
oslDrawLine(fromX - 1, fromY - 1, toX - 1, toY - 1, color);
return;
}
Zitat:
Zitat von yaustar
Cool, I will try that and see if it comes back any better than before.
thanks
EDIT:
hey yaustar, say I wanted that to be connected to an image that I would be drawing in like:
I tried changing it to kernel mode and adding the delay in the loop, but the problem persists. I know it works with graphics.c, but I switched to triEngine because of some of the features. I'm pretty sure you can read the flash0 in user mode, but just can't write to it because games could need the font files.Zitat:
Zitat von Auraomega
compiles fine. though i cant test the program cuz i dont have the files, will pm you the eboot :DZitat:
Zitat von spike021
Zitat:
Zitat von hotrocker
Actually, let me PM you the files and you test, it would be better than just me, that way, I have other opinions.
The problem is likely to do with the separate setup that intraFontInit() uses over triInit().Zitat:
Zitat von FigMan
Try separating them out and see the differences - then you can switch between states or alter intraFont to suit your needs.
Completely depends on the positional offset you want with both images.Zitat:
Zitat von spike021
Zitat:
Zitat von yaustar
Well I tried, and it ends up just flying around the screen, its meant to be attached to the player... from looking at what I have above, in that post that I put my main.cpp, what do you think I should do? I have tried a few different things, but I always get the same result... :Argh:
EDIT:
This is what the game looks like when played, I am trying to figure out what the best way is for setting the yellow ball to pop up like the white one.
http://i181.photobucket.com/albums/x...rd/snap004.jpg
http://i181.photobucket.com/albums/x...rd/snap003.jpg
The only problem is, I don't know what to look for. what i have found is thatintraFontInit() does not initialize the GU, but an external graphics library does instead.Zitat:
Zitat von Insert_Witty_Name
Code:int intraFontInit(void) {
int n;
for(n = 0; n < 16; n++)
clut[n] = ((n * 17) << 24) | 0xffffff;
return 1;
}
Spoiler for intraFont GU:
Spoiler for triEngine GU:
i am not sure what all of the differences are between these. (i'm new to the GU).
can someone point me in the right direction?
spike - You not understanding how the game's basic mechanics work are the reason your having so many problems. You'll need to create another spring object and apply all the same physics to it the original has. If you want that new spring object's "parent" to be the first spring object, you'd replace all player coordinates with that of the first springobject's. It's a very simple concept but you not getting how it works is the only problem. You should maybe consider working on other things to gain experience and come back to this later. It might be easier in the long run. (one big important thing to do is get a working toolchain setup so you can debug yourself :))
I've got it SG57, it's just taking a bit longer for me than you. I don't have nearly as much experience as you, but it will work soon enough. Just let me worry about the toolchain also.
EDIT: Not to mention that I also need to go through trial and error right?
But thanks for the constructive criticism.
Hi,
I am running into a warning when compiling some code, I have googled extensively and cannot find a fix. The warning I encounter is " warning: passing argument 2 of ‘sceNetInetConnect’ from incompatible pointer type"
The relevent section of code is below
Any help would be greatly appreciated :)Code:char buf[MAXPATHLEN];
char file_path[128];
char gBuffer[512];
char *Scan;
int found = 0;
FILE *CfgFile;
struct sockaddr_in addr;
int err;
char host[32];
unsigned short port;
strcpy(file_path, getcwd(buf, MAXPATHLEN));
strcat(file_path, "/wifi.cfg");
printf("Reading configuration file: %s \n", file_path);
CfgFile = fopen(file_path, "r");
if (CfgFile != (FILE*)0) {
while (fgets(gBuffer, 512, CfgFile) != (char *)0) {
Scan = strchr(gBuffer, '\n');
if (Scan) *Scan = '\0';
Scan = strchr(gBuffer, '\r');
if (Scan) *Scan = '\0';
if (gBuffer[0] == '#') continue;
if (!strncasecmp(gBuffer, "address=", 8)) {
printf("Found IP address!\n");
found = 1;
strcpy(host, gBuffer + 8);
printf("Setting IP address to connect to as %s.\n", host);
}
}
fclose(CfgFile);
if (found == 0) {
ColorPrintF(RED, "Could not find IP address in configuration file!");
done = 1;
}
}
port=54321;
pspDebugScreenClear();
memset(&addr, 0, sizeof(struct sockaddr_in));
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
sceNetInetInetAton(host, &addr.sin_addr);
sock = sceNetInetSocket(AF_INET, SOCK_STREAM, 0);
if (sock < 0) {
return -1;
}
err = sceNetInetConnect(sock, &addr, sizeof(addr));
if (err) {
return -1;
}
Seems you've got pointers mixed up... speaking of which, I'm also getting confused with pointers again, * is a pointer to an address, and & is the address of that variable/pointer right?
I'm a little rusty of pointers, is there any really good sites with a recap of pointers? Also, I want a pointer to point to a buffer, how would I do that?
Except I don't think thats doing what I aim to do, would I be better off not malloc'ing the ptr1? Also, ptr1 must remain a pointer, and cannot be a pointer to a pointer (well it could... but I would have to change a lot of my code to do so, so other methods are welcome).Code://allocating buffer space
u8* ptr1 = (char*)malloc(128*1024);
u8* ptr2 = (char*)malloc(128*1024);
u8* ptr3 = (char*)malloc(128*1024);
//other code
ptr1 = ptr2;
//other code
pt1 = ptr3;
Thanks.
-Aura
Memory leak, you have just lost the address of the allocated memory that ptr1 was pointing to. What are you trying to do?Code://other code
ptr1 = ptr2;
-= Double Post =-
darksaboteur: The second argument asks for a sockaddr * not sockaddr_in * which is not what you are passing in.Code:sceNetInetConnect(int s, const struct sockaddr *serv_addr, socklen_t addrlen);
Trying to run through a loop with ptr1 giving the location of the buffers that the data is stored in, and every so often switching to the other buffer. I don't actually need ptr1 to be a buffer, and looking at the code, it seems a really foolish thing to do, if I just did:
would that be a safer idea?Code://allocating buffer space
u8* ptr1;
u8* ptr2 = (char*)malloc(128*1024);
u8* ptr3 = (char*)malloc(128*1024);
ptr1 = ptr2;
//other code
pt1 = ptr3;
-Aura
So what is u8? I have seen it a lot of code.
It's equivalent to (and may well be defined as) unsigned char.
Dunno if this will help you or notZitat:
Zitat von Auraomega
http://www.cplusplus.com/doc/tutorial/pointers.html
yaustar - CpuWhiz is picking on me :dry:
Zitat:
Zitat von IRC Log
That's exactly what you should do.Zitat:
Zitat von Auraomega
Ask if he has the optimisations on the O2 and dead code stripped out. (Which IRC channel is he on)Zitat:
Zitat von SG57
edit:The code should have thrown up warnings, the constant has no datatype.Code:#
const NUM_SOUNDS = 5;
#
#
int main(int agrc, char *argv)
#
{
#
int count = NUM_SOUNDS;
#
};
-= Double Post =-
Okay, I checked the disassembly of the following code:
And it gives:Code:int main()
{
int blah = 10;
++blah;
return 0;
}
This codeCode:0x4012f0 push %ebp
0x4012f1 mov %esp,%ebp
0x4012f3 sub $0x8,%esp
0x4012f6 and $0xfffffff0,%esp
0x4012f9 mov $0x0,%eax
0x4012fe add $0xf,%eax
0x401301 add $0xf,%eax
0x401304 shr $0x4,%eax
0x401307 shl $0x4,%eax
0x40130a mov %eax,0xfffffff8(%ebp)
0x40130d mov 0xfffffff8(%ebp),%eax
0x401310 call 0x401810 <_alloca>
0x401315 call 0x4013c0 <__main>
0x40131a movl $0xa,0xfffffffc(%ebp)
0x401321 lea 0xfffffffc(%ebp),%eax
0x401324 incl (%eax)
0x401326 mov $0x0,%eax
0x40132b leave
0x40132c ret
GivesCode:const int CONST_NUMBER = 10;
int main()
{
int blah = CONST_NUMBER;
++blah;
return 0;
}
No difference in the disassembly of the compiled exe in debug mode between the pieces of code.Code:0x4012f0 push %ebp
0x4012f1 mov %esp,%ebp
0x4012f3 sub $0x8,%esp
0x4012f6 and $0xfffffff0,%esp
0x4012f9 mov $0x0,%eax
0x4012fe add $0xf,%eax
0x401301 add $0xf,%eax
0x401304 shr $0x4,%eax
0x401307 shl $0x4,%eax
0x40130a mov %eax,0xfffffff8(%ebp)
0x40130d mov 0xfffffff8(%ebp),%eax
0x401310 call 0x401810 <_alloca>
0x401315 call 0x4013c0 <__main>
0x40131a movl $0xa,0xfffffffc(%ebp)
0x401321 lea 0xfffffffc(%ebp),%eax
0x401324 incl (%eax)
0x401326 mov $0x0,%eax
0x40132b leave
0x40132c ret
What does that mean? :oZitat:
Zitat von Archaemic
That is what the u8 is. Unsigned 8 bit datatype which is the same as an unsigned char.Code:typedef u8 unsigned char;
yaustar - irc.freenode.net #pspdev
I linked him to a site saying something of the sort:
Zitat:
Zitat von site
Does this tutorial compile for anyone here?
http://www.psp-programming.com/code/...heport-lesson1
Ah, the ports of Nehe's GU stuff, I've got it compiling fine, I've uploaded the code, I also removed the header file and just placed the main content of the header file before the main function to save having lots of files to mess around with on my already messy flash drive :p
-Aura
Awesome, thanks Aura
I'm recompiling my toolchain... well I'm not because its not working, and I can't work out why, can anyone tell me whats going on here:
-AuraZitat:
$ ./toolchain.sh
75235254 [main] bash 2572 child_copy: linked dll data write copy failed, 0x703DC000..0x703DF1B0, done 0, windows pid 2572, Win32 error 5
bash: fork: Resource temporarily unavailable
My game doesn't go into standby mode. Whenever I turn the PSP off during the game, the screen turns off, then the power light blinks green for about 15 seconds, then shuts off completely, requiring a reboot. Is there any specific code that won't allow me to go into standby? I'm building it in user mode, but I have the Makefile set to build in the 3.71 kernel, just in case.
That's user mode right? Kernel mode would be to set the second argument ot 0x1000. Any thoughts, suggestions?Code:PSP_MODULE_INFO("Box Man",0,1,1);
It's nothing to do with your makefile/module info I'm sure.
It's more your code. If your streaming something from the memory stick, (have anything on the stack?), etc. when returning to standby you aren't given immediate use of those so they are likely to cause a crash.
That's an educated guess - can't say for sure sorry.
I went looking through google for an advanced form of AI that will follow a specific object, but I am finding that most sites are old or their information just contains instructions of making a tic-tac-toe 'esque feel.
Are there any specific instructions for advanced AI coding or do you think that I should just do a simple code? It would act as a sort of mirror to another object while using a host of different commands (retreat, attack, etc).
I thought maybe there was a common solution or something. But you say that I'm not given immediate access to the stack. I think maybe it's because I'm loading a level from the memory stick. Oh well, it's no big deal. The game is still just as good without standby.Zitat:
Zitat von SG57
I'm sure by now your aware that AI is game-specific so instructions and tutorials are a no go because your not making a tic-tac-toe game or pong.
What you can do is design your AI on paper - if feeling like attacking, attack player else if feeling sad or low health, retreat, etc.
Then you can start thinking of how that can be converted into code that's compilable. Advanced AI, as you say, has alot to do with algorithms (path finding, etc.) so it takes a somewhat advanced math knowledge to do (this varies depending on the type of advanced AI needed course). Something more do-able is a more simplified AI while still creating a similar out come. But this also is game specific :-\
I remember reading somewhere that AI programming is not easy to teach nor learn and is sometimes best to let those who "just get it" do it, that may not be the case for you so don't let that discourage you!
Zitat:
Zitat von SG57
Alright, thanks for the quick reply SG. I will get a piece of paper (graphing of course ^^) and I will see what I can come up with.
What would be the minimum kind of math needed do you think for setting up the AI code (geometry, calculus, statistics, linear algebra, etc)?
I don't really want to work on something really time consuming, but if it takes awhile, that means I have hopefully done my work well :).
Also, do you think that I should get any sort of open-source library for this or would I be fine with just the normal "if" and "else" functions?
Well.. once again - AI is game specific so making some sort of portable engine or library would be useful in very limited situations and is ultimately not practical if you ask me...
The amount of math required is, yet again, game specific. A game like Twilight Princess has an incredibly diverse playing area so obviously a simple path finding algorithm for each enemy is not going to be the case where a game like PacMan is ideal for it. This is partly the reason why AI programming is so hard to teach and learn.
Zitat:
Zitat von SG57
Alright, thanks again. I think I may try some algorithms but I am still looking through some tutorials that may help me out a bit, if not %100.