mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 05:25:14 +00:00
Add hack to disable 2cycle if using a texture that doesn't exist
This commit is contained in:
parent
352f72a1ac
commit
f06a422ff9
3 changed files with 21 additions and 3 deletions
|
@ -5,6 +5,18 @@
|
|||
|
||||
static u8 sAllowCCPrint = 1;
|
||||
|
||||
bool gfx_cm_uses_second_texture(struct CombineMode* cm) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
u8 v = cm->all_values[i];
|
||||
switch (v) {
|
||||
case CC_TEXEL1:
|
||||
case CC_TEXEL1A:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void gfx_cc_get_features(struct ColorCombiner* cc, struct CCFeatures* ccf) {
|
||||
// reset ccf
|
||||
memset(ccf, 0, sizeof(struct CCFeatures));
|
||||
|
|
|
@ -103,6 +103,7 @@ struct ColorCombiner {
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool gfx_cm_uses_second_texture(struct CombineMode* cm);
|
||||
void gfx_cc_get_features(struct ColorCombiner* cc, struct CCFeatures *cc_features);
|
||||
void gfx_cc_print(struct ColorCombiner *cc);
|
||||
void gfx_cc_precomp(void);
|
||||
|
|
|
@ -1040,6 +1040,13 @@ static void OPTIMIZE_O3 gfx_sp_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t
|
|||
cm->use_alpha = true;
|
||||
}
|
||||
|
||||
// hack: disable 2cycle if it uses a second texture that doesn't exist
|
||||
// this is because old rom hacks were ported assuming that 2cycle didn't exist
|
||||
// and were ported incorrectly
|
||||
if (!rdp.loaded_texture[1].addr && cm->use_2cycle && gfx_cm_uses_second_texture(cm)) {
|
||||
cm->use_2cycle = false;
|
||||
}
|
||||
|
||||
struct ColorCombiner *comb = gfx_lookup_or_create_color_combiner(cm);
|
||||
cm = &comb->cm;
|
||||
|
||||
|
@ -1324,9 +1331,7 @@ static void gfx_dp_set_tile(uint8_t fmt, uint32_t siz, uint32_t line, uint32_t t
|
|||
rdp.textures_changed[0] = true;
|
||||
rdp.textures_changed[1] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (tile == G_TX_LOADTILE) {
|
||||
} else if (tile == G_TX_LOADTILE) {
|
||||
rdp.texture_to_load.tile_number = tmem / 256;
|
||||
} else if (tile == G_TX_LOADTILE_6_UNKNOWN) {
|
||||
// this is a hack, because it seems like we can only load two tiles at once currently
|
||||
|
|
Loading…
Reference in a new issue