mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-22 12:53:22 +02:00
#15 fix PSP build
This commit is contained in:
@@ -104,7 +104,7 @@ struct OptionItem {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SETTINGS(x) intptr_t( &(((Core::Settings*)NULL)->x) )
|
#define SETTINGS(x) offsetof(Core::Settings, x)
|
||||||
|
|
||||||
static const OptionItem optDetail[] = {
|
static const OptionItem optDetail[] = {
|
||||||
OptionItem( OptionItem::TYPE_TITLE, STR_SELECT_DETAIL ),
|
OptionItem( OptionItem::TYPE_TITLE, STR_SELECT_DETAIL ),
|
||||||
|
@@ -2203,7 +2203,7 @@ struct Level : IGame {
|
|||||||
inventory.prepareBackground();
|
inventory.prepareBackground();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!title)
|
if (!title && inventory.titleTimer <= 1.0f)
|
||||||
renderGame(true);
|
renderGame(true);
|
||||||
|
|
||||||
renderInventory(title);
|
renderInventory(title);
|
||||||
|
@@ -3,7 +3,7 @@ OBJS = main.o ../../libs/stb_vorbis/stb_vorbis.o
|
|||||||
|
|
||||||
INCDIR = ../../
|
INCDIR = ../../
|
||||||
CFLAGS = -G0 -O3
|
CFLAGS = -G0 -O3
|
||||||
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
|
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti -Wno-invalid-offsetof
|
||||||
ASFLAGS = $(CFLAGS)
|
ASFLAGS = $(CFLAGS)
|
||||||
|
|
||||||
BUILD_PRX = 1
|
BUILD_PRX = 1
|
||||||
|
@@ -94,22 +94,62 @@ int osGetTime() {
|
|||||||
return int(time * 1000 / osTimerFreq - osStartTime);
|
return int(time * 1000 / osTimerFreq - osStartTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool osSave(const char *name, const void *data, int size) {
|
|
||||||
return false;
|
// storage
|
||||||
|
void osCacheWrite(Stream *stream) {
|
||||||
|
char path[255];
|
||||||
|
strcpy(path, Stream::cacheDir);
|
||||||
|
strcat(path, stream->name);
|
||||||
|
FILE *f = fopen(path, "wb");
|
||||||
|
if (f) {
|
||||||
|
fwrite(stream->data, 1, stream->size, f);
|
||||||
|
fclose(f);
|
||||||
|
if (stream->callback)
|
||||||
|
stream->callback(new Stream(stream->name, NULL, 0), stream->userData);
|
||||||
|
} else
|
||||||
|
if (stream->callback)
|
||||||
|
stream->callback(NULL, stream->userData);
|
||||||
|
|
||||||
|
delete stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
int joyGetPOV(int mask) {
|
void osCacheRead(Stream *stream) {
|
||||||
switch (mask) {
|
char path[255];
|
||||||
case 0b0001 : return 1;
|
strcpy(path, Stream::cacheDir);
|
||||||
case 0b1001 : return 2;
|
strcat(path, stream->name);
|
||||||
case 0b1000 : return 3;
|
FILE *f = fopen(path, "rb");
|
||||||
case 0b1010 : return 4;
|
if (f) {
|
||||||
case 0b0010 : return 5;
|
fseek(f, 0, SEEK_END);
|
||||||
case 0b0110 : return 6;
|
int size = ftell(f);
|
||||||
case 0b0100 : return 7;
|
fseek(f, 0, SEEK_SET);
|
||||||
case 0b0101 : return 8;
|
char *data = new char[size];
|
||||||
}
|
fread(data, 1, size, f);
|
||||||
return 0;
|
fclose(f);
|
||||||
|
if (stream->callback)
|
||||||
|
stream->callback(new Stream(stream->name, data, size), stream->userData);
|
||||||
|
delete[] data;
|
||||||
|
} else
|
||||||
|
if (stream->callback)
|
||||||
|
stream->callback(NULL, stream->userData);
|
||||||
|
delete stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
void osSaveGame(Stream *stream) {
|
||||||
|
return osCacheWrite(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
void osLoadGame(Stream *stream) {
|
||||||
|
return osCacheRead(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// input
|
||||||
|
bool osJoyReady(int index) {
|
||||||
|
return index == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void osJoyVibrate(int index, float L, float R) {
|
||||||
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
void joyInit() {
|
void joyInit() {
|
||||||
@@ -121,25 +161,23 @@ void joyUpdate() {
|
|||||||
SceCtrlData pad;
|
SceCtrlData pad;
|
||||||
sceCtrlReadBufferPositive(&pad, 1);
|
sceCtrlReadBufferPositive(&pad, 1);
|
||||||
|
|
||||||
Input::setDown(ikJoyA, (pad.Buttons & PSP_CTRL_CROSS));
|
Input::setJoyDown(0, jkUp, (pad.Buttons & PSP_CTRL_UP));
|
||||||
Input::setDown(ikJoyB, (pad.Buttons & PSP_CTRL_CIRCLE));
|
Input::setJoyDown(0, jkDown, (pad.Buttons & PSP_CTRL_DOWN));
|
||||||
Input::setDown(ikJoyX, (pad.Buttons & PSP_CTRL_SQUARE));
|
Input::setJoyDown(0, jkLeft, (pad.Buttons & PSP_CTRL_LEFT));
|
||||||
Input::setDown(ikJoyY, (pad.Buttons & PSP_CTRL_TRIANGLE));
|
Input::setJoyDown(0, jkRight, (pad.Buttons & PSP_CTRL_RIGHT));
|
||||||
Input::setDown(ikJoyLB, (pad.Buttons & PSP_CTRL_LTRIGGER));
|
Input::setJoyDown(0, jkA, (pad.Buttons & PSP_CTRL_CROSS));
|
||||||
Input::setDown(ikJoyRB, (pad.Buttons & PSP_CTRL_RTRIGGER));
|
Input::setJoyDown(0, jkB, (pad.Buttons & PSP_CTRL_CIRCLE));
|
||||||
Input::setDown(ikJoyStart, (pad.Buttons & PSP_CTRL_START));
|
Input::setJoyDown(0, jkX, (pad.Buttons & PSP_CTRL_SQUARE));
|
||||||
Input::setDown(ikJoySelect, (pad.Buttons & PSP_CTRL_SELECT));
|
Input::setJoyDown(0, jkY, (pad.Buttons & PSP_CTRL_TRIANGLE));
|
||||||
|
Input::setJoyDown(0, jkLB, (pad.Buttons & PSP_CTRL_LTRIGGER));
|
||||||
int pov = joyGetPOV( ((pad.Buttons & PSP_CTRL_UP) != 0) |
|
Input::setJoyDown(0, jkRB, (pad.Buttons & PSP_CTRL_RTRIGGER));
|
||||||
(((pad.Buttons & PSP_CTRL_DOWN) != 0) << 1) |
|
Input::setJoyDown(0, jkStart, (pad.Buttons & PSP_CTRL_START));
|
||||||
(((pad.Buttons & PSP_CTRL_LEFT) != 0) << 2) |
|
Input::setJoyDown(0, jkSelect, (pad.Buttons & PSP_CTRL_SELECT));
|
||||||
(((pad.Buttons & PSP_CTRL_RIGHT) != 0) << 3));
|
|
||||||
Input::setPos(ikJoyPOV, vec2(float(pov), 0.0f));
|
|
||||||
|
|
||||||
vec2 stick = vec2(float(pad.Lx), float(pad.Ly)) / 128.0f - 1.0f;
|
vec2 stick = vec2(float(pad.Lx), float(pad.Ly)) / 128.0f - 1.0f;
|
||||||
if (fabsf(stick.x) < 0.2f && fabsf(stick.y) < 0.2f)
|
if (fabsf(stick.x) < 0.2f && fabsf(stick.y) < 0.2f)
|
||||||
stick = vec2(0.0f);
|
stick = vec2(0.0f);
|
||||||
Input::setPos(ikJoyR, stick);
|
Input::setJoyPos(0, jkL, stick);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sndFill(void* buf, unsigned int length, void *userdata) {
|
void sndFill(void* buf, unsigned int length, void *userdata) {
|
||||||
|
Reference in New Issue
Block a user