Merge branch 'dev' of github.com:sm64ex-coop-dev/sm64ex-coop into dev

This commit is contained in:
MysterD 2023-06-14 23:25:09 -07:00
commit d22961e863
11 changed files with 55 additions and 25 deletions

View file

@ -976,9 +976,9 @@ COOPNET_LIBS :=
ifeq ($(COOPNET),1)
ifeq ($(WINDOWS_BUILD),1)
ifeq ($(TARGET_BITS), 32)
LDFLAGS += -Llib/coopnet/win32 -l:libcoopnet.a -l:libjuice.a -lbcrypt -lws2_32
LDFLAGS += -Llib/coopnet/win32 -l:libcoopnet.a -l:libjuice.a -lbcrypt -lws2_32 -liphlpapi
else
LDFLAGS += -Llib/coopnet/win64 -l:libcoopnet.a -l:libjuice.a -lbcrypt -lws2_32
LDFLAGS += -Llib/coopnet/win64 -l:libcoopnet.a -l:libjuice.a -lbcrypt -lws2_32 -liphlpapi
endif
else ifeq ($(OSX_BUILD),1)
LDFLAGS += -Wl,-rpath,@loader_path -L./lib/coopnet/mac/ -l coopnet

View file

@ -338,7 +338,7 @@ MASTER_VOLUME = "Hlavní hlasitost"
MUSIC_VOLUME = "Hlasitost písničky"
SFX_VOLUME = "Hlasitost zvuků"
ENV_VOLUME = "Hlasitost prostředí"
FADEOUT = "Fadeout Distant Sounds"
FADEOUT = "Ztišit daleké zvuky"
[LANGUAGE]
LANGUAGE = "JAZYK"

Binary file not shown.

View file

@ -36,7 +36,11 @@ void discord_fatal(int rc) {
}
if (rc != DiscordResult_Ok) {
LOG_ERROR("Discord threw an error. RC: %d", rc);
static bool sDiscordReported = false;
if (!sDiscordReported) {
sDiscordReported = true;
LOG_ERROR("Discord threw an error. RC: %d", rc);
}
}
}

View file

@ -29,6 +29,7 @@ void gfx_cc_get_features(struct ColorCombiner* cc, struct CCFeatures* ccf) {
}
ccf->used_textures[0] = ccf->used_textures[0] || c == SHADER_TEXEL0 || c == SHADER_TEXEL0A;
ccf->used_textures[1] = ccf->used_textures[1] || c == SHADER_TEXEL1 || c == SHADER_TEXEL1A;
ccf->do_noise = ccf->do_noise || c == SHADER_NOISE;
}
// figure out optimizations
@ -68,7 +69,7 @@ void gfx_cc_print(struct ColorCombiner *cc) {
printf("0x%08x", cm->flags);
printf(");");
printf(" // %016lx", cm->hash);
printf(" // %016" PRIx64, cm->hash);
printf("\n");
#endif
}
@ -112,6 +113,7 @@ void gfx_cc_precomp(void) {
gfx_pc_precomp_shader(0x04060401, 0x05000000, 0x04060402, 0x05000b0b, 0x00000001); // 1d970841b086b2e6
gfx_pc_precomp_shader(0x01000000, 0x04000000, 0x02000000, 0x04000b0b, 0x00000001); // 410000008f86b2e6
gfx_pc_precomp_shader(0x04060401, 0x05000000, 0x04060402, 0x05000b0b, 0x00000009); // 1d970841b086b2ee
gfx_pc_precomp_shader(0x00040001, 0x00040001, 0x00040002, 0x0b040b02, 0x00000009); // 110404410c0ab30f
sAllowCCPrint = 1;
}
@ -126,10 +128,9 @@ static uint8_t color_comb_component_a(uint32_t v, uint8_t cycle) {
case G_CCMUX_SHADE: return CC_SHADE;
case G_CCMUX_ENVIRONMENT: return CC_ENV;
case G_CCMUX_1: return CC_1;
//case G_CCMUX_NOISE: return CC_NOISE;
case G_CCMUX_0: return CC_0;
case G_CCMUX_COMBINED_ALPHA: return cycle ? CC_COMBINEDA : CC_0;
case G_CCMUX_COMBINED_ALPHA: return cycle ? CC_COMBINEDA : CC_NOISE;
case G_CCMUX_TEXEL0_ALPHA: return cycle ? CC_TEXEL1A : CC_TEXEL0A;
case G_CCMUX_TEXEL1_ALPHA: return cycle ? CC_TEXEL0A : CC_TEXEL1A;
case G_CCMUX_PRIMITIVE_ALPHA: return CC_PRIMA;

View file

@ -20,6 +20,7 @@ enum {
CC_PRIMA,
CC_SHADEA,
CC_ENVA,
CC_NOISE,
CC_ENUM_MAX,
};
@ -40,6 +41,7 @@ enum {
SHADER_1,
SHADER_COMBINED,
SHADER_COMBINEDA,
SHADER_NOISE,
};
#define SHADER_OPT_ALPHA (1 << 24)
@ -54,6 +56,7 @@ struct CCFeatures {
bool do_multiply[4];
bool do_mix[4];
bool color_alpha_same[2];
bool do_noise;
};
#pragma pack(1)
@ -72,7 +75,7 @@ struct CombineMode {
uint8_t use_alpha : 1;
uint8_t use_fog : 1;
uint8_t texture_edge : 1;
uint8_t use_noise : 1;
uint8_t use_dither : 1;
uint8_t use_2cycle : 1;
uint8_t light_map : 1;
};

View file

@ -56,6 +56,7 @@ struct ShaderProgramD3D12 {
bool used_textures[2];
uint8_t num_floats;
uint8_t num_attribs;
bool do_noise;
ComPtr<ID3DBlob> vertex_shader;
ComPtr<ID3DBlob> pixel_shader;
@ -260,6 +261,7 @@ static struct ShaderProgram *gfx_direct3d12_create_and_load_new_shader(struct Co
prg->used_textures[0] = cc_features.used_textures[0];
prg->used_textures[1] = cc_features.used_textures[1];
prg->num_floats = num_floats;
prg->do_noise = cc_features.do_noise;
d3d.must_reload_pipeline = true;
return (struct ShaderProgram *)(d3d.shader_program = prg);
@ -449,7 +451,6 @@ static void gfx_direct3d12_set_use_alpha(bool use_alpha) {
static void gfx_direct3d12_draw_triangles(float buf_vbo[], size_t buf_vbo_len, size_t buf_vbo_num_tris) {
struct ShaderProgramD3D12 *prg = d3d.shader_program;
if (d3d.must_reload_pipeline) {
ComPtr<ID3D12PipelineState>& pipeline_state = d3d.pipeline_states[PipelineDesc{
prg->hash,
@ -528,7 +529,7 @@ static void gfx_direct3d12_draw_triangles(float buf_vbo[], size_t buf_vbo_len, s
int root_param_index = 0;
if (prg->cc.cm.use_alpha && prg->cc.cm.use_noise) {
if ((prg->cc.cm.use_alpha && prg->cc.cm.use_dither) || prg->do_noise) {
d3d.command_list->SetGraphicsRootConstantBufferView(root_param_index++, d3d.noise_cb->GetGPUVirtualAddress());
}

View file

@ -51,6 +51,8 @@ static const char *shader_item_to_str(int32_t item, bool with_alpha, bool only_a
return with_alpha ? "texel" : "texel.rgb";
case SHADER_COMBINEDA:
return hint_single_element ? "texel.a" : (with_alpha ? "float4(texel.a, texel.a, texel.a, texel.a)" : "float3(texel.a, texel.a, texel.a)");
case SHADER_NOISE:
return with_alpha ? "float4(noise, noise, noise, noise)" : "float3(noise, noise, noise)";
}
} else {
switch (item) {
@ -87,6 +89,8 @@ static const char *shader_item_to_str(int32_t item, bool with_alpha, bool only_a
return "texel.a";
case SHADER_COMBINEDA:
return "texel.a";
case SHADER_NOISE:
return "noise";
}
}
}
@ -126,7 +130,7 @@ void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_f
if (include_root_signature) {
append_str(buf, &len, "#define RS \"RootFlags(ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT | DENY_VERTEX_SHADER_ROOT_ACCESS)");
if (cc.cm.use_alpha && cc.cm.use_noise) {
if ((cc.cm.use_alpha && cc.cm.use_dither) || ccf.do_noise) {
append_str(buf, &len, ",CBV(b0, visibility = SHADER_VISIBILITY_PIXEL)");
}
if (ccf.used_textures[0]) {
@ -146,7 +150,7 @@ void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_f
append_line(buf, &len, " float2 uv : TEXCOORD;");
num_floats += 2;
}
if (cc.cm.use_alpha && cc.cm.use_noise) {
if ((cc.cm.use_alpha && cc.cm.use_dither) || ccf.do_noise) {
append_line(buf, &len, " float4 screenPos : TEXCOORD1;");
}
if (cc.cm.use_fog) {
@ -176,7 +180,7 @@ void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_f
// Constant buffer and random function
if (cc.cm.use_alpha && cc.cm.use_noise) {
if ((cc.cm.use_alpha && cc.cm.use_dither) || ccf.do_noise) {
append_line(buf, &len, "cbuffer PerFrameCB : register(b0) {");
append_line(buf, &len, " uint noise_frame;");
append_line(buf, &len, " float2 noise_scale;");
@ -229,7 +233,7 @@ void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_f
append_line(buf, &len, ") {");
append_line(buf, &len, " PSInput result;");
append_line(buf, &len, " result.position = position;");
if (cc.cm.use_alpha && cc.cm.use_noise) {
if ((cc.cm.use_alpha && cc.cm.use_dither) || ccf.do_noise) {
append_line(buf, &len, " result.screenPos = position;");
}
if (ccf.used_textures[0] || ccf.used_textures[1]) {
@ -252,6 +256,12 @@ void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_f
append_line(buf, &len, "[RootSignature(RS)]");
}
append_line(buf, &len, "float4 PSMain(PSInput input) : SV_TARGET {");
if ((cc.cm.use_alpha && cc.cm.use_dither) || ccf.do_noise) {
append_line(buf, &len, " float2 coords = (input.screenPos.xy / input.screenPos.w) * noise_scale;");
append_line(buf, &len, " float noise = round(random(float3(floor(coords), noise_frame)));");
}
if (ccf.used_textures[0]) {
if (three_point_filtering) {
append_line(buf, &len, " float4 texVal0;");
@ -319,9 +329,8 @@ void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_f
}
}
if (cc.cm.use_alpha && cc.cm.use_noise) {
append_line(buf, &len, " float2 coords = (input.screenPos.xy / input.screenPos.w) * noise_scale;");
append_line(buf, &len, " texel.a *= round(random(float3(floor(coords), noise_frame)));");
if (cc.cm.use_alpha && cc.cm.use_dither) {
append_line(buf, &len, " texel.a *= noise;");
}
if (cc.cm.use_alpha) {

View file

@ -170,6 +170,8 @@ static const char *shader_item_to_str(uint32_t item, bool with_alpha, bool only_
case SHADER_COMBINEDA:
return hint_single_element ? "texel.a" :
(with_alpha ? "vec4(texel.a, texel.a, texel.a, texel.a)" : "vec3(texel.a, texel.a, texel.a)");
case SHADER_NOISE:
return with_alpha ? "vec4(noise)" : "vec3(noise)";
}
} else {
switch (item) {
@ -205,6 +207,8 @@ static const char *shader_item_to_str(uint32_t item, bool with_alpha, bool only_
return "texel.a";
case SHADER_COMBINEDA:
return "texel.a";
case SHADER_NOISE:
return "noise.a";
}
}
return "unknown";
@ -248,9 +252,9 @@ static struct ShaderProgram *gfx_opengl_create_and_load_new_shader(struct ColorC
bool opt_light_map = cc->cm.light_map;
#ifdef USE_GLES
bool opt_noise = false;
bool opt_dither = false;
#else
bool opt_noise = cc->cm.use_noise;
bool opt_dither = cc->cm.use_dither;
#endif
char vs_buf[1024];
@ -361,7 +365,7 @@ static struct ShaderProgram *gfx_opengl_create_and_load_new_shader(struct ColorC
}
}
if (opt_alpha && opt_noise) {
if ((opt_alpha && opt_dither) || ccf.do_noise) {
append_line(fs_buf, &fs_len, "uniform float frame_count;");
append_line(fs_buf, &fs_len, "float random(in vec3 value) {");
@ -372,6 +376,10 @@ static struct ShaderProgram *gfx_opengl_create_and_load_new_shader(struct ColorC
append_line(fs_buf, &fs_len, "void main() {");
if ((opt_alpha && opt_dither) || ccf.do_noise) {
append_line(fs_buf, &fs_len, "float noise = floor(random(floor(vec3(gl_FragCoord.xy, frame_count))) + 0.5);");
}
if (ccf.used_textures[0]) {
append_line(fs_buf, &fs_len, "vec4 texVal0 = sampleTex(uTex0, vTexCoord, uTex0Size, uTex0Filter);");
}
@ -417,8 +425,9 @@ static struct ShaderProgram *gfx_opengl_create_and_load_new_shader(struct ColorC
}
}
if (opt_alpha && opt_noise)
append_line(fs_buf, &fs_len, "texel.a *= floor(random(floor(vec3(gl_FragCoord.xy, frame_count))) + 0.5);");
if (opt_alpha && opt_dither) {
append_line(fs_buf, &fs_len, "texel.a *= noise;");
}
if (opt_alpha) {
append_line(fs_buf, &fs_len, "gl_FragColor = texel;");
@ -532,7 +541,7 @@ static struct ShaderProgram *gfx_opengl_create_and_load_new_shader(struct ColorC
glUniform1i(sampler_location, 1);
}
if (opt_alpha && opt_noise) {
if ((opt_alpha && opt_dither) || ccf.do_noise) {
prg->uniform_locations[4] = glGetUniformLocation(shader_program, "frame_count");
prg->used_noise = true;
} else {

View file

@ -304,6 +304,9 @@ static void gfx_generate_cc(struct ColorCombiner *cc) {
case CC_COMBINEDA:
shader_cmd = cc->cm.use_2cycle ? SHADER_COMBINEDA : SHADER_0;
break;
case CC_NOISE:
shader_cmd = SHADER_NOISE;
break;
case CC_PRIM:
case CC_PRIMA:
case CC_SHADE:
@ -1043,7 +1046,7 @@ static void OPTIMIZE_O3 gfx_sp_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t
cm->use_alpha = (rdp.other_mode_l & (G_BL_A_MEM << 18)) == 0;
cm->texture_edge = (rdp.other_mode_l & CVG_X_ALPHA) == CVG_X_ALPHA;
cm->use_noise = (rdp.other_mode_l & G_AC_DITHER) == G_AC_DITHER;
cm->use_dither = (rdp.other_mode_l & G_AC_DITHER) == G_AC_DITHER;
cm->use_2cycle = (rdp.other_mode_h & (3U << G_MDSFT_CYCLETYPE)) == G_CYC_2CYCLE;
cm->use_fog = (rdp.other_mode_l >> 30) == G_BL_CLR_FOG;
cm->light_map = (rsp.geometry_mode & G_LIGHT_MAP_EXT) == G_LIGHT_MAP_EXT;

View file

@ -100,7 +100,7 @@ void network_receive_chat(struct Packet* p) {
// add the message
djui_chat_message_create_from(globalIndex, remoteMessage);
if (gNetworkSystem && gNetworkSystem->get_id_str && np && np->name) {
if (gNetworkSystem && gNetworkSystem->get_id_str && np) {
LOG_CONSOLE("[%s] %s: %s", gNetworkSystem->get_id_str(np->localIndex), np->name, remoteMessage);
LOG_INFO("[%s] %s: %s", gNetworkSystem->get_id_str(np->localIndex), np->name, remoteMessage);
} else {