This commit is contained in:
Shinovon 2026-05-12 08:55:18 +05:00
parent 6992f313a9
commit dfdd037ed3
4 changed files with 61 additions and 61 deletions

View file

@ -1,9 +1,11 @@
#pragma once
#ifdef _DEBUG
#define LOGS
#ifdef __SYMBIAN32__
#define LOGS_RDEBUG
#endif
#endif
#ifdef AUDIO_OAL
#undef AUDIO_OAL

View file

@ -95,67 +95,69 @@ static int clamp(int size, int targetSize)
static void halveTexture(RwTexture *texture){
if(texture == nil)
return;
return;
debug("halving %s", texture->name);
RwRaster *oldRaster = RwTextureGetRaster(texture);
if(oldRaster == nil)
return;
RwRaster *oldRaster = RwTextureGetRaster(texture);
if(oldRaster == nil)
return;
int oldWidth = RwRasterGetWidth(oldRaster);
int oldHeight = RwRasterGetHeight(oldRaster);
int oldWidth = RwRasterGetWidth(oldRaster);
int oldHeight = RwRasterGetHeight(oldRaster);
// dividir a la mitad, mínimo 16x16
int newWidth = oldWidth > 16 ? oldWidth / 2 : oldWidth;
int newHeight = oldHeight > 16 ? oldHeight / 2 : oldHeight;
// dividir a la mitad, mínimo 16x16
int newWidth = oldWidth > 16 ? oldWidth / 2 : oldWidth;
int newHeight = oldHeight > 16 ? oldHeight / 2 : oldHeight;
// si ya es suficientemente chica, no hacer nada
if(newWidth == oldWidth && newHeight == oldHeight)
return;
// si ya es suficientemente chica, no hacer nada
if(newWidth == oldWidth && newHeight == oldHeight)
return;
// toImage() funciona porque el backingStore está populado
RwImage *image = oldRaster->toImage();
if(image == nil){
debug("downscaleTexture: toImage FAILED for %dx%d", oldWidth, oldHeight);
return;
}
// toImage() funciona porque el backingStore está populado
RwImage *image = oldRaster->toImage();
if(image == nil){
debug("downscaleTexture: toImage FAILED for %dx%d", oldWidth, oldHeight);
return;
}
RwImage *resized = resizeImage(image, newWidth, newHeight);
RwImageDestroy(image);
if(resized == nil){
debug("downscaleTexture: resizeImage FAILED");
return;
}
RwImage *resized = resizeImage(image, newWidth, newHeight);
RwImageDestroy(image);
if(resized == nil){
debug("downscaleTexture: resizeImage FAILED");
return;
}
// crear nuevo raster en formato compatible con GLES1
int32 w, h, d, f;
rw::Raster::imageFindRasterFormat(resized, rw::Raster::TEXTURE, &w, &h, &d, &f);
// crear nuevo raster en formato compatible con GLES1
int32 w, h, d, f;
rw::Raster::imageFindRasterFormat(resized, rw::Raster::TEXTURE, &w, &h, &d, &f);
#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
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
if(newRaster == nil){
debug("downscaleTexture: raster create FAILED");
RwImageDestroy(resized);
return;
}
if(newRaster->setFromImage(resized) == nil){
debug("downscaleTexture: setFromImage FAILED");
RwRasterDestroy(newRaster);
RwImageDestroy(resized);
return;
}
if(newRaster == nil){
debug("downscaleTexture: raster create FAILED");
RwImageDestroy(resized);
RwTextureSetRaster(texture, newRaster);
RwRasterDestroy(oldRaster);
return;
}
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) {
RwRaster *oldRaster = RwTextureGetRaster(texture);
if (oldRaster == nil)
return;
debug("downscaling %s", texture->name);
extern bool moreVram;
int targetSize = moreVram ? 64 : 32;
@ -211,7 +213,6 @@ RwTextureGtaStreamRead(RwStream *stream)
#ifdef __SYMBIAN32__
else if (gGameState != GS_PLAYING_GAME || FrontEndMenuManager.m_bMenuActive) {
if (tex != nil && tex->raster != nil && (RwRasterGetWidth(tex->raster) > 128 || RwRasterGetHeight(tex->raster) > 128)) {
// debug("downscaling %s", tex->name);
halveTexture(tex);
}
}
@ -533,7 +534,7 @@ CreateTxdImageForVideoCard()
// so let's hope that is the case for all
rw::gl3::needToReadBackTextures = true;
#elif defined RW_GLES1
rw::gl1::needToReadBackTextures = true;
rw::gles1::needToReadBackTextures = true;
#endif
#ifdef DISABLE_VSYNC_ON_TEXTURE_CONVERSION
@ -585,7 +586,7 @@ CreateTxdImageForVideoCard()
#ifdef RW_GL3
rw::gl3::needToReadBackTextures = false;
#elif defined RW_GLES1
rw::gl1::needToReadBackTextures = false;
rw::gles1::needToReadBackTextures = false;
#endif
return false;
}
@ -622,7 +623,7 @@ CreateTxdImageForVideoCard()
#ifdef RW_GL3
rw::gl3::needToReadBackTextures = false;
#elif defined RW_GLES1
rw::gl1::needToReadBackTextures = false;
rw::gles1::needToReadBackTextures = false;
#endif
if (!pDir->WriteDirFile("models\\txd.dir")) {