| // Generated Code - DO NOT EDIT !! |
| // generated by 'emugen' |
| |
| |
| #include <string.h> |
| #include "gl_opcodes.h" |
| |
| #include "gl_enc.h" |
| |
| |
| #include <vector> |
| |
| #include <stdio.h> |
| |
| #include "aemu/base/Tracing.h" |
| |
| #include "EncoderDebug.h" |
| |
| namespace { |
| |
| void enc_unsupported() |
| { |
| ALOGE("Function is unsupported\n"); |
| } |
| |
| void glAlphaFunc_enc(void *self , GLenum func, GLclampf ref) |
| { |
| ENCODER_DEBUG_LOG("glAlphaFunc(func:0x%08x, ref:%f)", func, ref); |
| AEMU_SCOPED_TRACE("glAlphaFunc encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glAlphaFunc;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &func, 4); ptr += 4; |
| memcpy(ptr, &ref, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glClearColor_enc(void *self , GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) |
| { |
| ENCODER_DEBUG_LOG("glClearColor(red:%f, green:%f, blue:%f, alpha:%f)", red, green, blue, alpha); |
| AEMU_SCOPED_TRACE("glClearColor encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glClearColor;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &red, 4); ptr += 4; |
| memcpy(ptr, &green, 4); ptr += 4; |
| memcpy(ptr, &blue, 4); ptr += 4; |
| memcpy(ptr, &alpha, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glClearDepthf_enc(void *self , GLclampf depth) |
| { |
| ENCODER_DEBUG_LOG("glClearDepthf(depth:%f)", depth); |
| AEMU_SCOPED_TRACE("glClearDepthf encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glClearDepthf;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &depth, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glClipPlanef_enc(void *self , GLenum plane, const GLfloat* equation) |
| { |
| ENCODER_DEBUG_LOG("glClipPlanef(plane:0x%08x, equation:0x%08x)", plane, equation); |
| AEMU_SCOPED_TRACE("glClipPlanef encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_equation = (4 * sizeof(float)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_equation + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glClipPlanef;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &plane, 4); ptr += 4; |
| memcpy(ptr, &__size_equation, 4); ptr += 4; |
| memcpy(ptr, equation, __size_equation);ptr += __size_equation; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glColor4f_enc(void *self , GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) |
| { |
| ENCODER_DEBUG_LOG("glColor4f(red:%f, green:%f, blue:%f, alpha:%f)", red, green, blue, alpha); |
| AEMU_SCOPED_TRACE("glColor4f encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glColor4f;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &red, 4); ptr += 4; |
| memcpy(ptr, &green, 4); ptr += 4; |
| memcpy(ptr, &blue, 4); ptr += 4; |
| memcpy(ptr, &alpha, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDepthRangef_enc(void *self , GLclampf zNear, GLclampf zFar) |
| { |
| ENCODER_DEBUG_LOG("glDepthRangef(zNear:%f, zFar:%f)", zNear, zFar); |
| AEMU_SCOPED_TRACE("glDepthRangef encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDepthRangef;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &zNear, 4); ptr += 4; |
| memcpy(ptr, &zFar, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glFogf_enc(void *self , GLenum pname, GLfloat param) |
| { |
| ENCODER_DEBUG_LOG("glFogf(pname:0x%08x, param:%f)", pname, param); |
| AEMU_SCOPED_TRACE("glFogf encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glFogf;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, ¶m, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glFogfv_enc(void *self , GLenum pname, const GLfloat* params) |
| { |
| ENCODER_DEBUG_LOG("glFogfv(pname:0x%08x, params:0x%08x)", pname, params); |
| AEMU_SCOPED_TRACE("glFogfv encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_params + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glFogfv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, &__size_params, 4); ptr += 4; |
| memcpy(ptr, params, __size_params);ptr += __size_params; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glFrustumf_enc(void *self , GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) |
| { |
| ENCODER_DEBUG_LOG("glFrustumf(left:%f, right:%f, bottom:%f, top:%f, zNear:%f, zFar:%f)", left, right, bottom, top, zNear, zFar); |
| AEMU_SCOPED_TRACE("glFrustumf encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glFrustumf;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &left, 4); ptr += 4; |
| memcpy(ptr, &right, 4); ptr += 4; |
| memcpy(ptr, &bottom, 4); ptr += 4; |
| memcpy(ptr, &top, 4); ptr += 4; |
| memcpy(ptr, &zNear, 4); ptr += 4; |
| memcpy(ptr, &zFar, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glGetClipPlanef_enc(void *self , GLenum pname, GLfloat* eqn) |
| { |
| ENCODER_DEBUG_LOG("glGetClipPlanef(pname:0x%08x, eqn:0x%08x)", pname, eqn); |
| AEMU_SCOPED_TRACE("glGetClipPlanef encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_eqn = (4 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glGetClipPlanef;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, &__size_eqn, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(eqn, __size_eqn); |
| if (useChecksum) checksumCalculator->addBuffer(eqn, __size_eqn); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetClipPlanef: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetFloatv_enc(void *self , GLenum pname, GLfloat* params) |
| { |
| ENCODER_DEBUG_LOG("glGetFloatv(pname:0x%08x, params:0x%08x)", pname, params); |
| AEMU_SCOPED_TRACE("glGetFloatv encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glGetFloatv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, &__size_params, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(params, __size_params); |
| if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetFloatv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetLightfv_enc(void *self , GLenum light, GLenum pname, GLfloat* params) |
| { |
| ENCODER_DEBUG_LOG("glGetLightfv(light:0x%08x, pname:0x%08x, params:0x%08x)", light, pname, params); |
| AEMU_SCOPED_TRACE("glGetLightfv encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glGetLightfv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &light, 4); ptr += 4; |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, &__size_params, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(params, __size_params); |
| if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetLightfv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetMaterialfv_enc(void *self , GLenum face, GLenum pname, GLfloat* params) |
| { |
| ENCODER_DEBUG_LOG("glGetMaterialfv(face:0x%08x, pname:0x%08x, params:0x%08x)", face, pname, params); |
| AEMU_SCOPED_TRACE("glGetMaterialfv encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glGetMaterialfv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &face, 4); ptr += 4; |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, &__size_params, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(params, __size_params); |
| if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetMaterialfv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetTexEnvfv_enc(void *self , GLenum env, GLenum pname, GLfloat* params) |
| { |
| ENCODER_DEBUG_LOG("glGetTexEnvfv(env:0x%08x, pname:0x%08x, params:0x%08x)", env, pname, params); |
| AEMU_SCOPED_TRACE("glGetTexEnvfv encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glGetTexEnvfv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &env, 4); ptr += 4; |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, &__size_params, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(params, __size_params); |
| if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetTexEnvfv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetTexParameterfv_enc(void *self , GLenum target, GLenum pname, GLfloat* params) |
| { |
| ENCODER_DEBUG_LOG("glGetTexParameterfv(target:0x%08x, pname:0x%08x, params:0x%08x)", target, pname, params); |
| AEMU_SCOPED_TRACE("glGetTexParameterfv encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glGetTexParameterfv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, &__size_params, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(params, __size_params); |
| if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetTexParameterfv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glLightModelf_enc(void *self , GLenum pname, GLfloat param) |
| { |
| ENCODER_DEBUG_LOG("glLightModelf(pname:0x%08x, param:%f)", pname, param); |
| AEMU_SCOPED_TRACE("glLightModelf encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glLightModelf;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, ¶m, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glLightModelfv_enc(void *self , GLenum pname, const GLfloat* params) |
| { |
| ENCODER_DEBUG_LOG("glLightModelfv(pname:0x%08x, params:0x%08x)", pname, params); |
| AEMU_SCOPED_TRACE("glLightModelfv encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_params + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glLightModelfv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, &__size_params, 4); ptr += 4; |
| memcpy(ptr, params, __size_params);ptr += __size_params; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glLightf_enc(void *self , GLenum light, GLenum pname, GLfloat param) |
| { |
| ENCODER_DEBUG_LOG("glLightf(light:0x%08x, pname:0x%08x, param:%f)", light, pname, param); |
| AEMU_SCOPED_TRACE("glLightf encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glLightf;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &light, 4); ptr += 4; |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, ¶m, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glLightfv_enc(void *self , GLenum light, GLenum pname, const GLfloat* params) |
| { |
| ENCODER_DEBUG_LOG("glLightfv(light:0x%08x, pname:0x%08x, params:0x%08x)", light, pname, params); |
| AEMU_SCOPED_TRACE("glLightfv encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glLightfv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &light, 4); ptr += 4; |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, &__size_params, 4); ptr += 4; |
| memcpy(ptr, params, __size_params);ptr += __size_params; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glLineWidth_enc(void *self , GLfloat width) |
| { |
| ENCODER_DEBUG_LOG("glLineWidth(width:%f)", width); |
| AEMU_SCOPED_TRACE("glLineWidth encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glLineWidth;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &width, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glLoadMatrixf_enc(void *self , const GLfloat* m) |
| { |
| ENCODER_DEBUG_LOG("glLoadMatrixf(m:0x%08x)", m); |
| AEMU_SCOPED_TRACE("glLoadMatrixf encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_m = (16 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + __size_m + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glLoadMatrixf;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &__size_m, 4); ptr += 4; |
| memcpy(ptr, m, __size_m);ptr += __size_m; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glMaterialf_enc(void *self , GLenum face, GLenum pname, GLfloat param) |
| { |
| ENCODER_DEBUG_LOG("glMaterialf(face:0x%08x, pname:0x%08x, param:%f)", face, pname, param); |
| AEMU_SCOPED_TRACE("glMaterialf encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glMaterialf;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &face, 4); ptr += 4; |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, ¶m, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glMaterialfv_enc(void *self , GLenum face, GLenum pname, const GLfloat* params) |
| { |
| ENCODER_DEBUG_LOG("glMaterialfv(face:0x%08x, pname:0x%08x, params:0x%08x)", face, pname, params); |
| AEMU_SCOPED_TRACE("glMaterialfv encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glMaterialfv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &face, 4); ptr += 4; |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, &__size_params, 4); ptr += 4; |
| memcpy(ptr, params, __size_params);ptr += __size_params; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glMultMatrixf_enc(void *self , const GLfloat* m) |
| { |
| ENCODER_DEBUG_LOG("glMultMatrixf(m:0x%08x)", m); |
| AEMU_SCOPED_TRACE("glMultMatrixf encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_m = (16 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + __size_m + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glMultMatrixf;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &__size_m, 4); ptr += 4; |
| memcpy(ptr, m, __size_m);ptr += __size_m; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glMultiTexCoord4f_enc(void *self , GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) |
| { |
| ENCODER_DEBUG_LOG("glMultiTexCoord4f(target:0x%08x, s:%f, t:%f, r:%f, q:%f)", target, s, t, r, q); |
| AEMU_SCOPED_TRACE("glMultiTexCoord4f encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glMultiTexCoord4f;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &s, 4); ptr += 4; |
| memcpy(ptr, &t, 4); ptr += 4; |
| memcpy(ptr, &r, 4); ptr += 4; |
| memcpy(ptr, &q, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glNormal3f_enc(void *self , GLfloat nx, GLfloat ny, GLfloat nz) |
| { |
| ENCODER_DEBUG_LOG("glNormal3f(nx:%f, ny:%f, nz:%f)", nx, ny, nz); |
| AEMU_SCOPED_TRACE("glNormal3f encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glNormal3f;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &nx, 4); ptr += 4; |
| memcpy(ptr, &ny, 4); ptr += 4; |
| memcpy(ptr, &nz, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glOrthof_enc(void *self , GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) |
| { |
| ENCODER_DEBUG_LOG("glOrthof(left:%f, right:%f, bottom:%f, top:%f, zNear:%f, zFar:%f)", left, right, bottom, top, zNear, zFar); |
| AEMU_SCOPED_TRACE("glOrthof encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glOrthof;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &left, 4); ptr += 4; |
| memcpy(ptr, &right, 4); ptr += 4; |
| memcpy(ptr, &bottom, 4); ptr += 4; |
| memcpy(ptr, &top, 4); ptr += 4; |
| memcpy(ptr, &zNear, 4); ptr += 4; |
| memcpy(ptr, &zFar, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glPointParameterf_enc(void *self , GLenum pname, GLfloat param) |
| { |
| ENCODER_DEBUG_LOG("glPointParameterf(pname:0x%08x, param:%f)", pname, param); |
| AEMU_SCOPED_TRACE("glPointParameterf encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glPointParameterf;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, ¶m, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glPointParameterfv_enc(void *self , GLenum pname, const GLfloat* params) |
| { |
| ENCODER_DEBUG_LOG("glPointParameterfv(pname:0x%08x, params:0x%08x)", pname, params); |
| AEMU_SCOPED_TRACE("glPointParameterfv encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_params + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glPointParameterfv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, &__size_params, 4); ptr += 4; |
| memcpy(ptr, params, __size_params);ptr += __size_params; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glPointSize_enc(void *self , GLfloat size) |
| { |
| ENCODER_DEBUG_LOG("glPointSize(size:%f)", size); |
| AEMU_SCOPED_TRACE("glPointSize encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glPointSize;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &size, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glPolygonOffset_enc(void *self , GLfloat factor, GLfloat units) |
| { |
| ENCODER_DEBUG_LOG("glPolygonOffset(factor:%f, units:%f)", factor, units); |
| AEMU_SCOPED_TRACE("glPolygonOffset encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glPolygonOffset;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &factor, 4); ptr += 4; |
| memcpy(ptr, &units, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glRotatef_enc(void *self , GLfloat angle, GLfloat x, GLfloat y, GLfloat z) |
| { |
| ENCODER_DEBUG_LOG("glRotatef(angle:%f, x:%f, y:%f, z:%f)", angle, x, y, z); |
| AEMU_SCOPED_TRACE("glRotatef encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glRotatef;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &angle, 4); ptr += 4; |
| memcpy(ptr, &x, 4); ptr += 4; |
| memcpy(ptr, &y, 4); ptr += 4; |
| memcpy(ptr, &z, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glScalef_enc(void *self , GLfloat x, GLfloat y, GLfloat z) |
| { |
| ENCODER_DEBUG_LOG("glScalef(x:%f, y:%f, z:%f)", x, y, z); |
| AEMU_SCOPED_TRACE("glScalef encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glScalef;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &x, 4); ptr += 4; |
| memcpy(ptr, &y, 4); ptr += 4; |
| memcpy(ptr, &z, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glTexEnvf_enc(void *self , GLenum target, GLenum pname, GLfloat param) |
| { |
| ENCODER_DEBUG_LOG("glTexEnvf(target:0x%08x, pname:0x%08x, param:%f)", target, pname, param); |
| AEMU_SCOPED_TRACE("glTexEnvf encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glTexEnvf;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, ¶m, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glTexEnvfv_enc(void *self , GLenum target, GLenum pname, const GLfloat* params) |
| { |
| ENCODER_DEBUG_LOG("glTexEnvfv(target:0x%08x, pname:0x%08x, params:0x%08x)", target, pname, params); |
| AEMU_SCOPED_TRACE("glTexEnvfv encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glTexEnvfv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, &__size_params, 4); ptr += 4; |
| memcpy(ptr, params, __size_params);ptr += __size_params; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glTexParameterf_enc(void *self , GLenum target, GLenum pname, GLfloat param) |
| { |
| ENCODER_DEBUG_LOG("glTexParameterf(target:0x%08x, pname:0x%08x, param:%f)", target, pname, param); |
| AEMU_SCOPED_TRACE("glTexParameterf encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glTexParameterf;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, ¶m, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glTexParameterfv_enc(void *self , GLenum target, GLenum pname, const GLfloat* params) |
| { |
| ENCODER_DEBUG_LOG("glTexParameterfv(target:0x%08x, pname:0x%08x, params:0x%08x)", target, pname, params); |
| AEMU_SCOPED_TRACE("glTexParameterfv encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glTexParameterfv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, &__size_params, 4); ptr += 4; |
| memcpy(ptr, params, __size_params);ptr += __size_params; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glTranslatef_enc(void *self , GLfloat x, GLfloat y, GLfloat z) |
| { |
| ENCODER_DEBUG_LOG("glTranslatef(x:%f, y:%f, z:%f)", x, y, z); |
| AEMU_SCOPED_TRACE("glTranslatef encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glTranslatef;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &x, 4); ptr += 4; |
| memcpy(ptr, &y, 4); ptr += 4; |
| memcpy(ptr, &z, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glActiveTexture_enc(void *self , GLenum texture) |
| { |
| ENCODER_DEBUG_LOG("glActiveTexture(texture:0x%08x)", texture); |
| AEMU_SCOPED_TRACE("glActiveTexture encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glActiveTexture;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &texture, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glAlphaFuncx_enc(void *self , GLenum func, GLclampx ref) |
| { |
| ENCODER_DEBUG_LOG("glAlphaFuncx(func:0x%08x, ref:0x%08x)", func, ref); |
| AEMU_SCOPED_TRACE("glAlphaFuncx encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glAlphaFuncx;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &func, 4); ptr += 4; |
| memcpy(ptr, &ref, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glBindBuffer_enc(void *self , GLenum target, GLuint buffer) |
| { |
| ENCODER_DEBUG_LOG("glBindBuffer(target:0x%08x, buffer:%u)", target, buffer); |
| AEMU_SCOPED_TRACE("glBindBuffer encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glBindBuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &buffer, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glBindTexture_enc(void *self , GLenum target, GLuint texture) |
| { |
| ENCODER_DEBUG_LOG("glBindTexture(target:0x%08x, texture:%u)", target, texture); |
| AEMU_SCOPED_TRACE("glBindTexture encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glBindTexture;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &texture, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glBlendFunc_enc(void *self , GLenum sfactor, GLenum dfactor) |
| { |
| ENCODER_DEBUG_LOG("glBlendFunc(sfactor:0x%08x, dfactor:0x%08x)", sfactor, dfactor); |
| AEMU_SCOPED_TRACE("glBlendFunc encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glBlendFunc;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &sfactor, 4); ptr += 4; |
| memcpy(ptr, &dfactor, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glBufferData_enc(void *self , GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) |
| { |
| ENCODER_DEBUG_LOG("glBufferData(target:0x%08x, size:0x%08lx, data:0x%08x, usage:0x%08x)", target, size, data, usage); |
| AEMU_SCOPED_TRACE("glBufferData encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_data = ((data != NULL) ? size : 0); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_data + 4 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glBufferData;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &size, 4); ptr += 4; |
| memcpy(ptr, &__size_data, 4); ptr += 4; |
| if (data != NULL) memcpy(ptr, data, __size_data);ptr += __size_data; |
| memcpy(ptr, &usage, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glBufferSubData_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) |
| { |
| ENCODER_DEBUG_LOG("glBufferSubData(target:0x%08x, offset:0x%08lx, size:0x%08lx, data:0x%08x)", target, offset, size, data); |
| AEMU_SCOPED_TRACE("glBufferSubData encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_data = ((data != NULL) ? size : 0); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_data + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glBufferSubData;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &offset, 4); ptr += 4; |
| memcpy(ptr, &size, 4); ptr += 4; |
| memcpy(ptr, &__size_data, 4); ptr += 4; |
| if (data != NULL) memcpy(ptr, data, __size_data);ptr += __size_data; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glClear_enc(void *self , GLbitfield mask) |
| { |
| ENCODER_DEBUG_LOG("glClear(mask:0x%08x)", mask); |
| AEMU_SCOPED_TRACE("glClear encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glClear;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &mask, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glClearColorx_enc(void *self , GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) |
| { |
| ENCODER_DEBUG_LOG("glClearColorx(red:0x%08x, green:0x%08x, blue:0x%08x, alpha:0x%08x)", red, green, blue, alpha); |
| AEMU_SCOPED_TRACE("glClearColorx encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glClearColorx;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &red, 4); ptr += 4; |
| memcpy(ptr, &green, 4); ptr += 4; |
| memcpy(ptr, &blue, 4); ptr += 4; |
| memcpy(ptr, &alpha, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glClearDepthx_enc(void *self , GLclampx depth) |
| { |
| ENCODER_DEBUG_LOG("glClearDepthx(depth:0x%08x)", depth); |
| AEMU_SCOPED_TRACE("glClearDepthx encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glClearDepthx;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &depth, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glClearStencil_enc(void *self , GLint s) |
| { |
| ENCODER_DEBUG_LOG("glClearStencil(s:%d)", s); |
| AEMU_SCOPED_TRACE("glClearStencil encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glClearStencil;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &s, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glClientActiveTexture_enc(void *self , GLenum texture) |
| { |
| ENCODER_DEBUG_LOG("glClientActiveTexture(texture:0x%08x)", texture); |
| AEMU_SCOPED_TRACE("glClientActiveTexture encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glClientActiveTexture;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &texture, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glColor4ub_enc(void *self , GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) |
| { |
| ENCODER_DEBUG_LOG("glColor4ub(red:0x%02x, green:0x%02x, blue:0x%02x, alpha:0x%02x)", red, green, blue, alpha); |
| AEMU_SCOPED_TRACE("glColor4ub encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 1 + 1 + 1 + 1; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glColor4ub;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &red, 1); ptr += 1; |
| memcpy(ptr, &green, 1); ptr += 1; |
| memcpy(ptr, &blue, 1); ptr += 1; |
| memcpy(ptr, &alpha, 1); ptr += 1; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glColor4x_enc(void *self , GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) |
| { |
| ENCODER_DEBUG_LOG("glColor4x(red:0x%08x, green:0x%08x, blue:0x%08x, alpha:0x%08x)", red, green, blue, alpha); |
| AEMU_SCOPED_TRACE("glColor4x encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glColor4x;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &red, 4); ptr += 4; |
| memcpy(ptr, &green, 4); ptr += 4; |
| memcpy(ptr, &blue, 4); ptr += 4; |
| memcpy(ptr, &alpha, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glColorMask_enc(void *self , GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) |
| { |
| ENCODER_DEBUG_LOG("glColorMask(red:%d, green:%d, blue:%d, alpha:%d)", red, green, blue, alpha); |
| AEMU_SCOPED_TRACE("glColorMask encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 1 + 1 + 1 + 1; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glColorMask;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &red, 1); ptr += 1; |
| memcpy(ptr, &green, 1); ptr += 1; |
| memcpy(ptr, &blue, 1); ptr += 1; |
| memcpy(ptr, &alpha, 1); ptr += 1; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glCompressedTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data) |
| { |
| ENCODER_DEBUG_LOG("glCompressedTexImage2D(target:0x%08x, level:%d, internalformat:0x%08x, width:%d, height:%d, border:%d, imageSize:%d, data:0x%08x)", target, level, internalformat, width, height, border, imageSize, data); |
| AEMU_SCOPED_TRACE("glCompressedTexImage2D encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_data = ((data != NULL) ? imageSize : 0); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glCompressedTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &level, 4); ptr += 4; |
| memcpy(ptr, &internalformat, 4); ptr += 4; |
| memcpy(ptr, &width, 4); ptr += 4; |
| memcpy(ptr, &height, 4); ptr += 4; |
| memcpy(ptr, &border, 4); ptr += 4; |
| memcpy(ptr, &imageSize, 4); ptr += 4; |
| memcpy(ptr, &__size_data, 4); ptr += 4; |
| if (data != NULL) memcpy(ptr, data, __size_data);ptr += __size_data; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glCompressedTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data) |
| { |
| ENCODER_DEBUG_LOG("glCompressedTexSubImage2D(target:0x%08x, level:%d, xoffset:%d, yoffset:%d, width:%d, height:%d, format:0x%08x, imageSize:%d, data:0x%08x)", target, level, xoffset, yoffset, width, height, format, imageSize, data); |
| AEMU_SCOPED_TRACE("glCompressedTexSubImage2D encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_data = ((data != NULL) ? imageSize : 0); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glCompressedTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &level, 4); ptr += 4; |
| memcpy(ptr, &xoffset, 4); ptr += 4; |
| memcpy(ptr, &yoffset, 4); ptr += 4; |
| memcpy(ptr, &width, 4); ptr += 4; |
| memcpy(ptr, &height, 4); ptr += 4; |
| memcpy(ptr, &format, 4); ptr += 4; |
| memcpy(ptr, &imageSize, 4); ptr += 4; |
| memcpy(ptr, &__size_data, 4); ptr += 4; |
| if (data != NULL) memcpy(ptr, data, __size_data);ptr += __size_data; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glCopyTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) |
| { |
| ENCODER_DEBUG_LOG("glCopyTexImage2D(target:0x%08x, level:%d, internalformat:0x%08x, x:%d, y:%d, width:%d, height:%d, border:%d)", target, level, internalformat, x, y, width, height, border); |
| AEMU_SCOPED_TRACE("glCopyTexImage2D encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glCopyTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &level, 4); ptr += 4; |
| memcpy(ptr, &internalformat, 4); ptr += 4; |
| memcpy(ptr, &x, 4); ptr += 4; |
| memcpy(ptr, &y, 4); ptr += 4; |
| memcpy(ptr, &width, 4); ptr += 4; |
| memcpy(ptr, &height, 4); ptr += 4; |
| memcpy(ptr, &border, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glCopyTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) |
| { |
| ENCODER_DEBUG_LOG("glCopyTexSubImage2D(target:0x%08x, level:%d, xoffset:%d, yoffset:%d, x:%d, y:%d, width:%d, height:%d)", target, level, xoffset, yoffset, x, y, width, height); |
| AEMU_SCOPED_TRACE("glCopyTexSubImage2D encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glCopyTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &level, 4); ptr += 4; |
| memcpy(ptr, &xoffset, 4); ptr += 4; |
| memcpy(ptr, &yoffset, 4); ptr += 4; |
| memcpy(ptr, &x, 4); ptr += 4; |
| memcpy(ptr, &y, 4); ptr += 4; |
| memcpy(ptr, &width, 4); ptr += 4; |
| memcpy(ptr, &height, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glCullFace_enc(void *self , GLenum mode) |
| { |
| ENCODER_DEBUG_LOG("glCullFace(mode:0x%08x)", mode); |
| AEMU_SCOPED_TRACE("glCullFace encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glCullFace;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &mode, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDeleteBuffers_enc(void *self , GLsizei n, const GLuint* buffers) |
| { |
| ENCODER_DEBUG_LOG("glDeleteBuffers(n:%d, buffers:0x%08x)", n, buffers); |
| AEMU_SCOPED_TRACE("glDeleteBuffers encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_buffers = (n * sizeof(GLuint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_buffers + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDeleteBuffers;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &n, 4); ptr += 4; |
| memcpy(ptr, &__size_buffers, 4); ptr += 4; |
| memcpy(ptr, buffers, __size_buffers);ptr += __size_buffers; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDeleteTextures_enc(void *self , GLsizei n, const GLuint* textures) |
| { |
| ENCODER_DEBUG_LOG("glDeleteTextures(n:%d, textures:0x%08x)", n, textures); |
| AEMU_SCOPED_TRACE("glDeleteTextures encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_textures = (n * sizeof(GLuint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_textures + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDeleteTextures;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &n, 4); ptr += 4; |
| memcpy(ptr, &__size_textures, 4); ptr += 4; |
| memcpy(ptr, textures, __size_textures);ptr += __size_textures; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDepthFunc_enc(void *self , GLenum func) |
| { |
| ENCODER_DEBUG_LOG("glDepthFunc(func:0x%08x)", func); |
| AEMU_SCOPED_TRACE("glDepthFunc encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDepthFunc;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &func, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDepthMask_enc(void *self , GLboolean flag) |
| { |
| ENCODER_DEBUG_LOG("glDepthMask(flag:%d)", flag); |
| AEMU_SCOPED_TRACE("glDepthMask encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 1; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDepthMask;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &flag, 1); ptr += 1; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDepthRangex_enc(void *self , GLclampx zNear, GLclampx zFar) |
| { |
| ENCODER_DEBUG_LOG("glDepthRangex(zNear:0x%08x, zFar:0x%08x)", zNear, zFar); |
| AEMU_SCOPED_TRACE("glDepthRangex encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDepthRangex;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &zNear, 4); ptr += 4; |
| memcpy(ptr, &zFar, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDisable_enc(void *self , GLenum cap) |
| { |
| ENCODER_DEBUG_LOG("glDisable(cap:0x%08x)", cap); |
| AEMU_SCOPED_TRACE("glDisable encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDisable;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &cap, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDisableClientState_enc(void *self , GLenum array) |
| { |
| ENCODER_DEBUG_LOG("glDisableClientState(array:0x%08x)", array); |
| AEMU_SCOPED_TRACE("glDisableClientState encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDisableClientState;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &array, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDrawArrays_enc(void *self , GLenum mode, GLint first, GLsizei count) |
| { |
| ENCODER_DEBUG_LOG("glDrawArrays(mode:0x%08x, first:%d, count:%d)", mode, first, count); |
| AEMU_SCOPED_TRACE("glDrawArrays encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDrawArrays;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &mode, 4); ptr += 4; |
| memcpy(ptr, &first, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glEnable_enc(void *self , GLenum cap) |
| { |
| ENCODER_DEBUG_LOG("glEnable(cap:0x%08x)", cap); |
| AEMU_SCOPED_TRACE("glEnable encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glEnable;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &cap, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glEnableClientState_enc(void *self , GLenum array) |
| { |
| ENCODER_DEBUG_LOG("glEnableClientState(array:0x%08x)", array); |
| AEMU_SCOPED_TRACE("glEnableClientState encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glEnableClientState;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &array, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glFinish_enc(void *self ) |
| { |
| ENCODER_DEBUG_LOG("glFinish()"); |
| AEMU_SCOPED_TRACE("glFinish encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glFinish;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glFlush_enc(void *self ) |
| { |
| ENCODER_DEBUG_LOG("glFlush()"); |
| AEMU_SCOPED_TRACE("glFlush encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glFlush;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glFogx_enc(void *self , GLenum pname, GLfixed param) |
| { |
| ENCODER_DEBUG_LOG("glFogx(pname:0x%08x, param:0x%08x)", pname, param); |
| AEMU_SCOPED_TRACE("glFogx encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glFogx;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, ¶m, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glFogxv_enc(void *self , GLenum pname, const GLfixed* params) |
| { |
| ENCODER_DEBUG_LOG("glFogxv(pname:0x%08x, params:0x%08x)", pname, params); |
| AEMU_SCOPED_TRACE("glFogxv encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfixed)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_params + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glFogxv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, &__size_params, 4); ptr += 4; |
| memcpy(ptr, params, __size_params);ptr += __size_params; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glFrontFace_enc(void *self , GLenum mode) |
| { |
| ENCODER_DEBUG_LOG("glFrontFace(mode:0x%08x)", mode); |
| AEMU_SCOPED_TRACE("glFrontFace encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glFrontFace;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &mode, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glFrustumx_enc(void *self , GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) |
| { |
| ENCODER_DEBUG_LOG("glFrustumx(left:0x%08x, right:0x%08x, bottom:0x%08x, top:0x%08x, zNear:0x%08x, zFar:0x%08x)", left, right, bottom, top, zNear, zFar); |
| AEMU_SCOPED_TRACE("glFrustumx encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glFrustumx;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &left, 4); ptr += 4; |
| memcpy(ptr, &right, 4); ptr += 4; |
| memcpy(ptr, &bottom, 4); ptr += 4; |
| memcpy(ptr, &top, 4); ptr += 4; |
| memcpy(ptr, &zNear, 4); ptr += 4; |
| memcpy(ptr, &zFar, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glGetBooleanv_enc(void *self , GLenum pname, GLboolean* params) |
| { |
| ENCODER_DEBUG_LOG("glGetBooleanv(pname:0x%08x, params:0x%08x)", pname, params); |
| AEMU_SCOPED_TRACE("glGetBooleanv encode"); |
| |
| gl_encoder_context_t *ctx = (gl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLboolean)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
|