how to make code Slim compatible?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

how to make code Slim compatible?

Post by jojojoris »

I'm nog a verry beginner but i don't understand why some programs only run under 1.50 kernel and others on both 1.50 and 3.xx . So what i want to know is: What makes a program a 1.50 one or a 3.xx one. I only have a psp slim so i can't run the 1.50 progams.

My other question is:
How can i make the SDK sample codes 3.xx compatible. I've here the Debug/kprintf sample witch is not 3.xx compatible.

(If you can find a topic where it's explained, please give the link. I spend minutes but i didn't find any good topics/tutorials)

What have i to change to get is 3.xx compatible
main.c

Code: Select all

/*
 * PSP Software Development Kit - http://www.pspdev.org
 * -----------------------------------------------------------------------
 * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
 *
 * main.c - Basic sample to demonstrate the kprintf handler.
 *
 * Copyright &#40;c&#41; 2005 Marcus R. Brown <[email protected]>
 * Copyright &#40;c&#41; 2005 James Forshaw <[email protected]>
 * Copyright &#40;c&#41; 2005 John Kelley <[email protected]>
 *
 * $Id&#58; main.c 1095 2005-09-27 21&#58;02&#58;16Z jim $
 */
#include <pspkernel.h>
#include <pspdebug.h>

PSP_MODULE_INFO&#40;"KPTEST", 0x1000, 1, 1&#41;;
/* Define the main thread's attribute value &#40;optional&#41; */
PSP_MAIN_THREAD_ATTR&#40;0&#41;;

/* Define printf, just to make typing easier */
#define printf	pspDebugScreenPrintf

/* Exit callback */
int exit_callback&#40;int arg1, int arg2, void *common&#41;
&#123;
	sceKernelExitGame&#40;&#41;;

	return 0;
&#125;

/* Callback thread */
int CallbackThread&#40;SceSize args, void *argp&#41;
&#123;
	int cbid;

	cbid = sceKernelCreateCallback&#40;"Exit Callback", exit_callback, NULL&#41;;
	sceKernelRegisterExitCallback&#40;cbid&#41;;

	sceKernelSleepThreadCB&#40;&#41;;

	return 0;
&#125;

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks&#40;void&#41;
&#123;
	int thid = 0;

	thid = sceKernelCreateThread&#40;"update_thread", CallbackThread, 0x11, 0xFA0, THREAD_ATTR_USER, 0&#41;;
	if&#40;thid >= 0&#41;
	&#123;
		sceKernelStartThread&#40;thid, 0, 0&#41;;
	&#125;

	return thid;
&#125;

int main&#40;void&#41;
&#123;
	pspDebugScreenInit&#40;&#41;;
	SetupCallbacks&#40;&#41;;

	printf&#40;"Kprintf Example&#58;\n\n"&#41;;

	pspDebugInstallKprintfHandler&#40;NULL&#41;;

	printf&#40;"Lets test a kernel function error report\n"&#41;;
	pspDebugScreenSetTextColor&#40;0xFF&#41;;
	/* Try and load a module, this should print an error to the screen */
	sceKernelLoadModule&#40;"test&#58;/this/is/not/a/file.prx", 0, NULL&#41;;
	pspDebugScreenSetTextColor&#40;0xFFFFFFFF&#41;;
	printf&#40;"\nLets call Kprintf directly\n"&#41;;
	pspDebugScreenSetTextColor&#40;0xFF&#41;;
	Kprintf&#40;"Hello from Kprintf\n"&#41;;
	
	/* Let's bug out */
	sceKernelExitDeleteThread&#40;0&#41;;

	return 0;
&#125;
Makefile:

Code: Select all

TARGET = kptest
OBJS = main.o

INCDIR = 
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $&#40;CFLAGS&#41; -fno-exceptions -fno-rtti
ASFLAGS = $&#40;CFLAGS&#41;

LIBDIR =
LDFLAGS =

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Kprintf Test

PSPSDK=$&#40;shell psp-config --pspsdk-path&#41;
include $&#40;PSPSDK&#41;/lib/build.mak
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

If i count only my own replies to this specific question i will die of age before i finish...Many other time people here demonstrated theirself unkind telling only to "USE SEARCH BUTTON" for far more exotical questions...
pspZorba
Posts: 156
Joined: Sat Sep 22, 2007 11:45 am
Location: NY

Post by pspZorba »

Yes I don't know what happened to me yesterday.. ;-)
--pspZorba--
NO to K1.5 !
Post Reply