Membre
Date d'inscription: 22/01/2009
Messages: 17
|
[OSLIB] Problem Blank Screen
Hello I'm new here I'm using oslib to create a game I used the tutorials on this site http://oslib.playeradvance.org/doku.php?id=home . The problem is when I compile and run the game it loads a blank screen, none of the controls respond except for HOME but once you select YES, it freezes. It works without the OSLIB graphic functions. Well here is the code:
main.c
Code:
#include <stdio.h>
#include <string.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspdisplay.h>
#include <pspctrl.h>
#include <pspgu.h>
#include <pspgum.h>
#include <psppower.h>
#include <pspiofilemgr.h>
#include <stdio.h>
#include <pspaudio.h>
#include <pspaudiolib.h>
#include <stdlib.h>
#include <oslib/oslib.h>
#include "graphics.h"
#include "map.h"
PSP_MODULE_INFO("Test Game", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
OSL_IMAGE *map_tileset;
OSL_MAP *map;
OSL_SOUND *menu, *select;
void newGame();
#define lightRed RGB(252,44,44)
#define lightGreen RGB(44,252,44)
#define green RGB(0,128,0)
#define orange RGB(255,128,0)
int main()
{
oslInit(0);
oslInitGfx(OSL_PF_8888, 1);
oslInitConsole();
oslInitAudio();
map_tileset = oslLoadImageFile("Images/tileset.png", OSL_IN_RAM, OSL_PF_5551);
map = oslCreateMap(
map_tileset,
map_map,
16,16,
17,30,
OSL_MF_U16);
menu = oslLoadSoundFile("sounds/beep.wav",OSL_FMT_NONE);
oslAssert(menu);
select = oslLoadSoundFile("sounds/select.wav",OSL_FMT_NONE);
oslAssert(select);
pspDebugScreenInit();
initGraphics();
SceCtrlData pad, lastpad;
sceCtrlReadBufferPositive(&lastpad, 1);
Image* Background;
Background = loadImage("./Images/back.png");
int selComponent = 1;
const int BUFFER_SIZE = 64;
char image_save[BUFFER_SIZE];
int to_save = 0;
Color NEW_GAME = lightGreen;
Color LOAD_GAME = lightGreen;
Color EXTRA = lightGreen;
Color EXIT = lightGreen;
while(!osl_quit)
{
oslStartDrawing();
sceCtrlReadBufferPositive(&pad, 1);
blitAlphaImageToScreen(0, 0 , 480, 272, Background, 0, 0);
if (pad.Buttons != lastpad.Buttons)
{
lastpad = pad;
if (pad.Buttons & PSP_CTRL_UP)
{
oslPlaySound(menu, 1);
selComponent--;
if (selComponent < 1)
selComponent = 4;
}
if (pad.Buttons & PSP_CTRL_DOWN)
{
oslPlaySound(menu, 1);
selComponent++;
if (selComponent > 4)
selComponent = 1;
}
}
if (selComponent == 1)
{
NEW_GAME = lightGreen;
LOAD_GAME = green;
EXTRA = green;
EXIT = green;
}
else if (selComponent == 2)
{
NEW_GAME = green;
LOAD_GAME = lightGreen;
EXTRA = green;
EXIT = green;
}
else if (selComponent == 3)
{
NEW_GAME = green;
LOAD_GAME = green;
EXTRA = lightGreen;
EXIT = green;
}
else if (selComponent == 4)
{
NEW_GAME = green;
LOAD_GAME = green;
EXTRA = green;
EXIT = lightGreen;
}
if(pad.Buttons & PSP_CTRL_CROSS)
{
switch(selComponent)
{
case 1:
oslPlaySound(select, 1);
newGame();
break;
case 2:
sceKernelDelayThread(250000);
oslPlaySound(select, 1);
break;
case 3:
sceKernelDelayThread(250000);
oslPlaySound(select, 1);
break;
case 4:
sceKernelDelayThread(250000);
oslPlaySound(select, 1);
sceKernelExitGame();
break;
default:
//SHOULD NEVER EXECUTE
break;
}
}
if(pad.Buttons & PSP_CTRL_TRIANGLE)
{
snprintf(image_save, BUFFER_SIZE, "ms0:/PICTURE/ScreenShot_%d.png", to_save);
saveImage(image_save, getVramDisplayBuffer(), 480, 272, 512, 0);
to_save++;
}
printTextScreen(65, 120, "New Game", NEW_GAME);
printTextScreen(65, 130, "Load Game", LOAD_GAME);
printTextScreen(65, 140, "Extra", EXTRA);
printTextScreen(65, 150, "Exit Game", EXIT);
printTextScreen(5, 235, "Created by pspmasterpro :)", lightRed);
sceDisplayWaitVblankStart();
flipScreen();
lastpad = pad;
oslAudioVSync();
oslEndDrawing();
oslSyncFrame();
}
oslEndGfx();
oslQuit();
return 0;
}
void newGame()
{
oslCls();
oslDrawMapSimple(map);
}
map.h
Code:
//Converti avec GBA Graphics par Brünni
//Map ("","C:\Users\Owner\Desktop\map.til.c",0,ffffffff)
//Taille: 16*16 * 30*17
//Mémoire: 1020 octets
const unsigned short map_map[17][30]= {
{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001,
0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009,
0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b},
{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x000c, 0x000d,
0x000e, 0x000f, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015,
0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017},
{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0018, 0x0019,
0x001a, 0x001b, 0x001a, 0x001b, 0x001a, 0x001b, 0x001c, 0x001d,
0x001e, 0x001f, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025,
0x0026, 0x0027, 0x0020, 0x0021, 0x0022, 0x0023},
{0x0000, 0x0000, 0x0000, 0x0028, 0x000c, 0x000d, 0x0029, 0x002a,
0x002b, 0x002c, 0x002b, 0x002c, 0x002b, 0x002c, 0x002d, 0x002e,
0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036,
0x0037, 0x0038, 0x0031, 0x0032, 0x0033, 0x0034},
{0x0000, 0x0000, 0x0039, 0x003a, 0x001c, 0x001d, 0x003b, 0x003c,
0x003d, 0x003e, 0x003f, 0x0040, 0x003b, 0x003c, 0x0041, 0x0042,
0x0043, 0x0044, 0x0024, 0x0025, 0x0026, 0x0027, 0x0020, 0x0021,
0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027},
{0x0000, 0x0000, 0x0045, 0x0046, 0x002d, 0x002e, 0x0047, 0x0048,
0x0049, 0x004a, 0x004b, 0x004c, 0x0047, 0x0048, 0x004d, 0x004e,
0x004f, 0x0050, 0x0035, 0x0036, 0x0037, 0x0038, 0x0031, 0x0032,
0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038},
{0x0000, 0x0000, 0x0051, 0x0052, 0x0024, 0x0025, 0x003d, 0x003e,
0x003f, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0041, 0x0042,
0x0043, 0x0044, 0x001e, 0x001f, 0x0053, 0x0054, 0x0024, 0x0025,
0x0026, 0x0027, 0x0020, 0x0021, 0x0022, 0x0023},
{0x0000, 0x0028, 0x0055, 0x0056, 0x0035, 0x0036, 0x0049, 0x004a,
0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x004d, 0x004e,
0x004f, 0x0050, 0x002f, 0x0030, 0x0057, 0x0058, 0x0035, 0x0036,
0x0037, 0x0038, 0x0031, 0x0032, 0x0033, 0x0034}
};
makefile
Code:
TARGET = test
OBJS = graphics.o framebuffer.o main.o
INCDIR =
CFLAGS = -G4 -Wall -O2
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LDFLAGS =
STDLIBS = -losl -lpng -lz \
-lpspsdk -lpspgum -lpspctrl -lpspumd -lpsprtc -lpspgu -lmad -lm -lpspaudiolib -lpspaudio -lpsppower
LIBS=$(STDLIBS)$(YOURLIBS)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Test Game
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
EDIT: I think graphics.h conflicts with the OSLIB graphics is this true?
|