Skip to content

Commit

Permalink
Merge branch 'hrydgard:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
danssmnt authored Jul 27, 2022
2 parents 917c113 + 74fc1a8 commit 3ae7c0e
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 9 deletions.
6 changes: 6 additions & 0 deletions Common/Render/Text/draw_text_android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ std::string TextDrawerAndroid::NormalizeString(std::string str) {
}

void TextDrawerAndroid::MeasureString(const char *str, size_t len, float *w, float *h) {
if (!str) {
*w = 0.0;
*h = 0.0;
return;
}

CacheKey key{ std::string(str, len), fontHash_ };
TextMeasureEntry *entry;
auto iter = sizeCache_.find(key);
Expand Down
7 changes: 2 additions & 5 deletions Core/FileSystems/BlockDevices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ bool CISOFileBlockDevice::ReadBlock(int blockNumber, u8 *outPtr, bool uncached)
const u32 idx = index[frameNumber];
const u32 indexPos = idx & 0x7FFFFFFF;
const u32 nextIndexPos = index[frameNumber + 1] & 0x7FFFFFFF;
z_stream z;
z_stream z{};

const u64 compressedReadPos = (u64)indexPos << indexShift;
const u64 compressedReadEnd = (u64)nextIndexPos << indexShift;
Expand Down Expand Up @@ -311,10 +311,7 @@ bool CISOFileBlockDevice::ReadBlocks(u32 minBlock, int count, u8 *outPtr) {
const u32 afterLastIndexPos = index[lastFrameNumber + 1] & 0x7FFFFFFF;
const u64 totalReadEnd = (u64)afterLastIndexPos << indexShift;

z_stream z;
z.zalloc = Z_NULL;
z.zfree = Z_NULL;
z.opaque = Z_NULL;
z_stream z{};
if (inflateInit2(&z, -15) != Z_OK) {
ERROR_LOG(LOADER, "Unable to initialize inflate: %s\n", (z.msg) ? z.msg : "?");
return false;
Expand Down
8 changes: 5 additions & 3 deletions Core/Reporting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,11 @@ namespace Reporting
return false;

if (http.Resolve(serverHost, ServerPort())) {
http.Connect();
int result = http.POST(http::RequestParams(uri), data, mimeType, output, &progress);
http.Disconnect();
int result = -1;
if (http.Connect()) {
result = http.POST(http::RequestParams(uri), data, mimeType, output, &progress);
http.Disconnect();
}

return result >= 200 && result < 300;
} else {
Expand Down
5 changes: 5 additions & 0 deletions Core/TextureReplacer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,11 @@ bool TextureReplacer::PopulateLevel(ReplacedTextureLevel &level) {
bool good = false;

FILE *fp = File::OpenCFile(level.file, "rb");
if (!fp) {
ERROR_LOG(G3D, "Error opening replacement texture file '%s'", level.file.c_str());
return false;
}

auto imageType = Identify(fp);
if (imageType == ReplacedImageType::ZIM) {
fseek(fp, 4, SEEK_SET);
Expand Down
6 changes: 5 additions & 1 deletion GPU/Common/GPUStateUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1089,26 +1089,30 @@ void ConvertBlendState(GenericBlendState &blendState, bool allowFramebufferRead,

case REPLACE_BLEND_BLUE_TO_ALPHA:
blueToAlpha = true;
blendState.enabled = gstate.isAlphaBlendEnabled();
// We'll later convert the color blend to blend in the alpha channel.
break;

case REPLACE_BLEND_COPY_FBO:
blendState.enabled = true;
blendState.applyFramebufferRead = true;
blendState.resetFramebufferRead = false;
blendState.replaceAlphaWithStencil = replaceAlphaWithStencil;
break;

case REPLACE_BLEND_PRE_SRC:
case REPLACE_BLEND_PRE_SRC_2X_ALPHA:
blendState.enabled = true;
usePreSrc = true;
break;

case REPLACE_BLEND_STANDARD:
case REPLACE_BLEND_2X_ALPHA:
case REPLACE_BLEND_2X_SRC:
blendState.enabled = true;
break;
}

blendState.enabled = true;
blendState.resetFramebufferRead = true;

const GEBlendMode blendFuncEq = gstate.getBlendEq();
Expand Down
1 change: 1 addition & 0 deletions assets/compat.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,7 @@ NPEH00029 = true
ULUS10455 = true

[BlueToAlpha]
# Split/Second
ULES01402 = true
ULUS10513 = true
ULJM05812 = true
Expand Down

0 comments on commit 3ae7c0e

Please sign in to comment.