JGE++: A hardware accelerated 2D game engine for PSP/Windows

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

Moderators: cheriff, TyRaNiD

User avatar
harleyg
Posts: 123
Joined: Wed Oct 05, 2005 6:15 am

Post by harleyg »

Code: Select all

(harleyg@mainbox) (~/psp/jge/JGE)-(17:51:23) $  make
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall    -c -o src/JApp.
o src/JApp.cpp
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall    -c -o src/JColl
ision.o src/JCollision.cpp
src/../include/JTypes.h:298: error: ISO C++ forbids declaration of 'UNIMOD' with
 no type
src/../include/JTypes.h:298: error: expected ';' before '*' token
make: *** [src/JCollision.o] Error 1
:)

edit: needed mikmodlib, thanks oopo and tyranide!
mauve.simian
Posts: 5
Joined: Sun Apr 09, 2006 6:51 am

vc++ express

Post by mauve.simian »

[edit] Ignore me, that's not the problem, just stepped through again and noticed that JLBFont::SetColor calls JQuad::SetColor. The actual problem was simply that the when in debug mode it couldn't find the Res folder, because its executing from a different directory than the bin directory. Nothing to see here, keep moving.[edit]

Hi, just wondering if anyone has tried this with Visual C++ 2005 Express. Have got it all set up and the examples compile fine. But am having a slight problem with the debugger. I am wanting to debug some file loading routines I have in my game, which need to work differently for Windows than on the PSP.

However, when I debug in VC, when it comes to executing the menu rendering code, the debugger is picking the JQuad::SetColor implementation even though the call is made on a JLBFont object. I haven't worked that much with Visual C++ for a long time. Was just wondering if anyone has run into this or a similar problem and knows if there is a fix.
dr_watson
Posts: 42
Joined: Mon Nov 28, 2005 11:30 am

Re: vc++ express

Post by dr_watson »

mauve.simian wrote:[edit] Ignore me, that's not the problem, just stepped through again and noticed that JLBFont::SetColor calls JQuad::SetColor. The actual problem was simply that the when in debug mode it couldn't find the Res folder, because its executing from a different directory than the bin directory. Nothing to see here, keep moving.[edit]
...
Yes, you need to setup your project's "working directory" to point to the "bin" directory to debug properly. The included demos have that setup already but I forgot to mention about it.
mauve.simian
Posts: 5
Joined: Sun Apr 09, 2006 6:51 am

memory leak

Post by mauve.simian »

Dr Watson, while investigating large memory leaks in my own code (good liberal use of 'delete's when should be using 'delete[]'s), I found one in the JGE library. Your windows implementation of JGE::FreeTexture doesn't actually call delete on the texture pointer. It deletes the underlying pixel data, but not the actual pointer. I know it's not a lot of memory it'll be leaking, but just thought I'd let you know. Having looked through the PSP implementation it does the delete fine there so shouldn't be a problem.
dr_watson
Posts: 42
Joined: Mon Nov 28, 2005 11:30 am

Re: memory leak

Post by dr_watson »

mauve.simian wrote:Dr Watson, while investigating large memory leaks in my own code (good liberal use of 'delete's when should be using 'delete[]'s), I found one in the JGE library. Your windows implementation of JGE::FreeTexture doesn't actually call delete on the texture pointer. It deletes the underlying pixel data, but not the actual pointer. I know it's not a lot of memory it'll be leaking, but just thought I'd let you know. Having looked through the PSP implementation it does the delete fine there so shouldn't be a problem.
Thanks for the information. The fix will be in the next release :)
bada
Posts: 4
Joined: Thu Apr 27, 2006 9:18 pm

Post by bada »

nice work but poor makefile, here my makefile that allow you free use .h and .cpp files to make clear structure .... all files that changed would be rebuild and correct builds dependicies
here my project structure
game /
../res/
../src/
../build/
makefile

type
make all - to build all in .pdp
make xpl - to make two directories in /build .. game/ and game%/
make xplmv - to build and copy dirs to your psp

if you need you can change parametres in makefile

Code: Select all

# type "make all" to invoke rule for build
# this makefile copies itself to BINDIR and invoke make for itself
#  that why RESDIR and SDCDIR has one nesting 

#type "make clean" for remove all files from BINDIR

#type "make xpl" for making two dirs(with TARGET name and TARGET% name)
#in BINDIR with exec files for psp

#type "make xplmv" for making two dirs(with TARGET name and TARGET% name) 
#in BINDIR with exec files for psp
#removing dirs in PSP_PATH with same name
#copy dirs to psp and copy RESDIR to TARGET dir on psp


TARGET = test

PSP_PATH = f:/psp/game

RESDIR = ../res
SRCDIR = ../src

BINDIR = build


SOURCES  := $(wildcard $(SRCDIR)/*.cpp) 
SOURCES  := $(subst $(SRCDIR)/,,$(SOURCES))


OBJS := $(patsubst %.cpp,%.o,$(SOURCES))

DEPS := $(patsubst %.o,%.d,$(OBJS))


CFLAGS = -O2 -G0 -Wall 
CXXFLAGS = $(CFLAGS) -fno-rtti
ASFLAGS = $(CXXFLAGS)


LDFLAGS =
LIBS = -lpng -lz -lm -lmikmod -lpspaudiolib -lpspaudio -lpspgu -lstdc++ -lpsprtc

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = test
PSP_EBOOT_ICON = $(RESDIR)/icons/icon0.png
PSP_EBOOT_ICON1 = $(RESDIR)/icons/icon0.png  

#PSP_EBOOT_PIC1 = AnotherPath/PIC1.PNG 
#PSP_EBOOT_SND0 = SND0 


# pathes where make would search for files if dont find in current dir
VPATH = $(SRCDIR) $(RESDIR)

#this is all predefined variables nedeed for psp compiling
#begin include predefinedpsp

PSPSDK=$(shell psp-config --pspsdk-path)

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

INCDIR   := $(INCDIR) . $(PSPSDK)/include
LIBDIR   := $(LIBDIR) . $(PSPSDK)/lib

CFLAGS   := $(addprefix -I,$(INCDIR)) $(CFLAGS)
CXXFLAGS := $(CFLAGS) $(CXXFLAGS)
ASFLAGS  := $(CFLAGS) $(ASFLAGS)

LDFLAGS  := $(addprefix -L,$(LIBDIR)) $(LDFLAGS)

PSPSDK_LIBC_LIB = -lc
ifeq ($(USE_PSPSDK_LIBC),1)
PSPSDK_LIBC_LIB = -lpsplibc
CFLAGS := -I$(PSPSDK)/include/libc $(CFLAGS)
endif

PSPSDK_LIBS = -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lpsppower
LIBS     := $(LIBS) $(PSPSDK_LIBS) $(PSPSDK_LIBC_LIB) -lpsputility -lpspuser -lpspkernel

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

ifneq ($(TARGET_LIB),)
FINAL_TARGET = $(TARGET_LIB)
else
FINAL_TARGET = $(TARGET).elf
endif

#end include predefinedpsp

#dont allow make to find such files (if they are exist)
.PHONY : all deps clean kxploit kxploitmv me xpl xplmv

me: $(PSP_EBOOT)

all: 
	cp -t "$(BINDIR)" -f Makefile
	cd $(BINDIR); make me;

deps: $(DEPS)

# rule for dependencies
# make .d file from .cpp and if .cpp changed then remake .d and remove .o 
# removing .o cause rebild .o file and relink it
%.d: %.cpp
	$(CC) $(CXXFLAGS) -MM $(SRCDIR)/$(subst .d,.cpp,$@) > $@
	rm -f $(subst .d,.o,$@)


#include dependencies files
include $(DEPS)

	
$(TARGET).elf:$(OBJS)
	$(LINK.c) $(OBJS) $(LIBS) -o $@
	$(FIXUP) $@


$(PSP_EBOOT_SFO): 
	$(MKSFO) '$(PSP_EBOOT_TITLE)' $@

$(PSP_EBOOT): $(TARGET).elf $(PSP_EBOOT_SFO)
	$(STRIP) $(TARGET).elf -o $(TARGET)_strip.elf
	$(PACK_PBP) $(EXTRA_TARGETS) "$(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


clean: 
	cd build; rm -f $(FINAL_TARGET) *.o $(PSP_EBOOT_SFO) $(PSP_EBOOT) $(EXTRA_TARGETS) *.d Makefile
	
# make exec for psp
kxploit: $(TARGET).elf $(PSP_EBOOT_SFO)
	rm -f -r "$(TARGET)"
	rm -f -r "$(TARGET)%"
	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) 

# make exec for psp and copy to psp with resources
kxploitmv: $(TARGET).elf $(PSP_EBOOT_SFO)
	rm -f -r "$(TARGET)"
	rm -f -r "$(TARGET)%"
	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) 
#	rm -f -r "$(PSP_PATH)/$(TARGET)"
#	rm -f -r "$(PSP_PATH)/$(TARGET)%"
	cp -t "$(PSP_PATH)" -r "$(TARGET)"
	cp -t "$(PSP_PATH)" -r "$(TARGET)%"
#	cp -t "$(PSP_PATH)/$(TARGET)" -r "$(RESDIR)"

xpl:
	cp -t "$(BINDIR)" -f Makefile
	cd $(BINDIR);make kxploit;

xplmv:
	cp -t "$(BINDIR)" -f Makefile
	cd $(BINDIR);make kxploitmv;
dr_watson
Posts: 42
Joined: Mon Nov 28, 2005 11:30 am

Post by dr_watson »

Thanks bada! I have zero knowledge on making my own "makefile". May I include yours in the next release?
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

now that is one excessive makefile ...trimming is needed
before this could be deamed "release" worthy

...think of the children ;)
10011011 00101010 11010111 10001001 10111010
bada
Posts: 4
Joined: Thu Apr 27, 2006 9:18 pm

Post by bada »

to dr_watson
yes, sure you can use this makefile )))

and if anybody want make this file more cleare you are wellcome

..also i make some adding to your engine, maybe somedays i post them )))
i try to make some platformer but i use for Ai finite state machine, like you use in game states. its very handy. also resource manager would be very nedeed. and so on and so on )))


sorry for bad english ))
rock_light
Posts: 4
Joined: Tue Jun 14, 2005 6:12 am

Post by rock_light »

Hi there looking to get into programming a megaman clone was just wondering if this engine was able of handling a game like that.

I have no programming expirence and have been searching through haff's forums and turorials looking for a way to design the levels and stuff.

Trying to use visual studio to work on my projects. I was just wondering if this qaf 'framework' was compatible with jge. Looks to be designed for use with hge.

It's a dream of mine to make megaman games and would apreciate any help
or info towards getting results. Hopefully using this engine cuz it looks awesome!!!
Hi hey hello
Post Reply