mirror of
https://github.com/open-goal/jak-project
synced 2026-06-23 09:29:56 -04:00
[jak 2] ETIE (#2326)
Definitely needs a clean up pass, but I think the functionality is very close. There's a few "hacks" still: - I am using the emerc logic for environment mapping, which doesn't care about the length of the normals. I can't figure out how the normal scaling worked in etie. I want to do a little bit more experimentation with this before merging. - There is some part about adgifs for TIE and ETIE that I don't understand. The clearly correct behavior of TIE/ETIE is that the alpha settings from the adgif shader are overwritten by the settings from the renderer. But I can't figure out how this happens in all cases. - Fade out is completely disabled. I think this is fine because the performance difference isn't bad. But if you are comparing screenshots with PCSX2, it will make things look a tiny bit different.
This commit is contained in:
@@ -445,6 +445,15 @@ std::string TFragment::print(const PrintSettings& settings, int indent) const {
|
||||
return result;
|
||||
}
|
||||
|
||||
void memcpy_plain_data(u8* dst, const Ref& ref, size_t size_bytes) {
|
||||
const auto& words = ref.data->words_by_seg.at(ref.seg);
|
||||
for (size_t i = 0; i < size_bytes; i++) {
|
||||
size_t byte_offset = ref.byte_offset + i;
|
||||
u8 byte = words.at(byte_offset / 4).get_byte(byte_offset % 4);
|
||||
memcpy(dst + i, &byte, sizeof(u8));
|
||||
}
|
||||
}
|
||||
|
||||
void TieFragment::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
DrawStats* stats,
|
||||
@@ -492,6 +501,15 @@ void TieFragment::read_from_file(TypedRef ref,
|
||||
}
|
||||
|
||||
stats->total_tie_prototype_tris += num_tris;
|
||||
|
||||
if (version > GameVersion::Jak1) {
|
||||
u16 normals_qwc = read_plain_data_field<u16>(ref, "normal-count", dts);
|
||||
if (normals_qwc) {
|
||||
normals.resize(16 * normals_qwc);
|
||||
auto normals_data_ref = deref_label(get_field_ref(ref, "normal-ref", dts));
|
||||
memcpy_plain_data((u8*)normals.data(), normals_data_ref, normals_qwc * 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string TieFragment::print(const PrintSettings& /*settings*/, int indent) const {
|
||||
@@ -1037,6 +1055,24 @@ void PrototypeBucketTie::read_from_file(TypedRef ref,
|
||||
for (int i = 0; i < int(8 * time_of_day.height); i++) {
|
||||
time_of_day.colors.push_back(deref_u32(palette, 3 + i));
|
||||
}
|
||||
|
||||
if (version > GameVersion::Jak1) {
|
||||
auto fr = get_field_ref(ref, "envmap-shader", dts);
|
||||
const auto& word = fr.data->words_by_seg.at(fr.seg).at(fr.byte_offset / 4);
|
||||
if (word.kind() == decompiler::LinkedWord::PTR) {
|
||||
has_envmap_shader = true;
|
||||
Ref envmap_shader_ref(deref_label(fr));
|
||||
for (int i = 0; i < 5 * 16; i++) {
|
||||
int byte = envmap_shader_ref.byte_offset + i;
|
||||
u8 val =
|
||||
ref.ref.data->words_by_seg.at(envmap_shader_ref.seg).at(byte / 4).get_byte(byte % 4);
|
||||
envmap_shader[i] = val;
|
||||
}
|
||||
}
|
||||
|
||||
u32 tint = read_plain_data_field<u32>(ref, "tint-color", dts);
|
||||
memcpy(tint_color.data(), &tint, 4);
|
||||
}
|
||||
}
|
||||
|
||||
std::string PrototypeBucketTie::print(const PrintSettings& settings, int indent) const {
|
||||
|
||||
Reference in New Issue
Block a user