Remove base/logging.h from a whole bunch of files in native

This commit is contained in:
Henrik Rydgård 2020-08-15 15:40:35 +02:00
parent 6f1915110f
commit bf72f746ea
20 changed files with 105 additions and 111 deletions

View file

@ -11,7 +11,7 @@
#include <zlib.h>
#include "base/logging.h"
#include "Common/Log.h"
/** Compress a STL string using zlib with given compression level and return
* the binary data. */
@ -20,7 +20,7 @@ bool compress_string(const std::string& str, std::string *dest, int compressionl
memset(&zs, 0, sizeof(zs));
if (deflateInit(&zs, compressionlevel) != Z_OK) {
ELOG("deflateInit failed while compressing.");
ERROR_LOG(IO, "deflateInit failed while compressing.");
return false;
}
@ -67,7 +67,7 @@ bool decompress_string(const std::string& str, std::string *dest) {
// modification by hrydgard: inflateInit2, 16+MAXWBITS makes it read gzip data too
if (inflateInit2(&zs, 32+MAX_WBITS) != Z_OK) {
ELOG("inflateInit failed while decompressing.");
ERROR_LOG(IO, "inflateInit failed while decompressing.");
return false;
}
@ -96,7 +96,7 @@ bool decompress_string(const std::string& str, std::string *dest) {
if (ret != Z_STREAM_END) { // an error occurred that was not EOF
std::ostringstream oss;
ELOG("Exception during zlib decompression: (%i) %s", ret, zs.msg);
ERROR_LOG(IO, "Exception during zlib decompression: (%i) %s", ret, zs.msg);
return false;
}

View file

@ -1,4 +1,3 @@
#include "base/logging.h"
#include "file/chunk_file.h"
#include "file/zip_read.h"
#include "file/file_util.h"

View file

@ -18,7 +18,7 @@
#endif
#include <fcntl.h>
#include "base/logging.h"
#include "Common/Log.h"
namespace fd_util {
@ -45,7 +45,7 @@ ssize_t ReadLine(int fd, char *vptr, size_t buf_size) {
else {
if (errno == EINTR)
continue;
FLOG("Error in Readline()");
_assert_msg_(false, "Error in Readline()");
}
}
@ -64,7 +64,7 @@ ssize_t WriteLine(int fd, const char *vptr, size_t n) {
if (errno == EINTR)
nwritten = 0;
else
FLOG("Error in Writeline()");
_assert_msg_(false, "Error in Writeline()");
}
nleft -= nwritten;
buffer += nwritten;
@ -113,7 +113,7 @@ void SetNonBlocking(int sock, bool non_blocking) {
int opts = fcntl(sock, F_GETFL);
if (opts < 0) {
perror("fcntl(F_GETFL)");
ELOG("Error getting socket status while changing nonblocking status");
ERROR_LOG(IO, "Error getting socket status while changing nonblocking status");
}
if (non_blocking) {
opts = (opts | O_NONBLOCK);
@ -123,12 +123,12 @@ void SetNonBlocking(int sock, bool non_blocking) {
if (fcntl(sock, F_SETFL, opts) < 0) {
perror("fcntl(F_SETFL)");
ELOG("Error setting socket nonblocking status");
ERROR_LOG(IO, "Error setting socket nonblocking status");
}
#else
u_long val = non_blocking ? 1 : 0;
if (ioctlsocket(sock, FIONBIO, &val) != 0) {
ELOG("Error setting socket nonblocking status");
ERROR_LOG(IO, "Error setting socket nonblocking status");
}
#endif
}

View file

@ -18,7 +18,6 @@
#include <sys/stat.h>
#include <ctype.h>
#include "base/logging.h"
#include "base/basictypes.h"
#include "base/stringutil.h"
#include "file/file_util.h"

View file

@ -16,7 +16,6 @@
#include <string>
#include <vector>
#include "base/logging.h"
#include "base/stringutil.h"
#include "file/ini_file.h"
#include "file/vfs.h"

View file

@ -8,16 +8,17 @@
#endif
#include "base/basictypes.h"
#include "base/logging.h"
#include "file/zip_read.h"
#include "Common/Log.h"
#ifdef __ANDROID__
uint8_t *ReadFromZip(zip *archive, const char* filename, size_t *size) {
// Figure out the file size first.
struct zip_stat zstat;
zip_file *file = zip_fopen(archive, filename, ZIP_FL_NOCASE|ZIP_FL_UNCHANGED);
if (!file) {
ELOG("Error opening %s from ZIP", filename);
ERROR_LOG(IO, "Error opening %s from ZIP", filename);
return 0;
}
zip_stat(archive, filename, ZIP_FL_NOCASE|ZIP_FL_UNCHANGED, &zstat);
@ -67,16 +68,16 @@ ZipAssetReader::ZipAssetReader(const char *zip_file, const char *in_zip_path) {
zip_file_ = zip_open(zip_file, 0, NULL);
strcpy(in_zip_path_, in_zip_path);
if (!zip_file_) {
ELOG("Failed to open %s as a zip file", zip_file);
ERROR_LOG(IO, "Failed to open %s as a zip file", zip_file);
}
std::vector<FileInfo> info;
GetFileListing("assets", &info, 0);
for (size_t i = 0; i < info.size(); i++) {
if (info[i].isDirectory) {
DLOG("Directory: %s", info[i].name.c_str());
DEBUG_LOG(IO, "Directory: %s", info[i].name.c_str());
} else {
DLOG("File: %s", info[i].name.c_str());
DEBUG_LOG(IO, "File: %s", info[i].name.c_str());
}
}
}
@ -264,7 +265,7 @@ static int num_entries = 0;
void VFSRegister(const char *prefix, AssetReader *reader) {
entries[num_entries].prefix = prefix;
entries[num_entries].reader = reader;
DLOG("Registered VFS for prefix %s: %s", prefix, reader->toString().c_str());
DEBUG_LOG(IO, "Registered VFS for prefix %s: %s", prefix, reader->toString().c_str());
num_entries++;
}
@ -289,7 +290,7 @@ static bool IsLocalPath(const char *path) {
uint8_t *VFSReadFile(const char *filename, size_t *size) {
if (IsLocalPath(filename)) {
// Local path, not VFS.
// ILOG("Not a VFS path: %s . Reading local file.", filename);
// INFO_LOG(IO, "Not a VFS path: %s . Reading local file.", filename);
return ReadLocalFile(filename, size);
}
@ -310,7 +311,7 @@ uint8_t *VFSReadFile(const char *filename, size_t *size) {
}
}
if (!fileSystemFound) {
ELOG("Missing filesystem for '%s'", filename);
ERROR_LOG(IO, "Missing filesystem for '%s'", filename);
} // Otherwise, the file was just missing. No need to log.
return 0;
}
@ -337,7 +338,7 @@ bool VFSGetFileListing(const char *path, std::vector<FileInfo> *listing, const c
}
if (!fileSystemFound) {
ELOG("Missing filesystem for %s", path);
ERROR_LOG(IO, "Missing filesystem for %s", path);
} // Otherwise, the file was just missing. No need to log.
return false;
}
@ -363,7 +364,7 @@ bool VFSGetFileInfo(const char *path, FileInfo *info) {
}
}
if (!fileSystemFound) {
ELOG("Missing filesystem for %s", path);
ERROR_LOG(IO, "Missing filesystem for %s", path);
} // Otherwise, the file was just missing. No need to log.
return false;
}

View file

@ -1,9 +1,10 @@
#include <cstdlib>
#include "base/logging.h"
#include "gfx/gl_common.h"
#include "gfx/gl_debug_log.h"
#include "Common/Log.h"
// This we can expand as needed.
std::string GLEnumToString(uint16_t value) {
char str[64];
@ -36,6 +37,6 @@ std::string GLEnumToString(uint16_t value) {
void CheckGLError(const char *file, int line) {
GLenum err = glGetError();
if (err != GL_NO_ERROR) {
ELOG("GL error %s on %s:%d", GLEnumToString(err).c_str(), file, line);
ERROR_LOG(G3D, "GL error %s on %s:%d", GLEnumToString(err).c_str(), file, line);
}
}

View file

@ -1,6 +1,6 @@
#include <cstring>
#include <cstdint>
#include "base/logging.h"
#include "gfx/texture_atlas.h"
class ByteReader {

View file

@ -4,7 +4,6 @@
#include <stddef.h>
#include "base/display.h"
#include "base/logging.h"
#include "base/stringutil.h"
#include "math/math_util.h"
#include "gfx/texture_atlas.h"
@ -14,6 +13,8 @@
#include "util/text/utf8.h"
#include "util/text/wrap_text.h"
#include "Common/Log.h"
enum {
// Enough?
MAX_VERTS = 65536,
@ -85,7 +86,7 @@ void DrawBuffer::Flush(bool set_blend_state) {
if (count_ == 0)
return;
if (!pipeline_) {
ELOG("DrawBuffer: No program set, skipping flush!");
ERROR_LOG(G3D, "DrawBuffer: No program set, skipping flush!");
count_ = 0;
return;
}
@ -106,10 +107,7 @@ void DrawBuffer::Flush(bool set_blend_state) {
}
void DrawBuffer::V(float x, float y, float z, uint32_t color, float u, float v) {
if (count_ >= MAX_VERTS) {
FLOG("Overflowed the DrawBuffer");
return;
}
_assert_msg_(count_ < MAX_VERTS, "Overflowed the DrawBuffer");
Vertex *vert = &verts_[count_++];
vert->x = x;

View file

@ -1,5 +1,4 @@
#include "base/display.h"
#include "base/logging.h"
#include "base/stringutil.h"
#include "thin3d/thin3d.h"
#include "util/hash/hash.h"

View file

@ -1,5 +1,4 @@
#include "base/display.h"
#include "base/logging.h"
#include "base/stringutil.h"
#include "thin3d/thin3d.h"
#include "util/hash/hash.h"
@ -9,7 +8,8 @@
#include "gfx_es2/draw_text_android.h"
#include "android/jni/app-android.h"
#include <assert.h>
#include "Common/Log.h"
#if PPSSPP_PLATFORM(ANDROID) && !defined(__LIBRETRO__)
@ -24,10 +24,10 @@ TextDrawerAndroid::TextDrawerAndroid(Draw::DrawContext *draw) : TextDrawer(draw)
method_measureText = env->GetStaticMethodID(cls_textRenderer, "measureText", "(Ljava/lang/String;D)I");
method_renderText = env->GetStaticMethodID(cls_textRenderer, "renderText", "(Ljava/lang/String;D)[I");
} else {
ELOG("Failed to find class: '%s'", textRendererClassName);
ERROR_LOG(G3D, "Failed to find class: '%s'", textRendererClassName);
}
dpiScale_ = CalculateDPIScale();
ILOG("Initializing TextDrawerAndroid with DPI scale %f", dpiScale_);
INFO_LOG(G3D, "Initializing TextDrawerAndroid with DPI scale %f", dpiScale_);
}
TextDrawerAndroid::~TextDrawerAndroid() {
@ -68,7 +68,7 @@ void TextDrawerAndroid::SetFont(uint32_t fontHandle) {
if (iter != fontMap_.end()) {
fontHash_ = fontHandle;
} else {
ELOG("Invalid font handle %08x", fontHandle);
ERROR_LOG(G3D, "Invalid font handle %08x", fontHandle);
}
}
@ -88,7 +88,7 @@ void TextDrawerAndroid::MeasureString(const char *str, size_t len, float *w, flo
if (iter != fontMap_.end()) {
scaledSize = iter->second.size;
} else {
ELOG("Missing font");
ERROR_LOG(G3D, "Missing font");
}
std::string text(NormalizeString(std::string(str, len)));
auto env = getEnv();
@ -112,7 +112,7 @@ void TextDrawerAndroid::MeasureStringRect(const char *str, size_t len, const Bou
if (iter != fontMap_.end()) {
scaledSize = iter->second.size;
} else {
ELOG("Missing font");
ERROR_LOG(G3D, "Missing font");
}
std::string toMeasure = std::string(str, len);
@ -168,7 +168,7 @@ void TextDrawerAndroid::DrawStringBitmap(std::vector<uint8_t> &bitmapData, TextS
if (iter != fontMap_.end()) {
size = iter->second.size;
} else {
ELOG("Missing font");
ERROR_LOG(G3D, "Missing font");
}
auto env = getEnv();
@ -213,7 +213,7 @@ void TextDrawerAndroid::DrawStringBitmap(std::vector<uint8_t> &bitmapData, TextS
}
}
} else {
ELOG("Bad TextDrawer format");
ERROR_LOG(G3D, "Bad TextDrawer format");
assert(false);
}
env->ReleaseIntArrayElements(imageData, jimage, 0);
@ -285,7 +285,7 @@ void TextDrawerAndroid::OncePerFrame() {
float newDpiScale = CalculateDPIScale();
if (newDpiScale != dpiScale_) {
// TODO: Don't bother if it's a no-op (cache already empty)
ILOG("DPI Scale changed (%f to %f) - wiping font cache (%d items, %d fonts)", dpiScale_, newDpiScale, (int)cache_.size(), (int)fontMap_.size());
INFO_LOG(G3D, "DPI Scale changed (%f to %f) - wiping font cache (%d items, %d fonts)", dpiScale_, newDpiScale, (int)cache_.size(), (int)fontMap_.size());
dpiScale_ = newDpiScale;
ClearCache();
fontMap_.clear(); // size is precomputed using dpiScale_.

View file

@ -1,6 +1,4 @@
#include <cassert>
#include "base/display.h"
#include "base/logging.h"
#include "base/stringutil.h"
#include "thin3d/thin3d.h"
#include "util/hash/hash.h"
@ -9,6 +7,8 @@
#include "gfx_es2/draw_text.h"
#include "gfx_es2/draw_text_qt.h"
#include "Common/Log.h"
#if defined(USING_QT_UI)
#include <QtGui/QImage>
@ -47,7 +47,7 @@ void TextDrawerQt::SetFont(uint32_t fontHandle) {
if (iter != fontMap_.end()) {
fontHash_ = fontHandle;
} else {
ELOG("Invalid font handle %08x", fontHandle);
ERROR_LOG(G3D, "Invalid font handle %08x", fontHandle);
}
}
@ -134,8 +134,7 @@ void TextDrawerQt::DrawStringBitmap(std::vector<uint8_t> &bitmapData, TextString
}
}
} else {
ELOG("Bad TextDrawer format");
assert(false);
_assert_msg_("Bad TextDrawer format");
}
}

View file

@ -1,6 +1,4 @@
#include <cassert>
#include "base/display.h"
#include "base/logging.h"
#include "base/stringutil.h"
#include "thin3d/thin3d.h"
#include "util/hash/hash.h"
@ -425,8 +423,7 @@ void TextDrawerUWP::DrawStringBitmap(std::vector<uint8_t> &bitmapData, TextStrin
}
}
} else {
ELOG("Bad TextDrawer format");
assert(false);
_assert_msg_(false, "Bad TextDrawer format");
}
ctx_->mirror_bmp->Unmap();

View file

@ -1,6 +1,4 @@
#include <cassert>
#include "base/display.h"
#include "base/logging.h"
#include "base/stringutil.h"
#include "thin3d/thin3d.h"
#include "util/hash/hash.h"
@ -9,6 +7,8 @@
#include "gfx_es2/draw_text.h"
#include "gfx_es2/draw_text_win.h"
#include "Common/Log.h"
#if defined(_WIN32) && !defined(USING_QT_UI) && !PPSSPP_PLATFORM(UWP)
#define WIN32_LEAN_AND_MEAN
@ -286,8 +286,7 @@ void TextDrawerWin32::DrawStringBitmap(std::vector<uint8_t> &bitmapData, TextStr
}
}
} else {
ELOG("Bad TextDrawer format");
assert(false);
_assert_msg_(false, "Bad TextDrawer format");
}
}

View file

@ -4,11 +4,12 @@
#include <string.h>
#include <sys/stat.h>
#include "base/logging.h"
#include "file/vfs.h"
#include "file/zip_read.h"
#include "glsl_program.h"
#include "Common/Log.h"
static std::set<GLSLProgram *> active_programs;
bool CompileShader(const char *source, GLuint shader, const char *filename, std::string *error_message) {
@ -22,9 +23,9 @@ bool CompileShader(const char *source, GLuint shader, const char *filename, std:
GLsizei len;
glGetShaderInfoLog(shader, MAX_INFO_LOG_SIZE, &len, infoLog);
infoLog[len] = '\0';
ELOG("Error in shader compilation of %s!\n", filename);
ELOG("Info log: %s\n", infoLog);
ELOG("Shader source:\n%s\n", (const char *)source);
ERROR_LOG(G3D, "Error in shader compilation of %s!\n", filename);
ERROR_LOG(G3D, "Info log: %s\n", infoLog);
ERROR_LOG(G3D, "Shader source:\n%s\n", (const char *)source);
if (error_message)
*error_message = infoLog;
return false;
@ -45,7 +46,7 @@ GLSLProgram *glsl_create(const char *vshader, const char *fshader, std::string *
if (glsl_recompile(program, error_message)) {
active_programs.insert(program);
} else {
ELOG("Failed compiling GLSL program: %s %s", vshader, fshader);
ERROR_LOG(G3D, "Failed compiling GLSL program: %s %s", vshader, fshader);
delete program;
return 0;
}
@ -65,7 +66,7 @@ GLSLProgram *glsl_create_source(const char *vshader_src, const char *fshader_src
if (glsl_recompile(program, error_message)) {
active_programs.insert(program);
} else {
ELOG("Failed compiling GLSL program from source strings");
ERROR_LOG(G3D, "Failed compiling GLSL program from source strings");
delete program;
return 0;
}
@ -124,7 +125,7 @@ bool glsl_recompile(GLSLProgram *program, std::string *error_message) {
vsh_src.reset((char *)VFSReadFile(program->vshader_filename, &sz));
}
if (!program->vshader_source && !vsh_src) {
ELOG("File missing: %s", program->vshader_filename);
ERROR_LOG(G3D, "File missing: %s", program->vshader_filename);
if (error_message) {
*error_message = std::string("File missing: ") + program->vshader_filename;
}
@ -135,7 +136,7 @@ bool glsl_recompile(GLSLProgram *program, std::string *error_message) {
fsh_src.reset((char *)VFSReadFile(program->fshader_filename, &sz));
}
if (!program->fshader_source && !fsh_src) {
ELOG("File missing: %s", program->fshader_filename);
ERROR_LOG(G3D, "File missing: %s", program->fshader_filename);
if (error_message) {
*error_message = std::string("File missing: ") + program->fshader_filename;
}
@ -169,15 +170,15 @@ bool glsl_recompile(GLSLProgram *program, std::string *error_message) {
if (bufLength) {
char* buf = new char[bufLength + 1]; // safety
glGetProgramInfoLog(prog, bufLength, NULL, buf);
ILOG("vsh: %i fsh: %i", vsh, fsh);
ELOG("Could not link shader program (linkstatus=%i):\n %s \n", linkStatus, buf);
INFO_LOG(G3D, "vsh: %i fsh: %i", vsh, fsh);
ERROR_LOG(G3D, "Could not link shader program (linkstatus=%i):\n %s \n", linkStatus, buf);
if (error_message) {
*error_message = buf;
}
delete [] buf;
} else {
ILOG("vsh: %i fsh: %i", vsh, fsh);
ELOG("Could not link shader program (linkstatus=%i). No OpenGL error log was available.", linkStatus);
INFO_LOG(G3D, "vsh: %i fsh: %i", vsh, fsh);
ERROR_LOG(G3D, "Could not link shader program (linkstatus=%i). No OpenGL error log was available.", linkStatus);
if (error_message) {
*error_message = "(no error message available)";
}
@ -212,7 +213,7 @@ bool glsl_recompile(GLSLProgram *program, std::string *error_message) {
program->u_sundir = glGetUniformLocation(program->program_, "u_sundir");
program->u_camerapos = glGetUniformLocation(program->program_, "u_camerapos");
//ILOG("Shader compilation success: %s %s",
//INFO_LOG(G3D, "Shader compilation success: %s %s",
// program->vshader_filename,
// program->fshader_filename);
return true;
@ -233,7 +234,7 @@ void glsl_destroy(GLSLProgram *program) {
glDeleteProgram(program->program_);
active_programs.erase(program);
} else {
ELOG("Deleting null GLSL program!");
ERROR_LOG(G3D, "Deleting null GLSL program!");
}
delete program;
}

View file

@ -3,7 +3,6 @@
#include <cstring>
#include <set>
#include "base/logging.h"
#include "base/stringutil.h"
#if PPSSPP_API(ANY_GL)
@ -16,6 +15,7 @@
#include "gfx_es2/gpu_features.h"
#include "Common/Log.h"
#if defined(USING_GLES2)
#if defined(__ANDROID__)
@ -96,7 +96,7 @@ int GLExtensions::GLSLVersion() {
void ProcessGPUFeatures() {
gl_extensions.bugs = 0;
DLOG("Checking for GL driver bugs... vendor=%i model='%s'", (int)gl_extensions.gpuVendor, gl_extensions.model);
DEBUG_LOG(G3D, "Checking for GL driver bugs... vendor=%i model='%s'", (int)gl_extensions.gpuVendor, gl_extensions.model);
if (gl_extensions.gpuVendor == GPU_VENDOR_IMGTEC) {
if (!strcmp(gl_extensions.model, "PowerVR SGX 545") ||
@ -106,11 +106,11 @@ void ProcessGPUFeatures() {
!strcmp(gl_extensions.model, "PowerVR SGX 540") ||
!strcmp(gl_extensions.model, "PowerVR SGX 530") ||
!strcmp(gl_extensions.model, "PowerVR SGX 520") ) {
WLOG("GL DRIVER BUG: PVR with bad and terrible precision");
WARN_LOG(G3D, "GL DRIVER BUG: PVR with bad and terrible precision");
gl_extensions.bugs |= BUG_PVR_SHADER_PRECISION_TERRIBLE | BUG_PVR_SHADER_PRECISION_BAD;
} else {
// TODO: I'm not sure if the Rogue series is affected by this.
WLOG("GL DRIVER BUG: PVR with bad precision");
WARN_LOG(G3D, "GL DRIVER BUG: PVR with bad precision");
gl_extensions.bugs |= BUG_PVR_SHADER_PRECISION_BAD;
}
}
@ -172,7 +172,7 @@ void CheckGLExtensions() {
gl_extensions.gpuVendor = GPU_VENDOR_UNKNOWN;
}
ILOG("GPU Vendor : %s ; renderer: %s version str: %s ; GLSL version str: %s", cvendor, renderer ? renderer : "N/A", versionStr ? versionStr : "N/A", glslVersionStr ? glslVersionStr : "N/A");
INFO_LOG(G3D, "GPU Vendor : %s ; renderer: %s version str: %s ; GLSL version str: %s", cvendor, renderer ? renderer : "N/A", versionStr ? versionStr : "N/A", glslVersionStr ? glslVersionStr : "N/A");
if (renderer) {
strncpy(gl_extensions.model, renderer, sizeof(gl_extensions.model));
@ -245,7 +245,7 @@ void CheckGLExtensions() {
gl_extensions.ver[1] = 0;
} else if (parsed[0] && (gl_extensions.ver[0] != parsed[0] || gl_extensions.ver[1] != parsed[1])) {
// Something going wrong. Possible bug in GL ES drivers. See #9688
ILOG("GL ES version mismatch. Version string '%s' parsed as %d.%d but API return %d.%d. Fallback to GL ES 2.0.",
INFO_LOG(G3D, "GL ES version mismatch. Version string '%s' parsed as %d.%d but API return %d.%d. Fallback to GL ES 2.0.",
versionStr ? versionStr : "N/A", parsed[0], parsed[1], gl_extensions.ver[0], gl_extensions.ver[1]);
gl_extensions.ver[0] = 2;
@ -289,9 +289,9 @@ void CheckGLExtensions() {
if (gl_extensions.GLES3) {
if (gl_extensions.ver[1] >= 1) {
ILOG("OpenGL ES 3.1 support detected!\n");
INFO_LOG(G3D, "OpenGL ES 3.1 support detected!\n");
} else {
ILOG("OpenGL ES 3.0 support detected!\n");
INFO_LOG(G3D, "OpenGL ES 3.0 support detected!\n");
}
}
}
@ -376,7 +376,7 @@ void CheckGLExtensions() {
#ifdef _DEBUG
void *invalidAddress = (void *)eglGetProcAddress("InvalidGlCall1");
void *invalidAddress2 = (void *)eglGetProcAddress("AnotherInvalidGlCall2");
DLOG("Addresses returned for invalid extensions: %p %p", invalidAddress, invalidAddress2);
DEBUG_LOG(G3D, "Addresses returned for invalid extensions: %p %p", invalidAddress, invalidAddress2);
#endif
// These are all the same. Let's alias.
@ -473,7 +473,7 @@ void CheckGLExtensions() {
// Now, Adreno lies. So let's override it.
if (gl_extensions.gpuVendor == GPU_VENDOR_QUALCOMM) {
WLOG("Detected Adreno - lowering int precision");
WARN_LOG(G3D, "Detected Adreno - lowering int precision");
gl_extensions.range[1][5][0] = 15;
gl_extensions.range[1][5][1] = 15;
}
@ -549,15 +549,14 @@ void CheckGLExtensions() {
int error = glGetError();
if (error)
ELOG("GL error in init: %i", error);
ERROR_LOG(G3D, "GL error in init: %i", error);
#endif
}
void SetGLCoreContext(bool flag) {
if (extensionsDone)
FLOG("SetGLCoreContext() after CheckGLExtensions()");
_assert_msg_(!extensionsDone, "SetGLCoreContext() after CheckGLExtensions()");
useCoreContext = flag;
// For convenience, it'll get reset later.

View file

@ -1,4 +1,3 @@
#include "base/logging.h"
#include "base/stringutil.h"
#include "i18n/i18n.h"
#include "file/ini_file.h"
@ -32,7 +31,7 @@ const char *I18NCategory::T(const char *key, const char *def) {
auto iter = map_.find(modifiedKey);
if (iter != map_.end()) {
// ILOG("translation key found in %s: %s", name_.c_str(), key);
// INFO_LOG(SYSTEM, "translation key found in %s: %s", name_.c_str(), key);
return iter->second.text.c_str();
} else {
std::lock_guard<std::mutex> guard(missedKeyLock_);
@ -40,7 +39,7 @@ const char *I18NCategory::T(const char *key, const char *def) {
missedKeyLog_[key] = def;
else
missedKeyLog_[key] = modifiedKey.c_str();
// ILOG("Missed translation key in %s: %s", name_.c_str(), key);
// INFO_LOG(SYSTEM, "Missed translation key in %s: %s", name_.c_str(), key);
return def ? def : key;
}
}
@ -50,7 +49,7 @@ void I18NCategory::SetMap(const std::map<std::string, std::string> &m) {
if (map_.find(iter->first) == map_.end()) {
std::string text = ReplaceAll(iter->second, "\\n", "\n");
map_[iter->first] = I18NEntry(text);
// ILOG("Language entry: %s -> %s", iter->first.c_str(), text.c_str());
// INFO_LOG(SYSTEM, "Language entry: %s -> %s", iter->first.c_str(), text.c_str());
}
}
}
@ -84,7 +83,7 @@ bool I18NRepo::LoadIni(const std::string &languageID, const std::string &overrid
IniFile ini;
std::string iniPath;
// ILOG("Loading lang ini %s", iniPath.c_str());
// INFO_LOG(SYSTEM, "Loading lang ini %s", iniPath.c_str());
if (!overridePath.empty()) {
iniPath = overridePath + languageID + ".ini";
} else {

View file

@ -9,7 +9,8 @@
#endif
#include "png_load.h"
#include "base/logging.h"
#include "Common/Log.h"
// *image_data_ptr should be deleted with free()
// return value of 1 == success.
@ -17,7 +18,7 @@ int pngLoad(const char *file, int *pwidth, int *pheight, unsigned char **image_d
#ifdef USING_QT_UI
QImage image(file, "PNG");
if (image.isNull()) {
ELOG("pngLoad: Error loading image %s", file);
ERROR_LOG(IO, "pngLoad: Error loading image %s", file);
return 0;
}
@ -36,7 +37,7 @@ int pngLoad(const char *file, int *pwidth, int *pheight, unsigned char **image_d
}
#else
if (flip)
ELOG("pngLoad: flip flag not supported, image will be loaded upside down");
ERROR_LOG(IO, "pngLoad: flip flag not supported, image will be loaded upside down");
png_image png;
memset(&png, 0, sizeof(png));
png.version = PNG_IMAGE_VERSION;
@ -45,7 +46,7 @@ int pngLoad(const char *file, int *pwidth, int *pheight, unsigned char **image_d
if (PNG_IMAGE_FAILED(png))
{
ELOG("pngLoad: %s", png.message);
ERROR_LOG(IO, "pngLoad: %s", png.message);
return 0;
}
*pwidth = png.width;
@ -65,7 +66,7 @@ int pngLoadPtr(const unsigned char *input_ptr, size_t input_len, int *pwidth, in
#ifdef USING_QT_UI
QImage image;
if (!image.loadFromData(input_ptr, input_len, "PNG")) {
ELOG("pngLoad: Error loading image");
ERROR_LOG(IO, "pngLoad: Error loading image");
return 0;
}
if (flip)
@ -83,14 +84,14 @@ int pngLoadPtr(const unsigned char *input_ptr, size_t input_len, int *pwidth, in
}
#else
if (flip)
ELOG("pngLoad: flip flag not supported, image will be loaded upside down");
ERROR_LOG(IO, "pngLoad: flip flag not supported, image will be loaded upside down");
png_image png{};
png.version = PNG_IMAGE_VERSION;
png_image_begin_read_from_memory(&png, input_ptr, input_len);
if (PNG_IMAGE_FAILED(png)) {
ELOG("pngLoad: %s", png.message);
ERROR_LOG(IO, "pngLoad: %s", png.message);
return 0;
}
*pwidth = png.width;
@ -101,7 +102,7 @@ int pngLoadPtr(const unsigned char *input_ptr, size_t input_len, int *pwidth, in
size_t size = PNG_IMAGE_SIZE(png);
if (!size) {
ELOG("pngLoad: empty image");
ERROR_LOG(IO, "pngLoad: empty image");
return 0;
}

View file

@ -2,12 +2,13 @@
#include <stdio.h>
#include <stdlib.h>
#include "base/logging.h"
#include "zlib.h"
#include "image/zim_load.h"
#include "math/math_util.h"
#include "file/vfs.h"
#include "Common/Log.h"
int ezuncompress(unsigned char* pDest, long* pnDestLen, const unsigned char* pSrc, long nSrcLen) {
z_stream stream;
stream.next_in = (Bytef*)pSrc;
@ -49,7 +50,7 @@ int ezuncompress(unsigned char* pDest, long* pnDestLen, const unsigned char* pSr
int LoadZIMPtr(const uint8_t *zim, size_t datasize, int *width, int *height, int *flags, uint8_t **image) {
if (zim[0] != 'Z' || zim[1] != 'I' || zim[2] != 'M' || zim[3] != 'G') {
ELOG("Not a ZIM file");
ERROR_LOG(IO, "Not a ZIM file");
return 0;
}
memcpy(width, zim + 4, 4);
@ -76,14 +77,14 @@ int LoadZIMPtr(const uint8_t *zim, size_t datasize, int *width, int *height, int
image_data_size[i] = width[i] * height[i] * 2;
break;
default:
ELOG("Invalid ZIM format %i", *flags & ZIM_FORMAT_MASK);
ERROR_LOG(IO, "Invalid ZIM format %i", *flags & ZIM_FORMAT_MASK);
return 0;
}
total_data_size += image_data_size[i];
}
if (total_data_size == 0) {
ELOG("Invalid ZIM data size 0");
ERROR_LOG(IO, "Invalid ZIM data size 0");
return 0;
}
@ -96,19 +97,19 @@ int LoadZIMPtr(const uint8_t *zim, size_t datasize, int *width, int *height, int
long outlen = (long)total_data_size;
int retcode = ezuncompress(*image, &outlen, (unsigned char *)(zim + 16), (long)datasize - 16);
if (Z_OK != retcode) {
ELOG("ZIM zlib format decompression failed: %d", retcode);
ERROR_LOG(IO, "ZIM zlib format decompression failed: %d", retcode);
free(*image);
*image = 0;
return 0;
}
if (outlen != total_data_size) {
// Shouldn't happen if return value was Z_OK.
ELOG("Wrong size data in ZIM: %i vs %i", (int)outlen, (int)total_data_size);
ERROR_LOG(IO, "Wrong size data in ZIM: %i vs %i", (int)outlen, (int)total_data_size);
}
} else {
memcpy(*image, zim + 16, datasize - 16);
if (datasize - 16 != (size_t)total_data_size) {
ELOG("Wrong size data in ZIM: %i vs %i", (int)(datasize-16), (int)total_data_size);
ERROR_LOG(IO, "Wrong size data in ZIM: %i vs %i", (int)(datasize-16), (int)total_data_size);
}
}
return num_levels;
@ -118,13 +119,13 @@ int LoadZIM(const char *filename, int *width, int *height, int *format, uint8_t
size_t size;
uint8_t *buffer = VFSReadFile(filename, &size);
if (!buffer) {
ELOG("Couldn't read data for '%s'", buffer);
ERROR_LOG(IO, "Couldn't read data for '%s'", buffer);
return 0;
}
int retval = LoadZIMPtr(buffer, (int)size, width, height, format, image);
if (!retval) {
ELOG("Not a valid ZIM file: %s (size: %d bytes)", filename, (int)size);
ERROR_LOG(IO, "Not a valid ZIM file: %s (size: %d bytes)", filename, (int)size);
}
delete [] buffer;
return retval;

View file

@ -1,10 +1,12 @@
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "base/logging.h"
#include <cstdio>
#include <cstring>
#include <cmath>
#include "image/zim_save.h"
#include "zlib.h"
#include "Common/Log.h"
static const char magic[5] = "ZIMG";
/*int num_levels = 1;
@ -141,7 +143,7 @@ void Convert(const uint8_t *image_data, int width, int height, int pitch, int fl
break;
default:
ELOG("Unhandled ZIM format %i", flags & ZIM_FORMAT_MASK);
ERROR_LOG(IO, "Unhandled ZIM format %d", flags & ZIM_FORMAT_MASK);
*data = 0;
*data_size = 0;
return;
@ -197,7 +199,7 @@ void SaveZIM(FILE *f, int width, int height, int pitch, int flags, const uint8_t
if (Z_OK == ezcompress(dest, &dest_len, data, data_size)) {
fwrite(dest, 1, dest_len, f);
} else {
ELOG("Zlib compression failed.\n");
ERROR_LOG(IO, "Zlib compression failed.\n");
}
delete [] dest;
} else {