Skip to content

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

Open
@Sypwn

Description

@Sypwn

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;
				}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions