X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fthecheat;a=blobdiff_plain;f=Searching.m;h=0297a84d273b1d275fd1a9f4c7e66ef4d40dc838;hp=80ad0d620c8308ded91cbd5cb2669c8af6e87a5d;hb=179538478d0db2e5f8f2b50ccb3ff889b474aa01;hpb=ad02580588e2ca41f15ba8f9bd084561d8d485c2 diff --git a/Searching.m b/Searching.m index 80ad0d6..0297a84 100644 --- a/Searching.m +++ b/Searching.m @@ -98,7 +98,24 @@ int SearchIteration( ThreadedTask *task, unsigned iteration ) offset = VMRegionAddress( region ) - (TCAddress)context->buffer; while ( ptr < top ) { - if ( context->compareFunc(ptr,context->value->_value) ) { + char firstValue[context->value->_size]; + memcpy(firstValue, ptr, context->value->_size); + + if (context->value->_isEmulated) + { + if (context->value->_type == TCFloat) + { + CFSwappedFloat32 firstSwappedFloat = CFConvertFloat32HostToSwapped(*((float *)firstValue)); + memcpy(firstValue, &firstSwappedFloat, context->value->_size); + } + else if (context->value->_type == TCDouble) + { + CFSwappedFloat64 firstSwappedDouble = CFConvertDoubleHostToSwapped(*((double *)firstValue)); + memcpy(firstValue, &firstSwappedDouble, context->value->_size); + } + } + + if ( context->compareFunc(firstValue,context->value->_value) ) { if ( context->numberOfResults >= TCArrayElementCount(context->addresses) ) { TCArrayResize( context->addresses, TCArrayElementCount(context->addresses) + TC_BUFFER_SIZE / sizeof(TCAddress) ); context->addressPtr = (TCAddress *)TCArrayBytes(context->addresses) + context->numberOfResults; @@ -184,7 +201,24 @@ int SearchIterationAgain( ThreadedTask *task, unsigned iteration ) for ( i = 0; i < top; i++ ) { ptr = context->buffer + *context->lastAddressPtr - VMRegionAddress(region); - if (ptr >= context->buffer && context->compareFunc(ptr,context->value->_value)) { + char firstValue[context->value->_size]; + memcpy(firstValue, ptr, context->value->_size); + + if (context->value->_isEmulated) + { + if (context->value->_type == TCFloat) + { + CFSwappedFloat32 firstSwappedFloat = CFConvertFloat32HostToSwapped(*((float *)firstValue)); + memcpy(firstValue, &firstSwappedFloat, context->value->_size); + } + else if (context->value->_type == TCDouble) + { + CFSwappedFloat64 firstSwappedDouble = CFConvertDoubleHostToSwapped(*((double *)firstValue)); + memcpy(firstValue, &firstSwappedDouble, context->value->_size); + } + } + + if (ptr >= context->buffer && context->compareFunc(firstValue,context->value->_value)) { if ( context->numberOfResults >= TCArrayElementCount(context->addresses) ) { TCArrayResize( context->addresses, TCArrayElementCount(context->addresses) + TC_BUFFER_SIZE / sizeof(TCAddress) ); context->addressPtr = (TCAddress *)TCArrayBytes(context->addresses) + context->numberOfResults;