fix background color (#460)

* fix background color

* reduce print about false problem

* Update memory.c
This commit is contained in:
coco875
2025-07-14 22:39:45 +00:00
committed by GitHub
parent d5b455af74
commit 01f6b9a1ce
4 changed files with 25 additions and 4 deletions
+8 -1
View File
@@ -300,7 +300,14 @@ float4 PSMain(PSInput input, float4 screenSpace : SV_Position) : SV_TARGET {
@end
@if(o_grayscale)
float intensity = (texel.r + texel.g + texel.b) / 3.0;
float p = float(0x19);
float r = texel.r*float(0x55);
float g = texel.g*float(0x4B);
float b = texel.b*float(0x5F);
float intensity = (r+g+b) / 256.0;
intensity *= 255.0/256.0;
intensity = pow(intensity, (p * 1.5 / 256.0) + 0.25);
intensity *= 31.0/32.0;
float3 new_texel = input.grayscale.rgb * intensity;
texel.rgb = lerp(texel.rgb, new_texel, input.grayscale.a);
@end
+8 -1
View File
@@ -260,7 +260,14 @@ fragment float4 fragmentShader(ProjectedVertex in [[stage_in]], constant FrameUn
@end
@if(o_grayscale)
float intensity = (texel.x + texel.y + texel.z) / 3.0;
float p = float(0x19);
float r = texel.r*float(0x55);
float g = texel.g*float(0x4B);
float b = texel.b*float(0x5F);
float intensity = (r+g+b) / 256.0;
intensity *= 255.0/256.0;
intensity = pow(intensity, (p * 1.5 / 256.0) + 0.25);
intensity *= 31.0/32.0;
float3 new_texel = in.grayscale.xyz * intensity;
texel.xyz = mix(texel.xyz, new_texel, in.grayscale.w);
@end
+8 -1
View File
@@ -188,7 +188,14 @@ void main() {
@end
@if(o_grayscale)
float intensity = (texel.r + texel.g + texel.b) / 3.0;
float p = float(0x19);
float r = texel.r*float(0x55);
float g = texel.g*float(0x4B);
float b = texel.b*float(0x5F);
float intensity = (r+g+b) / 256.0;
intensity *= 255.0/256.0;
intensity = pow(intensity, (p * 1.5 / 256.0) + 0.25);
intensity *= 31.0/32.0;
vec3 new_texel = vGrayscaleColor.rgb * intensity;
texel.rgb = mix(texel.rgb, new_texel, vGrayscaleColor.a);
@end
+1 -1
View File
@@ -155,7 +155,7 @@ Gfx* segmented_gfx_to_virtual(const void* addr) {
}
static uintptr_t get_texture2(size_t offset, const course_texture* textures) {
if (!(offset & 0x5000000)) {
if (!((offset >= 0x5000000) && (offset < 0x6000000))) {
return NULL;
}
size_t totalOffset = 0x5000000;