Seite 324 von 340 ErsteErste ... 224 274 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 ... LetzteLetzte
Zeige Ergebnis 9.691 bis 9.720 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; I didn't know about the \r, which was one of the problems, the other which was noticed by someone else ...

  
  1. #9691
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    I didn't know about the \r, which was one of the problems, the other which was noticed by someone else is that I was incrementing loop every time, even if nothing was added to the buffer.

    Fixed code is:
    Code:
    c = fgetc(fp);
    for(int loop = 0; c != EOF;)
    {
    	if((c != '\n') && (c != '\\') && (c != '\r'))
    	{
    		buffer[loop++] = c;
    	}
    	c = fgetc(fp);
    }
    Thanks though, the \r I would never have known.

    -Aura


    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  2. #9692
    QJ Gamer Bronze
    Points: 5.826, Level: 49
    Level completed: 38%, Points required for next Level: 124
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Ort
    Everywhere
    Beiträge
    206
    Points
    5.826
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Hi. I was wonder if there was a way to manipulate the screen display, and to turn off the screen in user mode?
    I know it's possible in kernel mode.
    Geändert von chrisp6825 (02-13-2009 um 08:01 PM Uhr)
    Pokemon Islands in Development : Qj Forum | Google Forum | Probords Forum

  3. #9693
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    I can't even find a function to turn the screen off (other than lowering the brightness to 0). I doubt theres any other way, but just to make sure, you know how to wrap a kernel function and call it from a user mode application right?

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  4. #9694
    QJ Gamer Bronze
    Points: 5.826, Level: 49
    Level completed: 38%, Points required for next Level: 124
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Ort
    Everywhere
    Beiträge
    206
    Points
    5.826
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    No, but I'd really appreciate an example. :)
    Pokemon Islands in Development : Qj Forum | Google Forum | Probords Forum

  5. #9695
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    The best example I can offer is in the 4.01M33 SDK. The example is with the shell, the rDriver is a kernel wrapper which you link (using a stub file) and then load the functions in user mode. Take a look at that and if that doesn't help much, I'll see if I can fish out some of my old Project4 code... but its not very tidy as it was a one-man program

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  6. #9696
    QJ Gamer Bronze
    Points: 5.826, Level: 49
    Level completed: 38%, Points required for next Level: 124
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Ort
    Everywhere
    Beiträge
    206
    Points
    5.826
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    What do you mean 4.01 M33 SDK?
    Pokemon Islands in Development : Qj Forum | Google Forum | Probords Forum

  7. #9697
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    Download the 4.01M33 installer, inside theres a folder called SDK, thats got some libraries M33 created which allows for some kernel functions to be called in user mode (the kernel wrappers are loaded by default in the flash). Theres also a folder with the headers, and finally one with the source code in for compiling the shell. Its basic, but does the job teaching what needs to be done.

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  8. #9698
    QJ Gamer Bronze
    Points: 5.826, Level: 49
    Level completed: 38%, Points required for next Level: 124
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Ort
    Everywhere
    Beiträge
    206
    Points
    5.826
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Oh wow. Thanks, I'll check this out right now.

    So kubridge.h is what I'm looking for.
    SceUID kuKernelLoadModule()

    I'm not sure how to use it though.
    I need to load a module with it, so do I write my plugin with kernel functions, then load it with this?
    Geändert von chrisp6825 (02-14-2009 um 09:56 AM Uhr)
    Pokemon Islands in Development : Qj Forum | Google Forum | Probords Forum

  9. #9699
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    Basically, you write 2 modules:

    Module 1:
    Kernel - 0x1000
    Contains all kernel functions
    Compile a stub (.s) file with all functions to link to in the main application.
    Create a header file to link functions to main application.

    Module 2:
    User/update - 0x0000/0x0800
    Contains all user functions, and kernel wrappers from module 1
    Link the stub file into the makefile like any other C/++ file.
    Link the header into the source that calls on those functions.
    Load the module at the start (checking for errors).
    Run the wrapped functions in place of the kernel ones.

    A word of advice, create a checkFunc function, just to make sure linking has worked correctly:

    Code:
    int checkFunc()
    {
    	return 0x5034;
    }
    then when you load the module, run checkFunc, and see if it returns 0x5034, if it returns <0 then an error has occured, it if returns 0x5034 then linking has worked correctly.

    ...0x5034 only has value to me, you can use whatever you like above 0. (0x5034 = P4 in ascii).

    -Aura

    Is there any way I can create a temp file that exists only in RAM? I looked at tmpnam function, but I'm wondering if it creates a copy on the device. I'm trying to create an OTP system before I move on to something else and specifically need no data to be written before the encryption or after the decryption, but I want to be able to launch the decrypted file in whatever application it should be launched from.
    Geändert von Auraomega (02-14-2009 um 06:06 PM Uhr)
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  10. #9700
    QJ Gamer Silver
    Points: 8.475, Level: 62
    Level completed: 9%, Points required for next Level: 275
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Perth, Scotland
    Beiträge
    1.094
    Points
    8.475
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von chrisp6825 Beitrag anzeigen
    Oh wow. Thanks, I'll check this out right now.

    So kubridge.h is what I'm looking for.
    SceUID kuKernelLoadModule()

    I'm not sure how to use it though.
    I need to load a module with it, so do I write my plugin with kernel functions, then load it with this?
    On top of what Auramega said, make sure you export your syscall functions with late binding (0x4009) in the attributes. As I assume you're going to load this module from usermode.

  11. #9701
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    The late binding goes in the exports file correct? Just to make sure, it goes something like this:

    Code:
    PSP_EXPORT_START(STUBNAME, 0, 0x4009)
    or does it go with syslib?

    -Aura

    Edit:
    Just wrote a test to confirm what I previously thought about tmpnam. Ran the program, paused, remove my SD card, continued the application and it gave me errors that the volume doesn't exist. I need a method that means the plain text files only exists in RAM and never get written to the drive.

    I did have the thought though that it might just have to believe that its writing to the SD card to exist, so if anyone could confirm this I'd be happy, if not is there any cross platform libraries that do supply this ability?
    Geändert von Auraomega (02-15-2009 um 12:46 PM Uhr)
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  12. #9702
    QJ Gamer Blue
    Points: 3.795, Level: 38
    Level completed: 97%, Points required for next Level: 5
    Overall activity: 27,0%

    Registriert seit
    Jul 2007
    Beiträge
    296
    Points
    3.795
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    Just keep a buffer in ram, modify it to your liking, then when you need to save it, just write the whole thing to the memory card.

  13. #9703
    QJ Gamer Silver
    Points: 8.475, Level: 62
    Level completed: 9%, Points required for next Level: 275
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Perth, Scotland
    Beiträge
    1.094
    Points
    8.475
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Auraomega Beitrag anzeigen
    The late binding goes in the exports file correct? Just to make sure, it goes something like this:

    Code:
    PSP_EXPORT_START(STUBNAME, 0, 0x4009)
    or does it go with syslib?

    -Aura

    Edit:
    Just wrote a test to confirm what I previously thought about tmpnam. Ran the program, paused, remove my SD card, continued the application and it gave me errors that the volume doesn't exist. I need a method that means the plain text files only exists in RAM and never get written to the drive.

    I did have the thought though that it might just have to believe that its writing to the SD card to exist, so if anyone could confirm this I'd be happy, if not is there any cross platform libraries that do supply this ability?
    Oh, I ment import. Just make sure it is exported to usermode and it is IMPORTED in the stub with 0x4009

    so like this:
    STUB_START "kstuff",0x40090000,0x000 10005

  14. #9704
    QJ Gamer Blue
    Points: 5.672, Level: 48
    Level completed: 61%, Points required for next Level: 78
    Overall activity: 32,0%

    Registriert seit
    Dec 2007
    Ort
    Netherlands
    Beiträge
    148
    Points
    5.672
    Level
    48
    Downloads
    0
    Uploads
    0
    [SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
    [i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]

  15. #9705
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    @_dysfunctional:

    I want to be able to open the document in other programs though, such as a text editor or image viewer, something like that so a temp file seemed best. Either way I found a method using ramfs on Linux.

    @basfreak:

    Two problems I noticed, one, your makefile is building an elf, you want a prx, use BUILD_PRX = 1. The second is building a prx gives you 32kb of heap, not enough to run a program like this. The HEAP_SIZE_KB macro will fix this, just give yourself a few mb and you should be good to go.

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  16. #9706
    QJ Gamer Blue
    Points: 5.672, Level: 48
    Level completed: 61%, Points required for next Level: 78
    Overall activity: 32,0%

    Registriert seit
    Dec 2007
    Ort
    Netherlands
    Beiträge
    148
    Points
    5.672
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Still only displays:
    FPS: 1578
    till
    FPS: 1580



    Code:
    #include "main.h"
    
    PSP_MODULE_INFO("Lesson1", 0, 1, 1);
    PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);
    PSP_HEAP_SIZE_KB(20480); 
     
    void *dList;		// display List, used by sceGUStart
    void *fbp0;		// frame buffer
     
    int fps = 0;		// for calculating the frames per second
    char fpsDisplay[100];
    u32 tickResolution;
    u64 fpsTickNow;
    u64 fpsTickLast;
    
    Vertex __attribute__((aligned(16))) triangle[3] = 
    {
    	{ GU_COLOR( 1.0f, 1.0f, 1.0f, 0.0f ), 0.0f, 1.0f, 0.0f },     // top point
    	{ GU_COLOR( 1.0f, 1.0f, 1.0f, 0.0f ), 1.0f,-1.0f, 0.0f },     // left point
    	{ GU_COLOR( 1.0f, 1.0f, 1.0f, 0.0f ),-1.0f,-1.0f, 0.0f }      // right point
    };
    
    Vertex __attribute__((aligned(16))) quad[4] = 
    {
    	{ GU_COLOR( 1.0f, 1.0f, 1.0f, 0.0f ),-1.0f, 1.0f, 0.0f },     // top-left point
    	{ GU_COLOR( 1.0f, 1.0f, 1.0f, 0.0f ), 1.0f, 1.0f, 0.0f },     // top-right point
    	{ GU_COLOR( 1.0f, 1.0f, 1.0f, 0.0f ),-1.0f,-1.0f, 0.0f },     // bottom-left point
    	{ GU_COLOR( 1.0f, 1.0f, 1.0f, 0.0f ), 1.0f,-1.0f, 0.0f }      // bottom-right point
    };
    
    void FPS( void )
    {
    	fps++;
    	sceRtcGetCurrentTick( &fpsTickNow );
    	
    	if( ((fpsTickNow - fpsTickLast)/((float)tickResolution)) >= 1.0f )
    	{
    		fpsTickLast = fpsTickNow;
    		sprintf( fpsDisplay, "FPS: %d", fps );
    		fps = 0;
    	}
    	pspDebugScreenSetOffset( (int)fbp0 );
    	pspDebugScreenSetXY( 0, 0 );
    	pspDebugScreenPrintf( fpsDisplay );
     
    }
    
    void InitGU( void )
    {
    	// Init GU
    	sceGuInit();
            sceGuStart( GU_DIRECT, dList );
     
    // Set Buffers
    	sceGuDrawBuffer( GU_PSM_8888, fbp0, BUF_WIDTH );
    	sceGuDispBuffer( SCR_WIDTH, SCR_HEIGHT, (void*)0x88000, BUF_WIDTH);
    	sceGuDepthBuffer( (void*)0x110000, BUF_WIDTH);
     
    	sceGuOffset( 2048 - (SCR_WIDTH/2), 2048 - (SCR_HEIGHT/2));
    	sceGuViewport( 2048, 2048, SCR_WIDTH, SCR_HEIGHT);
    	sceGuDepthRange( 65535, 0);
    	
    // Set Render States
    	sceGuScissor( 0, 0, SCR_WIDTH, SCR_HEIGHT);
    	sceGuEnable( GU_SCISSOR_TEST );
    	sceGuDepthFunc( GU_GEQUAL );
    	sceGuEnable( GU_DEPTH_TEST );
    	sceGuFrontFace( GU_CW );
    	sceGuShadeModel( GU_SMOOTH );
    	sceGuEnable( GU_CULL_FACE );
    	sceGuEnable( GU_CLIP_PLANES );
            sceGuFinish();
    	sceGuSync(0,0);
     
    	sceDisplayWaitVblankStart();
    	sceGuDisplay(GU_TRUE);
    	// finish
    }
    
    void SetupProjection( void )
    {
    	// setup matrices for the triangle
    	sceGumMatrixMode(GU_PROJECTION);
    	sceGumLoadIdentity();
    	sceGumPerspective( 75.0f, 16.0f/9.0f, 0.5f, 1000.0f);
     
            sceGumMatrixMode(GU_VIEW);
    	sceGumLoadIdentity();
     
    	sceGuClearColor( GU_COLOR( 0.0f, 0.0f, 0.0f, 1.0f ) ); 
    	sceGuClearDepth(0);	
    }
    
    void DrawScene( void )
    {
    	sceGuStart( GU_DIRECT, dList );
     
    	// clear screen
    	sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);
    	sceGumMatrixMode(GU_MODEL);
    	sceGumLoadIdentity();
    	{
    	ScePspFVector3 move = { 3.0f, 0.0f, 0.0f };
    	sceGumTranslate( &move );
        }
        // Draw Triangle
    	sceGumDrawArray( GU_TRIANGLES, GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_3D,
    			3, 0, triangle ); 
            sceGuFinish();
    	sceGuSync(0,0);
    
    			
    }
     
    int main(int argc, char **argv)
    {
    	pspDebugScreenInit();
    	SetupCallbacks();
    	
    	sceRtcGetCurrentTick( &fpsTickLast );
    	tickResolution = sceRtcGetTickResolution();
     
    	dList = memalign( 16, 640 );
    	fbp0  = 0;
     
    	InitGU();
    	SetupProjection();
     
    	while( 1 )
    	{
    		DrawScene();
    		FPS();
    		//sceDisplayWaitVblankStart();
    		fbp0 = sceGuSwapBuffers();
            }
     
    	sceGuTerm();			// Terminating the Graphics System
     
    	// Free Memory
    	free( dList );
    	free( fbp0 );
     
    	sceKernelExitGame();
    	return 0;
    }
    Code:
    TARGET			= LessonOne
    OBJS			= ./main.o 
    
    INCDIR			=
    LIBDIR			=
    LDFLAGS			=
    LIBS			= -lpspgum -lpspgu -lpsprtc -lstdc++ -lm		
    CFLAGS			= -O2 -G0 -Wall
    CXXFLAGS		= $(CFLAGS) -fno-exceptions -fno-rtti
    ASFLAGS			= $(CFLAGS)
    
    BUILD_PRX = 1
    
    EXTRA_TARGETS	= EBOOT.PBP
    PSP_EBOOT_TITLE	= Lesson1
    
    PSPSDK			= $(shell psp-config --pspsdk-path)
    include $(PSPSDK)/lib/build.mak
    
    ./main.o: ./main.cpp 
    	$(CXX) $(CXXFLAGS) -c ./main.cpp -o ./main.o
    Oh, this part:
    Code:
    	sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);
    	sceGumMatrixMode(GU_MODEL);
    	sceGumLoadIdentity();
    	{
    	ScePspFVector3 move = { 3.0f, 0.0f, 0.0f };
    	sceGumTranslate( &move );
        }
        // Draw Triangle
    What does the brackets around the move variables do?

    Ty:Punk:
    [SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
    [i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]

  17. #9707
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    Off the top of my head I can't see any mistakes, it sounds like the image is being drawn off screen, if being drawn at all. Try changing:

    Code:
    ScePspFVector3 move = { 3.0f, 0.0f, 0.0f };
    to:

    Code:
    ScePspFVector3 move = { 0.0f, 0.0f, 0.0f };
    to keep it centered(ish, can't remember exactly how it works).

    As for what the { } means, move is an array and you're initialising it with 3 values, its then being fed into sceGumTranslate which moves it on the drawing position on the screen by {X, Y, Z}, similar to glTranslatef(X, Y, Z).

    Have you done any OGL stuff on the PC? If not I'd suggest playing around with it first and get a feel for 3D developing, then move to GU once you have an understanding of how things work; DirectX/OGL/GU is harder than most 2D libraries to learn so it'd be worth your time learning on the PC where mistakes are easier to rectify.

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  18. #9708
    QJ Gamer Blue
    Points: 5.672, Level: 48
    Level completed: 61%, Points required for next Level: 78
    Overall activity: 32,0%

    Registriert seit
    Dec 2007
    Ort
    Netherlands
    Beiträge
    148
    Points
    5.672
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Hmm, okay.
    But I actually meant the { after loadIdentity.
    [SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
    [i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]

  19. #9709
    QJ Gamer Blue
    Points: 3.795, Level: 38
    Level completed: 97%, Points required for next Level: 5
    Overall activity: 27,0%

    Registriert seit
    Jul 2007
    Beiträge
    296
    Points
    3.795
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    The curly-brackets that separate the two lines you are talking about simply put them in a new scope.

    Also, ScePspFVector3 is not an array, it's a structure.

    Additionally, a PRX has 64kb of heap by default.

    As for your actual problem, try moving the polygon back by translating it a bit on the z axis.

    Like:
    PHP-Code:
    ScePspFVector3 move;
    move.3.0f;
    move.0.0f;
    move.3.0f// Or -3.0f, I can't remember which direction is positive on the z axis on the PSP.

    sceGumTranslate(&move); 

  20. #9710
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    Haha, sorry I didn't realise.

    Its a scope; any variable declared in a scope is removed from the stack at the end of that scope, for example:

    Code:
    int intA;
    
    int newFunc()
    {
    	//this function can access intA as its a global
    }
    
    int main()
    {
    	int intB = 1;
    	
    	//we can access intA and intB here
    	
    	{
    		int intC;
    		
    		//this scope can access intA, intB and intC
    		{
    			int intD;
    			
    			//here we can access intA, intB, intC
    		} //when we've reached this intD is no longer availabe
    	}
    	
    	//we can access intA and intB here, but not intC as it no longer exists
    	
    	{
    		int intC;
    		
    		//we can reuse the variable here as it was removed at the end of the scope
    	}
    	
    	if(intB == 1)
    	{
    		char string[256];
    		
    		//string is available in this scope
    	}
    	
    	//string is no longer available here
    }
    Its handy if you need to work with a large string or a set of variables, but only want to use it for a small period of time.

    I think _dysfunctional is right as well, I hadn't thought about the Z axis. Negative is closer towards us and positive is futher away though, so the possitive is correct... and yeah, ignore my dumb comment on the array, an array would be something like char string[256];

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  21. #9711
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    I want to create a basic file transfer and chat client in C/++, but I'm not sure where to start from. I believe I need to use sockets, but I can't find a good guide as they all seem to be totally different from each other. Are sockets cross platform? If so do any of you know a good tutorial on sockets?

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  22. #9712
    xMod.
    Points: 4.576, Level: 43
    Level completed: 13%, Points required for next Level: 174
    Overall activity: 0%

    Registriert seit
    Oct 2008
    Ort
    Melbourne, Australia
    Beiträge
    675
    Points
    4.576
    Level
    43
    My Mood
    Daring
    Downloads
    0
    Uploads
    0

    Standard

    im pretty sure that theres a sample in the sdk that sends a string over adhoc to a second psp

  23. #9713
    QJ Gamer Blue
    Points: 5.672, Level: 48
    Level completed: 61%, Points required for next Level: 78
    Overall activity: 32,0%

    Registriert seit
    Dec 2007
    Ort
    Netherlands
    Beiträge
    148
    Points
    5.672
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    I think he meant from PC to PC, although this is in the PSP Development Forum:o
    [SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
    [i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]

  24. #9714
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    Yeah I meant for PC-PC transfers... its a PSP development forum but a C/++ thread, and hey, saves me signing up to some other website for 1 question... plus I've come to trust the opinions of quite a few devs on here, even if their method seems awkward at first.

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  25. #9715
    QJ Gamer Green
    Points: 5.712, Level: 48
    Level completed: 81%, Points required for next Level: 38
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    USA SC/NC
    Beiträge
    699
    Points
    5.712
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Auraomega, http://beej.us/guide/bgnet/
    Try to finish most of the tutorial and memorize some basic functions and structures. If you can do that, then you will find network programming a piece of cake ;) . If you can't, there's always the .NET framework.
    [CODE]Random Facts:
    irc://irc.malloc.us #wtf #**********
    [/CODE]

    [SIZE="6"][FONT="Century Gothic"][COLOR="Blue"][URL="http://forums.**********.net"]http://forums.**********.net[/URL][/COLOR][/FONT][/SIZE]

  26. #9716
    QJ Gamer Blue
    Points: 3.795, Level: 38
    Level completed: 97%, Points required for next Level: 5
    Overall activity: 27,0%

    Registriert seit
    Jul 2007
    Beiträge
    296
    Points
    3.795
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    Gah, my head hurts so bad. I think I see aComa coming.

  27. #9717
    QJ Gamer Blue
    Points: 1.997, Level: 26
    Level completed: 97%, Points required for next Level: 3
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Feb 2009
    Beiträge
    9
    Points
    1.997
    Level
    26
    Downloads
    0
    Uploads
    0

    Standard

    Ok, so I have this square. That rotates in a circle when I press R. It rotates fine, but I am trying to use oslibprintf to print the current angle as it rotates. (to help me debug)

    It's rotating fine with this
    Code:
    if (osl_keys->held.R)
    	{
    		square_t->angle++;
    	}
    But this is how I am trying to print it. I really don't know exactly what to write. I thought %i displays the variable (read something like that in a tut,)
    Code:
    oslPrintf_xy(20,20, " Rotation Degree: %i",square_t->angle);
    My compiler gives me an error on this line saying : warning: format '%i' expects type 'int', but argument 3 has type 'double'

  28. #9718
    Developer
    Points: 7.577, Level: 58
    Level completed: 14%, Points required for next Level: 173
    Overall activity: 0%

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

    Standard

    Use %f.

    See http://www.cplusplus.com/reference/c...io/printf.html for more information, including what %i is actually for.

    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

  29. #9719
    QJ Gamer Blue
    Points: 1.997, Level: 26
    Level completed: 97%, Points required for next Level: 3
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Feb 2009
    Beiträge
    9
    Points
    1.997
    Level
    26
    Downloads
    0
    Uploads
    0

    Standard

    Ok, well, I used f%, and it still doesn't work. So I'm thinking there might be another problem. Maybe my print command is in the wrong place?

    and what are all the initializations that i need before it?

    edit:

    aha. yeah. it was in the wrong place. it's working now. thanks

    -=Double Post Merge =-
    Ok, This is probably and easy one.

    I'm trying to change the position on my sprite when the value of my function is between 1 and 22

    if (square_t->angle = >1 && <22 ) sprite_position = URIGHT;

    All I really wanna know is how I should write the bolded part?
    Geändert von Jmaxx (02-19-2009 um 08:22 PM Uhr) Grund: Automerged Doublepost

  30. #9720
    OMFG
    Points: 19.453, Level: 88
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Toronto
    Beiträge
    2.814
    Points
    19.453
    Level
    88
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    if ( ( square_t->angle >= 1 ) && ( square_t->angle < 22 ) )
    	sprite_position = URIGHT;


 

Tags for this Thread

Forumregeln

  • Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
  • Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
  • Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
  • Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.
  •  





Alle Zeitangaben in WEZ -8. Es ist jetzt 09:27 PM Uhr.

Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © , Caputo Media, LLC. All Rights Reserved. Cluster .