KINGx - Das inoffizielle PlayStation Forum & News Portal

Normale Version: [Code-Only - Bitte verschieben!] Ein VLF-Menü
Sie sehen gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.

PHP-Code:
//ctr0.c
#include <pspsdk.h>
#include <pspkernel.h>
#include <stdio.h>

#include <vlf.h>

extern int app_main();

int start_thread(SceSize argsvoid *argp)
{
    
SceUID mod;
    
char *path = (char *)argp;
    
int last_trail = -1;
    
int i;

    if (
path)
    {
        for (
0path[i]; i++)
        {
            if (
path[i] == '/')
                
last_trail i;
        }
    }

    if (
last_trail >= 0)
        
path[last_trail] = 0;

    
sceIoChdir(path);
    
path[last_trail] = '/';

    
mod sceKernelLoadModule("iop.prx"0NULL);
    
mod sceKernelStartModule(modargsargpNULLNULL);
    
mod sceKernelLoadModule("intraFont.prx"0NULL);
    
mod sceKernelStartModule(modargsargpNULLNULL);
    
mod sceKernelLoadModule("vlf.prx"0NULL);
    
mod sceKernelStartModule(modargsargpNULLNULL);
    
vlfGuiInit(-1app_main);
    
    return 
sceKernelExitDeleteThread(0);
}

int module_start(SceSize argsvoid *argp)
{
    
SceUID thid sceKernelCreateThread("start_thread"start_thread0x100x40000NULL);
    if (
thid 0)
        return 
thid;

    
sceKernelStartThread(thidargsargp);
    
    return 
0;

PHP-Code:
//main.c
#include <pspsdk.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include <psprtc.h>
#include <pspgu.h>
#include <pspgum.h>
#include <stdlib.h>
#include <stdio.h>

#include <vlf.h>


PSP_MODULE_INFO("Hallo_Welt",1,1,0);

PSP_MAIN_THREAD_ATTR(0);

VlfText title;

int Exit()    // Exit funktion
{
    
sceKernelExitGame();    //Gibt an das das Programm verlassen werden soll.
    
return VLF_EV_RET_NOTHING;  //es soll nichts weiter geschehen.
}

int MenuSel(int sel)
{
    switch(
sel)
    {
        case 
0:
            
//Alles mögliche tun...
            
break;
        
        case 
1:
            
//...und sonst noch was
            
break;
            
        case 
2:
            Exit();
            break;
            
        
/*...*/
    
}
    return 
VLF_EV_RET_NOTHING;
}

void MainMenu(int sel)
{
    
charitems[] = {
        
"-nichts tun-",
        
"-nichts tun-",
        
"Beenden"
    
};
    
vlfGuiCentralMenu(3,items,0,MenuSel,0,0);
}

int app_main()
{
    
vlfGuiSystemSetup(1,1,1); //vlfGuiSystemSetup(Batterieanzeige, Zeit/Datum,
    //und der Hintergrund);
    
vlfGuiCacheResource("system_plugin");
    
vlfGuiCacheResource("system_plugin_fg");
    
title vlfGuiAddText(0,0,"VLF Menü!!!");
    
    
vlfGuiSetTitleBar(title,NULL,1,0);
    
    
MainMenu(0);
    
    while(
1)
    {
        
vlfGuiDrawFrame();
    }
    
    return 
0;

Makefile:

PHP-Code:
TARGET vlf_basic_menu
OBJS 
crt0.o main.

INCDIR 
= ../../include
CFLAGS = -O2 -G0 -Wall -fshort-wchar -fno-pic -mno-check-zero-division 
CXXFLAGS 
= $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS 
= $(CFLAGS) -c

LIBDIR 
= ../../lib
LDFLAGS 
= -mno-crt0 -nostdlib -nodefaultlibs
LIBS 
= -lvlfgui -lvlfgu -lvlfutils -lvlflibc

PSP_FW_VERSION 
271

EXTRA_TARGETS 
EBOOT.PBP
PSP_EBOOT_TITLE 
VLF Menu Test
PSP_EBOOT_ICON 
icon0.png

BUILD_PRX 
1
PSP_LARGE_MEMORY 
1

PSPSDK
=$(shell psp-config --pspsdk-path)
include ./
build.mak 

build.mak:

Spoiler: (anzeigen)
Mach die Codes bitte in Spoiler rein

qutster :
Mach die Codes bitte in Spoiler rein

Hab keine Ahnung, wie...

Code:
[spoiler][/spoiler]


aber ich finds ohne besser

Hab grad keinen Computer zur hand, und auf der PSP funktioniert das bearbeiten nicht, auf dem iTouch kann ich den Text nicht scrollen. Wird also noch etwas dauern, bis ich die spoiler einfügen kann Sad
Die Erklärungen der Codes sind mehr als schlecht und ein "ich weiß nicht was der Code macht" in einem "Tutorial" ist echt erbärmlich!
<gelöscht>

Code:
//main.c
#include <pspsdk.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include <psprtc.h>
#include <pspgu.h>
#include <pspgum.h>
#include <stdlib.h>
#include <stdio.h>

#include <vlf.h>
//Dateien inkludieren,damit die VLF-Libary läuft.

PSP_MODULE_INFO("Hallo_Welt",1,1,0); //Homebrew informationen

PSP_MAIN_THREAD_ATTR(0);

VlfText title;

int Exit()    // Exit funktion
{
    sceKernelExitGame();    //Gibt an das das Programm verlassen werden soll.
    return VLF_EV_RET_NOTHING;  //es soll nichts weiter geschehen.
}

int MenuSel(int sel) //in der Menu auswahl
{
    switch(sel)
    {
        case 0: //wenn der erste eintrag gewählt ist
            //Alles mögliche tun...
            break;
        
        case 1: //wenn der zweite eintrag gewählt ist
            //...und sonst noch was
            break;
            
        case 2:
            Exit(); // die Exit funktion zum beenden des programms
            break;
            
        /*...*/
    }
    return VLF_EV_RET_NOTHING; //es soll nicht mehr geschehen
}

void MainMenu(int sel) //void funktion names MainMenu
{
    char* items[] = { //char array namens items
        "-nichts tun-",
        "-nichts tun-",
        "Beenden"
    };
    vlfGuiCentralMenu(3,items,0,MenuSel,0,0); //es soll ein centralmenu anzeigen
}

int app_main() //int-funktion dass in der ctr0 als start funktion ausgewählt ist
{
    vlfGuiSystemSetup(1,1,1); //vlfGuiSystemSetup(Batterieanzeige, Zeit/Datum,
    //und der Hintergrund);
    vlfGuiCacheResource("system_plugin"); //eig unnötig
    vlfGuiCacheResource("system_plugin_fg"); //..
    title = vlfGuiAddText(0,0,"VLF Menü!!!"); //der text oben in der titlebar
    
    vlfGuiSetTitleBar(title,NULL,1,0);  //titlebar anzeigen mit dem text von title
    
    MainMenu(0); //MainMenu funktion soll ausgeführt werden
    
    while(1)
    {
        vlfGuiDrawFrame();
    }
    
    return 0;
}


Hab's mal etwas verbessert !
hier ist eig. viel unnötiger code drine !

Referenz-URLs