Skip to content

Black screen after repacking Marvel vs Capcom 2; empty directories are incorrectly rewritten as files. #92

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
Sypwn opened this issue Sep 13, 2024 · 1 comment

Comments

@Sypwn
Copy link

Sypwn commented Sep 13, 2024

The Marvel vs Capcom 2 ISO contains an empty directory located at \media\sounds. If this directory is not present, the game will hang at a black screen during startup. When rewriting the Marvel vs Capcom 2 ISO using extract-xiso -r, the sounds folder is rewritten with attribute 0x20 (archive) instead of attribute 0x10 (directory), thus preventing the rewritten ISO from starting.

  • if ( ! err && dir->file_size > 0 ) err = traverse_xiso( in_xiso, &subdir, (xoff_t) dir->start_sector * XISO_SECTOR_SIZE + s_xbox_disc_lseek, path, in_mode, in_mode == k_generate_avl ? &dir->avl_node->subdirectory : nil, in_ll_compat );
    This only assigns a subdirectory to directories with a positive file_size. The sounds directory has a size of zero so its subdirectory field remains null.

  • char length = (char) strlen( in_avl->filename ), attributes = in_avl->subdirectory ? XISO_ATTRIBUTE_DIR : XISO_ATTRIBUTE_ARC, sector[ XISO_SECTOR_SIZE ];
    This looks at the subdirectory field and assigns XISO_ATTRIBUTE_ARC when it is null, otherwise it assigns XISO_ATTRIBUTE_DIR. Thus, the sounds directory is tagged as an archive.

The EMPTY_SUBDIRECTORY value seems to be the intended solution here, but it never gets assigned in this situation. Expanding line 1324 to assign subdirectory = EMPTY_SUBDIRECTORY to zero-size directories appears to resolve the issue:

				if (!err)
				{
					if (dir->file_size > 0)
						err = traverse_xiso(in_xiso, &subdir, (xoff_t)dir->start_sector * XISO_SECTOR_SIZE + s_xbox_disc_lseek, path, in_mode, in_mode == k_generate_avl ? &dir->avl_node->subdirectory : nil, in_ll_compat);
					else
						dir->avl_node->subdirectory = EMPTY_SUBDIRECTORY;
				}
@rapperskull
Copy link
Contributor

The issue is not present in my branch (see #80).

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

No branches or pull requests

2 participants