[PSPSDK] Problema con codigo de plugin
Publicado: 18 May 2011, 01:51
por asmb
codigo del main.c
codigo del Makefile
el problema esque después de que se activa con gatiilo L y
lo desactivo con gatillo L + Circulo no puedo entrar a video ni musica ni nada se paran todos los threads y no se que sea por favor ayuda ya no se que hacer

Spoiler:
Código: Seleccionar todo
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdbool.h>
#include <pspsdk.h>
#include <pspreg.h>
#include <kubridge.h>
#include <pspctrl.h>
#include <pspthreadman_kernel.h>
#include <psprtc.h>
#include <systemctrl_se.h>
PSP_MODULE_INFO("SampleGUI", PSP_MODULE_KERNEL, 0, 0 );
#define deactivate 0
#define activate 1
#define MAX_NUMBER_OF_THREADS 64
#define PAGE_SIZE 31 //
#define MAX_ENTRIES 1000 //
int scePower_0442D852(int unknown);
void ThreadsStatChange( bool stat, SceUID thlist[], int thnum );
int stop_flag;
SceUID st_thlist_first[MAX_NUMBER_OF_THREADS];
int st_thnum_first;
SceUID thlist[MAX_NUMBER_OF_THREADS];
int thnum;
// Variables que usaremos para leer las puslaciones y activar/desactivar el USB
SceCtrlData pad, lastpad;
int USB = deactivate, lastUSB = deactivate;
///******************* HILO PRINCIPAL *******************///
int main_thread(SceSize argc, void* argp)
{
while(1) // Ciclo del plugin
{
sceKernelGetThreadmanIdList( SCE_KERNEL_TMID_Thread, thlist, MAX_NUMBER_OF_THREADS, &thnum );
// PULSACIONES
sceCtrlReadBufferPositive(&pad, 1); // Leemos las pulsaciones
if(pad.Buttons != lastpad.Buttons)
{
lastpad = pad;
if(pad.Buttons & PSP_CTRL_LTRIGGER) // GATILLO L se desactiva el USB
{
pspDebugScreenSetBackColor(0xFF00F3F3);
pspDebugScreenSetTextColor(0xFF000000);
pspDebugScreenInit();
pspDebugScreenSetXY(10,10);
pspDebugScreenKprintf("Status: %d", USB);
pspDebugScreenSetXY(10,12);
pspDebugScreenKprintf("Desea salir ?");
pspDebugScreenSetXY(10,14);
pspDebugScreenKprintf("YES = O, No = X");
sceKernelSuspendAllUserThreads();
if(pad.Buttons & PSP_CTRL_CIRCLE)
{
pspDebugScreenSetXY(10,16);
pspDebugScreenKprintf("YES = O");
ThreadsStatChange( true, thlist, thnum );
}
else if(pad.Buttons & PSP_CTRL_CROSS)
{
pspDebugScreenSetXY(10,16);
pspDebugScreenKprintf("No = X");
}
}
}
sceKernelDelayThread(50000);
}
return 0;
}
///******************* DEFINICIÓN DEL HILO *******************///
int module_start(SceSize args, void *argp)
{
int thid = sceKernelCreateThread("SampleGUI", main_thread, 0x30, 0x1000, 0, NULL);
if(thid >= 0) sceKernelStartThread(thid, args, argp);
return 0;
}
void ThreadsStatChange( bool stat, SceUID thlist[], int thnum )
{
int ( *request_stat_func )( SceUID ) = NULL;
int i, j;
SceUID selfid = sceKernelGetThreadId();
if( stat ){
request_stat_func = sceKernelResumeThread;
} else{
request_stat_func = sceKernelSuspendThread;
}
SceKernelThreadInfo status;
for( i = 0; i < thnum; i++ ){
bool no_target = false;
for( j = 0; j < st_thnum_first; j++ ){
if( thlist[i] == st_thlist_first[j] || selfid == thlist[i] ){
no_target = true;
break;
}
}
sceKernelReferThreadStatus(thlist[i], &status);
if( ! no_target ) ( *request_stat_func )( thlist[i] );
}
}
codigo del Makefile
Spoiler:
TARGET = SampleGUI
OBJS = main.o
PSP_FW_VERSION = 500
BUILD_PRX = 1
USE_KERNEL_LIB = 1
CLASSG_LIBS = libs
INCDIR = $(CLASSG_LIBS)
CFLAGS = -Os -G0 -Wall -fno-strict-aliasing -fno-builtin-printf
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBS = -lpspreg -lpsprtc
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build_prx.mak
OBJS = main.o
PSP_FW_VERSION = 500
BUILD_PRX = 1
USE_KERNEL_LIB = 1
CLASSG_LIBS = libs
INCDIR = $(CLASSG_LIBS)
CFLAGS = -Os -G0 -Wall -fno-strict-aliasing -fno-builtin-printf
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBS = -lpspreg -lpsprtc
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build_prx.mak
el problema esque después de que se activa con gatiilo L y
lo desactivo con gatillo L + Circulo no puedo entrar a video ni musica ni nada se paran todos los threads y no se que sea por favor ayuda ya no se que hacer

