|
Verfasser |
Nachricht |
vielesysteme
Junior Mitglied
Beiträge: 32
Gruppe: User
Registriert seit: Jun 2011
Status:
Offline
Danke erhalten: 4
|
[Code-Only - Bitte verschieben!] Ein VLF-Menü
//ctr0.c #include <pspsdk.h> #include <pspkernel.h> #include <stdio.h>
#include <vlf.h>
extern int app_main();
int start_thread(SceSize args, void *argp) { SceUID mod; char *path = (char *)argp; int last_trail = -1; int i;
if (path) { for (i = 0; path[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", 0, NULL); mod = sceKernelStartModule(mod, args, argp, NULL, NULL); mod = sceKernelLoadModule("intraFont.prx", 0, NULL); mod = sceKernelStartModule(mod, args, argp, NULL, NULL); mod = sceKernelLoadModule("vlf.prx", 0, NULL); mod = sceKernelStartModule(mod, args, argp, NULL, NULL); vlfGuiInit(-1, app_main); return sceKernelExitDeleteThread(0); }
int module_start(SceSize args, void *argp) { SceUID thid = sceKernelCreateThread("start_thread", start_thread, 0x10, 0x4000, 0, NULL); if (thid < 0) return thid;
sceKernelStartThread(thid, args, argp); return 0; }
//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) { char* items[] = { "-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:
TARGET = vlf_basic_menu OBJS = crt0.o main.o
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:
# PSP Software Development Kit - http://www.pspdev.org # ----------------------------------------------------------------------- # Licensed under the BSD license, see LICENSE in PSPSDK root for details. # # build.mak - Base makefile for projects using PSPSDK. # # Copyright (c) 2005 Marcus R. Brown <mrbrown@ocgnet.org> # Copyright (c) 2005 James Forshaw <tyranid@gmail.com> # Copyright (c) 2005 John Kelley <ps2dev@kelley.ca> # # $Id: build.mak 2333 2007-10-31 19:37:40Z tyranid $
# Note: The PSPSDK make variable must be defined before this file is included. ifeq ($(PSPSDK),) $(error $$(PSPSDK) is undefined. Use "PSPSDK := $$(shell psp-config --pspsdk-path)" in your Makefile) endif
CC = psp-gcc CXX = psp-g++ AS = psp-gcc LD = psp-gcc AR = psp-ar RANLIB = psp-ranlib STRIP = psp-strip MKSFO = mksfo PACK_PBP = pack-pbp FIXUP = psp-fixup-imports
# Add in PSPSDK includes and libraries. INCDIR := $(INCDIR) . $(PSPSDK)/include LIBDIR := $(LIBDIR) . $(PSPSDK)/lib
CFLAGS := $(addprefix -I,$(INCDIR)) $(CFLAGS) CXXFLAGS := $(CFLAGS) $(CXXFLAGS) ASFLAGS := $(CFLAGS) $(ASFLAGS)
ifeq ($(PSP_LARGE_MEMORY),1) MKSFO = mksfoex -d MEMSIZE=1 endif
ifeq ($(PSP_FW_VERSION),) PSP_FW_VERSION=150 endif
CFLAGS += -D_PSP_FW_VERSION=$(PSP_FW_VERSION) CXXFLAGS += -D_PSP_FW_VERSION=$(PSP_FW_VERSION)
ifeq ($(BUILD_PRX),1) LDFLAGS := $(addprefix -L,$(LIBDIR)) -specs=$(PSPSDK)/lib/prxspecs -Wl,-q,-T$(PSPSDK)/lib/linkfile.prx $(LDFLAGS) EXTRA_CLEAN += $(TARGET).elf # Setup default exports if needed ifdef PRX_EXPORTS EXPORT_OBJ=$(patsubst %.exp,%.o,$(PRX_EXPORTS)) EXTRA_CLEAN += $(EXPORT_OBJ) else EXPORT_OBJ=$(PSPSDK)/lib/prxexports.o endif else LDFLAGS := $(addprefix -L,$(LIBDIR)) $(LDFLAGS) endif
# Library selection. By default we link with Newlib's libc. Allow the # user to link with PSPSDK's libc if USE_PSPSDK_LIBC is set to 1.
PSPSDK_LIBC_LIB =
# Link with following default libraries. Other libraries should be specified in the $(LIBS) variable. # TODO: This library list needs to be generated at configure time. # ifeq ($(USE_KERNEL_LIBS),1) PSPSDK_LIBS = -lpspdebug -lpspdisplay_driver -lpspctrl_driver -lpspsdk LIBS := $(LIBS) $(PSPSDK_LIBS) $(PSPSDK_LIBC_LIB) -lpspkernel else ifeq ($(USE_USER_LIBS),1) PSPSDK_LIBS = -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk LIBS := $(LIBS) $(PSPSDK_LIBS) $(PSPSDK_LIBC_LIB) -lpspnet \ -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility \ -lpspuser else PSPSDK_LIBS = -lpspdisplay -lpspge -lpspctrl -lpspsdk LIBS := $(LIBS) $(PSPSDK_LIBS) $(PSPSDK_LIBC_LIB) -lpspnet \ -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility \ -lpspuser -lpspkernel endif endif
# Define the overridable parameters for EBOOT.PBP ifndef PSP_EBOOT_TITLE PSP_EBOOT_TITLE = $(TARGET) endif
ifndef PSP_EBOOT_SFO PSP_EBOOT_SFO = PARAM.SFO endif
ifndef PSP_EBOOT_ICON PSP_EBOOT_ICON = NULL endif
ifndef PSP_EBOOT_ICON1 PSP_EBOOT_ICON1 = NULL endif
ifndef PSP_EBOOT_UNKPNG PSP_EBOOT_UNKPNG = NULL endif
ifndef PSP_EBOOT_PIC1 PSP_EBOOT_PIC1 = NULL endif
ifndef PSP_EBOOT_SND0 PSP_EBOOT_SND0 = NULL endif
ifndef PSP_EBOOT_PSAR PSP_EBOOT_PSAR = NULL endif
ifndef PSP_EBOOT PSP_EBOOT = EBOOT.PBP endif
ifeq ($(BUILD_PRX),1) ifneq ($(TARGET_LIB),) $(error TARGET_LIB should not be defined when building a prx) else FINAL_TARGET = $(TARGET).prx endif else ifneq ($(TARGET_LIB),) FINAL_TARGET = $(TARGET_LIB) else FINAL_TARGET = $(TARGET).elf endif endif
all: $(EXTRA_TARGETS) $(FINAL_TARGET)
kxploit: $(TARGET).elf $(PSP_EBOOT_SFO) mkdir -p "$(TARGET)" $(STRIP) $(TARGET).elf -o $(TARGET)/$(PSP_EBOOT) mkdir -p "$(TARGET)%" $(PACK_PBP) "$(TARGET)%/$(PSP_EBOOT)" $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON) \ $(PSP_EBOOT_ICON1) $(PSP_EBOOT_UNKPNG) $(PSP_EBOOT_PIC1) \ $(PSP_EBOOT_SND0) NULL $(PSP_EBOOT_PSAR)
SCEkxploit: $(TARGET).elf $(PSP_EBOOT_SFO) mkdir -p "__SCE__$(TARGET)" $(STRIP) $(TARGET).elf -o __SCE__$(TARGET)/$(PSP_EBOOT) mkdir -p "%__SCE__$(TARGET)" $(PACK_PBP) "%__SCE__$(TARGET)/$(PSP_EBOOT)" $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON) \ $(PSP_EBOOT_ICON1) $(PSP_EBOOT_UNKPNG) $(PSP_EBOOT_PIC1) \ $(PSP_EBOOT_SND0) NULL $(PSP_EBOOT_PSAR)
$(TARGET).elf: $(OBJS) $(EXPORT_OBJ) $(LINK.c) $^ $(LIBS) -o $@ $(FIXUP) $@
$(TARGET_LIB): $(OBJS) $(AR) cru $@ $(OBJS) $(RANLIB) $@
$(PSP_EBOOT_SFO): $(MKSFO) '$(PSP_EBOOT_TITLE)' $@
ifeq ($(BUILD_PRX),1) $(PSP_EBOOT): $(TARGET).prx $(PSP_EBOOT_SFO) $(PACK_PBP) $(PSP_EBOOT) $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON) \ $(PSP_EBOOT_ICON1) $(PSP_EBOOT_UNKPNG) $(PSP_EBOOT_PIC1) \ $(PSP_EBOOT_SND0) $(TARGET).prx $(PSP_EBOOT_PSAR) else $(PSP_EBOOT): $(TARGET).elf $(PSP_EBOOT_SFO) $(STRIP) $(TARGET).elf -o $(TARGET)_strip.elf $(PACK_PBP) $(PSP_EBOOT) $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON) \ $(PSP_EBOOT_ICON1) $(PSP_EBOOT_UNKPNG) $(PSP_EBOOT_PIC1) \ $(PSP_EBOOT_SND0) $(TARGET)_strip.elf $(PSP_EBOOT_PSAR) -rm -f $(TARGET)_strip.elf endif
%.prx: %.elf psp-prxgen $< $@
%.c: %.exp psp-build-exports -b $< > $@
clean: -rm -f $(FINAL_TARGET) $(EXTRA_CLEAN) $(OBJS) $(PSP_EBOOT_SFO) $(PSP_EBOOT) $(EXTRA_TARGETS)
rebuild: clean all
#ifdef WIN32
#define KILL undef
#KILL WIN32
#endif
Dieser Beitrag wurde zuletzt bearbeitet: 10.07.2011 09:04 von vielesysteme.
|
|
09.07.2011 09:16 |
|
|
|
gutster
Redakteur a.D.
Beiträge: 3.876
Gruppe: User
Registriert seit: Feb 2010
Status:
Offline
Danke erhalten: 3867
|
RE: [TUT] Ein einfaches Menü mit VLF
Mach die Codes bitte in Spoiler rein
|
|
09.07.2011 09:38 |
|
|
|
vielesysteme
Junior Mitglied
Beiträge: 32
Gruppe: User
Registriert seit: Jun 2011
Status:
Offline
Danke erhalten: 4
|
RE: [TUT] Ein einfaches Menü mit VLF
Mach die Codes bitte in Spoiler rein
Hab keine Ahnung, wie...
#ifdef WIN32
#define KILL undef
#KILL WIN32
#endif
|
|
09.07.2011 09:40 |
|
|
|
PhysXPSP
Experte
Beiträge: 606
Gruppe: User
Registriert seit: Nov 2009
Status:
Abwesend
Danke erhalten: 223
|
RE: [TUT] Ein einfaches Menü mit VLF
aber ich finds ohne besser
|
|
09.07.2011 09:51 |
|
|
|
vielesysteme
Junior Mitglied
Beiträge: 32
Gruppe: User
Registriert seit: Jun 2011
Status:
Offline
Danke erhalten: 4
|
RE: [TUT] Ein einfaches Menü mit VLF
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
#ifdef WIN32
#define KILL undef
#KILL WIN32
#endif
|
|
09.07.2011 12:21 |
|
|
|
-blue7
/dev/null/
Beiträge: 1.926
Gruppe: Mod a.D.
Registriert seit: May 2009
Status:
Abwesend
Danke erhalten: 1768
|
RE: [TUT] Ein einfaches Menü mit VLF
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!
[Ex-Moderator] ; [Ubuntu-User] ; [Designer] ; [Coder] ;
running out of bugs`.
___________________________________________
#define TRUE FALSE // Happy debugging suckers
// sometimes I believe gcc ignores all my comments
|
|
09.07.2011 12:28 |
|
Folgende User bedanken sich: |
|
vielesysteme
Junior Mitglied
Beiträge: 32
Gruppe: User
Registriert seit: Jun 2011
Status:
Offline
Danke erhalten: 4
|
RE: [TUT] Ein einfaches Menü mit VLF
#ifdef WIN32
#define KILL undef
#KILL WIN32
#endif
Dieser Beitrag wurde zuletzt bearbeitet: 10.07.2011 09:05 von vielesysteme.
|
|
09.07.2011 13:42 |
|
|
|
3m!n
Legende
Beiträge: 1.652
Gruppe: User
Registriert seit: Aug 2010
Status:
Offline
Danke erhalten: 951
|
RE: [Code-Only - Bitte verschieben!] Ein VLF-Menü
//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 !
|
|
18.07.2011 16:50 |
|
|
|