mirror of
https://gitlab.com/shinovon/re3-symbian.git
synced 2026-05-22 17:47:20 +03:00
Fixes
This commit is contained in:
parent
6992f313a9
commit
dfdd037ed3
4 changed files with 61 additions and 61 deletions
|
|
@ -1,9 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
#define LOGS
|
#define LOGS
|
||||||
#ifdef __SYMBIAN32__
|
#ifdef __SYMBIAN32__
|
||||||
#define LOGS_RDEBUG
|
#define LOGS_RDEBUG
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef AUDIO_OAL
|
#ifdef AUDIO_OAL
|
||||||
#undef AUDIO_OAL
|
#undef AUDIO_OAL
|
||||||
|
|
|
||||||
|
|
@ -95,67 +95,69 @@ static int clamp(int size, int targetSize)
|
||||||
|
|
||||||
static void halveTexture(RwTexture *texture){
|
static void halveTexture(RwTexture *texture){
|
||||||
if(texture == nil)
|
if(texture == nil)
|
||||||
return;
|
return;
|
||||||
|
debug("halving %s", texture->name);
|
||||||
|
|
||||||
RwRaster *oldRaster = RwTextureGetRaster(texture);
|
RwRaster *oldRaster = RwTextureGetRaster(texture);
|
||||||
if(oldRaster == nil)
|
if(oldRaster == nil)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int oldWidth = RwRasterGetWidth(oldRaster);
|
int oldWidth = RwRasterGetWidth(oldRaster);
|
||||||
int oldHeight = RwRasterGetHeight(oldRaster);
|
int oldHeight = RwRasterGetHeight(oldRaster);
|
||||||
|
|
||||||
// dividir a la mitad, mínimo 16x16
|
// dividir a la mitad, mínimo 16x16
|
||||||
int newWidth = oldWidth > 16 ? oldWidth / 2 : oldWidth;
|
int newWidth = oldWidth > 16 ? oldWidth / 2 : oldWidth;
|
||||||
int newHeight = oldHeight > 16 ? oldHeight / 2 : oldHeight;
|
int newHeight = oldHeight > 16 ? oldHeight / 2 : oldHeight;
|
||||||
|
|
||||||
// si ya es suficientemente chica, no hacer nada
|
// si ya es suficientemente chica, no hacer nada
|
||||||
if(newWidth == oldWidth && newHeight == oldHeight)
|
if(newWidth == oldWidth && newHeight == oldHeight)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// toImage() funciona porque el backingStore está populado
|
// toImage() funciona porque el backingStore está populado
|
||||||
RwImage *image = oldRaster->toImage();
|
RwImage *image = oldRaster->toImage();
|
||||||
if(image == nil){
|
if(image == nil){
|
||||||
debug("downscaleTexture: toImage FAILED for %dx%d", oldWidth, oldHeight);
|
debug("downscaleTexture: toImage FAILED for %dx%d", oldWidth, oldHeight);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RwImage *resized = resizeImage(image, newWidth, newHeight);
|
RwImage *resized = resizeImage(image, newWidth, newHeight);
|
||||||
RwImageDestroy(image);
|
RwImageDestroy(image);
|
||||||
if(resized == nil){
|
if(resized == nil){
|
||||||
debug("downscaleTexture: resizeImage FAILED");
|
debug("downscaleTexture: resizeImage FAILED");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// crear nuevo raster en formato compatible con GLES1
|
// crear nuevo raster en formato compatible con GLES1
|
||||||
int32 w, h, d, f;
|
int32 w, h, d, f;
|
||||||
rw::Raster::imageFindRasterFormat(resized, rw::Raster::TEXTURE, &w, &h, &d, &f);
|
rw::Raster::imageFindRasterFormat(resized, rw::Raster::TEXTURE, &w, &h, &d, &f);
|
||||||
#ifdef RW_GLES1
|
#ifdef RW_GLES1
|
||||||
RwRaster *newRaster = rw::Raster::create(w, h, d, f | rw::Raster::TEXTURE, rw::PLATFORM_GLES1);
|
RwRaster *newRaster = rw::Raster::create(w, h, d, f | rw::Raster::TEXTURE, rw::PLATFORM_GLES1);
|
||||||
#else
|
#else
|
||||||
RwRaster *newRaster = rw::Raster::create(w, h, d, f | rw::Raster::TEXTURE, rw::PLATFORM_GL3);
|
RwRaster *newRaster = rw::Raster::create(w, h, d, f | rw::Raster::TEXTURE, rw::PLATFORM_GL3);
|
||||||
#endif
|
#endif
|
||||||
if(newRaster == nil){
|
if(newRaster == nil){
|
||||||
debug("downscaleTexture: raster create FAILED");
|
debug("downscaleTexture: raster create FAILED");
|
||||||
RwImageDestroy(resized);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(newRaster->setFromImage(resized) == nil){
|
|
||||||
debug("downscaleTexture: setFromImage FAILED");
|
|
||||||
RwRasterDestroy(newRaster);
|
|
||||||
RwImageDestroy(resized);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
RwImageDestroy(resized);
|
RwImageDestroy(resized);
|
||||||
RwTextureSetRaster(texture, newRaster);
|
return;
|
||||||
RwRasterDestroy(oldRaster);
|
}
|
||||||
|
|
||||||
|
if(newRaster->setFromImage(resized) == nil){
|
||||||
|
debug("downscaleTexture: setFromImage FAILED");
|
||||||
|
RwRasterDestroy(newRaster);
|
||||||
|
RwImageDestroy(resized);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RwImageDestroy(resized);
|
||||||
|
RwTextureSetRaster(texture, newRaster);
|
||||||
|
RwRasterDestroy(oldRaster);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void downscaleTexture(RwTexture *texture) {
|
static void downscaleTexture(RwTexture *texture) {
|
||||||
RwRaster *oldRaster = RwTextureGetRaster(texture);
|
RwRaster *oldRaster = RwTextureGetRaster(texture);
|
||||||
if (oldRaster == nil)
|
if (oldRaster == nil)
|
||||||
return;
|
return;
|
||||||
|
debug("downscaling %s", texture->name);
|
||||||
|
|
||||||
extern bool moreVram;
|
extern bool moreVram;
|
||||||
int targetSize = moreVram ? 64 : 32;
|
int targetSize = moreVram ? 64 : 32;
|
||||||
|
|
@ -211,7 +213,6 @@ RwTextureGtaStreamRead(RwStream *stream)
|
||||||
#ifdef __SYMBIAN32__
|
#ifdef __SYMBIAN32__
|
||||||
else if (gGameState != GS_PLAYING_GAME || FrontEndMenuManager.m_bMenuActive) {
|
else if (gGameState != GS_PLAYING_GAME || FrontEndMenuManager.m_bMenuActive) {
|
||||||
if (tex != nil && tex->raster != nil && (RwRasterGetWidth(tex->raster) > 128 || RwRasterGetHeight(tex->raster) > 128)) {
|
if (tex != nil && tex->raster != nil && (RwRasterGetWidth(tex->raster) > 128 || RwRasterGetHeight(tex->raster) > 128)) {
|
||||||
// debug("downscaling %s", tex->name);
|
|
||||||
halveTexture(tex);
|
halveTexture(tex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -533,7 +534,7 @@ CreateTxdImageForVideoCard()
|
||||||
// so let's hope that is the case for all
|
// so let's hope that is the case for all
|
||||||
rw::gl3::needToReadBackTextures = true;
|
rw::gl3::needToReadBackTextures = true;
|
||||||
#elif defined RW_GLES1
|
#elif defined RW_GLES1
|
||||||
rw::gl1::needToReadBackTextures = true;
|
rw::gles1::needToReadBackTextures = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DISABLE_VSYNC_ON_TEXTURE_CONVERSION
|
#ifdef DISABLE_VSYNC_ON_TEXTURE_CONVERSION
|
||||||
|
|
@ -585,7 +586,7 @@ CreateTxdImageForVideoCard()
|
||||||
#ifdef RW_GL3
|
#ifdef RW_GL3
|
||||||
rw::gl3::needToReadBackTextures = false;
|
rw::gl3::needToReadBackTextures = false;
|
||||||
#elif defined RW_GLES1
|
#elif defined RW_GLES1
|
||||||
rw::gl1::needToReadBackTextures = false;
|
rw::gles1::needToReadBackTextures = false;
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -622,7 +623,7 @@ CreateTxdImageForVideoCard()
|
||||||
#ifdef RW_GL3
|
#ifdef RW_GL3
|
||||||
rw::gl3::needToReadBackTextures = false;
|
rw::gl3::needToReadBackTextures = false;
|
||||||
#elif defined RW_GLES1
|
#elif defined RW_GLES1
|
||||||
rw::gl1::needToReadBackTextures = false;
|
rw::gles1::needToReadBackTextures = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!pDir->WriteDirFile("models\\txd.dir")) {
|
if (!pDir->WriteDirFile("models\\txd.dir")) {
|
||||||
|
|
|
||||||
2
vendor/librw/src/gl/rwgl3.h
vendored
2
vendor/librw/src/gl/rwgl3.h
vendored
|
|
@ -18,7 +18,7 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#ifdef _DEBUG
|
||||||
extern void re3_debug(const char *format, ...);
|
extern void re3_debug(const char *format, ...);
|
||||||
extern void re3_trace(const char *filename, unsigned int lineno, const char *func, const char *format, ...);
|
extern void re3_trace(const char *filename, unsigned int lineno, const char *func, const char *format, ...);
|
||||||
#define CHECK_GL_ERROR(trace) do { \
|
#define CHECK_GL_ERROR(trace) do { \
|
||||||
|
|
|
||||||
21
vendor/librw/src/gles1/gl1raster.cpp
vendored
21
vendor/librw/src/gles1/gl1raster.cpp
vendored
|
|
@ -395,11 +395,8 @@ rasterLock(Raster *raster, int32 level, int32 lockMode)
|
||||||
px = (uint8*)rwMalloc(allocSz, MEMDUR_EVENT | ID_DRIVER);
|
px = (uint8*)rwMalloc(allocSz, MEMDUR_EVENT | ID_DRIVER);
|
||||||
assert(raster->pixels == nil);
|
assert(raster->pixels == nil);
|
||||||
raster->pixels = px;
|
raster->pixels = px;
|
||||||
#ifdef __SYMBIAN32__
|
|
||||||
memset(px, 0, allocSz);
|
memset(px, 0, allocSz);
|
||||||
#else
|
|
||||||
glReadBuffer(GL_BACK);
|
|
||||||
#endif
|
|
||||||
glReadPixels(0, 0, raster->width, raster->height, GL_RGB, GL_UNSIGNED_BYTE, px);
|
glReadPixels(0, 0, raster->width, raster->height, GL_RGB, GL_UNSIGNED_BYTE, px);
|
||||||
|
|
||||||
raster->privateFlags = lockMode;
|
raster->privateFlags = lockMode;
|
||||||
|
|
@ -501,11 +498,11 @@ void rasterUnlock(Raster *raster, int32 level){
|
||||||
rwFree(raster->pixels);
|
rwFree(raster->pixels);
|
||||||
raster->pixels = nil;
|
raster->pixels = nil;
|
||||||
#endif
|
#endif
|
||||||
raster->width = raster->originalWidth;
|
raster->width = raster->originalWidth;
|
||||||
raster->height = raster->originalHeight;
|
raster->height = raster->originalHeight;
|
||||||
raster->stride = raster->originalStride;
|
raster->stride = raster->originalStride;
|
||||||
raster->pixels = raster->originalPixels;
|
raster->pixels = raster->originalPixels;
|
||||||
raster->privateFlags = 0;
|
raster->privateFlags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32
|
int32
|
||||||
|
|
@ -751,8 +748,8 @@ void evictRaster(Raster *raster);
|
||||||
static void*
|
static void*
|
||||||
destroyNativeRaster(void *object, int32 offset, int32)
|
destroyNativeRaster(void *object, int32 offset, int32)
|
||||||
{
|
{
|
||||||
Raster *raster = (Raster*)object;
|
Raster *raster = (Raster*)object;
|
||||||
Gl1Raster *natras = PLUGINOFFSET(Gl1Raster, object, offset);
|
Gl1Raster *natras = PLUGINOFFSET(Gl1Raster, object, offset);
|
||||||
#ifdef RW_GLES1
|
#ifdef RW_GLES1
|
||||||
evictRaster(raster);
|
evictRaster(raster);
|
||||||
switch(raster->type){
|
switch(raster->type){
|
||||||
|
|
@ -786,7 +783,7 @@ destroyNativeRaster(void *object, int32 offset, int32)
|
||||||
natras->backingStore = nil;
|
natras->backingStore = nil;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void*
|
static void*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue