Skip to content

Port Display List Viewer#1310

Merged
Eblo merged 6 commits intoHarbourMasters:developfrom
mckinlee:port-dl-viewer
Nov 30, 2025
Merged

Port Display List Viewer#1310
Eblo merged 6 commits intoHarbourMasters:developfrom
mckinlee:port-dl-viewer

Conversation

@mckinlee
Copy link
Contributor

@mckinlee mckinlee commented Oct 26, 2025

As the title says. The tool supports viewing various graphics commands (textures, vertices, colors, etc.) and allows live editing of color-related commands.

Build Artifacts

@Eblo Eblo mentioned this pull request Nov 11, 2025
45 tasks
Copy link
Contributor

@Eblo Eblo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing that would be nice is the ability to limit the DL list to those active in the current scene. However, DLs remain persistent in memory once loaded, and I don't think there is currently tracking for what is in active use, so I would say that's out of scope for this PR.

#include <string>
#include <cstdint>
#include <algorithm>
#include <libultraship/libultraship.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably don't need this entire import.

PerformDisplayListSearch();
}

searchDebounceFrames--;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is a "frame" in this context? Is it based on refresh rate? For higher refresh rates, 30 frames may not be meaningfully long enough to debounce.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a remnant from SoH. Gonna move to a time-based debounce instead. Similar to BenInputEditorWindow.

if (ImGui::Selectable("gsDPSetGrayscaleColor")) {
*gfx = gsDPSetGrayscaleColor(0, 0, 0, 255);
}
ImGui::EndCombo();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we throw in gsSPNoOp? I think effectively canceling out a command in place will be useful, going by previous experiences in patching graphical commands.

ImGui::SameLine();
UIWidgets::PushStyleCheckbox(THEME_COLOR);
if (ImGui::Checkbox(("state" + id).c_str(), state)) {
//
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove it. You're guess is as good as mine.. this was directly copy and pasted from SoH lol


void PerformDisplayListSearch() {
auto result = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(
"*" + std::string(searchString) + "*DL*");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This search is case sensitive. Is that intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another copy/paste from SoH. It looks like they may have intended it to not be. Glob_match appears to be case sensitive though, so what I'll do is convert everything to lowercase before comparing.

UIWidgets::PushStyleCombobox(THEME_COLOR);
if (ImGui::BeginCombo(("CMD" + id).c_str(), cmdLabel.c_str())) {
if (ImGui::Selectable("gsDPSetPrimColor") && cmd != G_SETPRIMCOLOR) {
*gfx = gsDPSetPrimColor(0, 0, 0, 0, 0, 255);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm following this right, you're actually irreversibly modifying the DL commands in place, meaning they will remain modified for the remainder of runtime. I think a better approach would be to call something like this, where the last argument is what you normally do to gfx now:

ResourceMgr_PatchGfxByName(activeDisplayList.c_str(), ("CMD" + id + "Debug").c_str(), id, gsDPSetPrimColor(0, 0, 0, 0, 0, 255));

One benefit to doing this is that you could add a revert button that calls this and restores the default DL command:

ResourceMgr_UnpatchGfxByName("scenes/nonmq/Z2_00KEIKOKU/Z2_00KEIKOKU_room_00DL_00D490", ("CMD + id + "Debug").c_str());

std::string GetCommandMetadata(Gfx* gfx, int cmd, size_t currentIndex, size_t totalInstructions) {
std::string metadata;

if (cmd == G_SETTILE) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be a switch block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. I went ahead and refactored it. That change is now in.

@Eblo Eblo merged commit 5d162e3 into HarbourMasters:develop Nov 30, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants