Exemple #1
0
void Console::cmdDumpRes(const CommandLine &cl) {
	if (cl.args.empty()) {
		printCommandHelp(cl.cmd);
		return;
	}

	if (dumpResource(cl.args))
		printf("Dumped resource \"%s\"", cl.args.c_str());
	else
		printf("Failed dumping resource \"%s\"", cl.args.c_str());
}
Exemple #2
0
static void decodeResourceTable(FILE *fp) {
	const int align = 1 << freadUint16LE(fp);
	int type = freadUint16LE(fp);
	while (type != 0) {
		assert((type & 0x8000) != 0);

		// DW Number of resources for this type
		int count = freadUint16LE(fp);
		fprintf(stdout, "Resource type 0x%x '%s' count %d\n", type, resourceTypeName(type), count);

		// DD Reserved.
		fseek(fp, 4, SEEK_CUR);

		for (int i = 0; i < count; ++i) {
			ResourceEntry re;

			// DW File offset to the contents of the resource data
			re.offset = freadUint16LE(fp) * align;

			// DW Length of resource in the file
			re.size = freadUint16LE(fp) * align;

			// DW Flag word.
			re.flags = freadUint16LE(fp);

			// DW Resource ID
			re.id = freadUint16LE(fp);

			// DD Reserved.
			fseek(fp, 4, SEEK_CUR);

			dumpResource(fp, type, i, &re);
		}

		type = freadUint16LE(fp);
	}
}
Exemple #3
0
bool dumpResource(const Common::UString &name, const Common::UString &file) {
	Aurora::FileType type = TypeMan.getFileType(name);

	return dumpResource(TypeMan.setFileType(name, Aurora::kFileTypeNone), type, file);
}
Exemple #4
0
void fsDebugMgr::checkSpecialCommand()
{
    u8 cmd_no = 0;

    if (fsInputMgr::isOn(fsInputMgr::KEY_D))
    {
        if (fsInputMgr::isPressed(fsInputMgr::KEY_1))
        {
            cmd_no = 1;
        }
        else if (fsInputMgr::isPressed(fsInputMgr::KEY_2))
        {
            cmd_no = 2;
        }
        else if (fsInputMgr::isPressed(fsInputMgr::KEY_3))
        {
            cmd_no = 3;
        }
        else if (fsInputMgr::isPressed(fsInputMgr::KEY_4))
        {
            cmd_no = 4;
        }
        else if (fsInputMgr::isPressed(fsInputMgr::KEY_5))
        {
            cmd_no = 5;
        }
        else if (fsInputMgr::isPressed(fsInputMgr::KEY_6))
        {
            cmd_no = 6;
        }
        else if (fsInputMgr::isPressed(fsInputMgr::KEY_7))
        {
            cmd_no = 7;
        }
        else if (fsInputMgr::isPressed(fsInputMgr::KEY_8))
        {
            cmd_no = 8;
        }
        else if (fsInputMgr::isPressed(fsInputMgr::KEY_PAGEUP))
        {
            cmd_no = 100;
        }
        else if (fsInputMgr::isPressed(fsInputMgr::KEY_PAGEDOWN))
        {
            cmd_no = 101;
        }
    }

    if (fsInputMgr::isPressed(fsInputMgr::KEY_LBUTTON))
    {
        r32 mouse_x = m_dbg_mode_scr->framebufferXToScreenX(fsInputMgr::getMouseX());
        r32 mouse_y = m_dbg_mode_scr->framebufferYToScreenY(fsInputMgr::getMouseY());

        if (mouse_x > 0.0f && mouse_y > 0.0f)
        {
            if (m_dbg_mode_tap_cntr < 2)
            {
                m_dbg_mode_tap_cntr++;
            }
            else if (m_dbg_mode_tap_cntr > 2)
            {
                m_dbg_mode_tap_cntr = 1;
            }
        }
        else if ((m_dbg_mode_tap_cntr >= 2 && m_dbg_mode_tap_cntr <= 3 && mouse_x < 0.0f && mouse_y > 0.0f) || //
            (m_dbg_mode_tap_cntr >= 4 && m_dbg_mode_tap_cntr <= 5 && mouse_x < 0.0f && mouse_y < 0.0f) || //
            (m_dbg_mode_tap_cntr >= 6 && m_dbg_mode_tap_cntr <= 7 && mouse_x > 0.0f && mouse_y < 0.0f))
        {
            m_dbg_mode_tap_cntr++;
        }
        else
        {
            m_dbg_mode_tap_cntr = 0;
        }

        if (m_dbg_mode_tap_cntr == 8)
        {
            cmd_no = 1;

            m_dbg_mode_tap_cntr = 0;
            m_dbg_dump_tap_cntr = 0;
            m_scroll_hold_cntr = 0;
        }

        if (m_dbg_mode.getType() == MODE_CONSOLE)
        {
            if (mouse_x > 0.0f && mouse_y > 0.0f)
            {
                if (m_dbg_dump_tap_cntr >= 3 && m_dbg_dump_tap_cntr < 100)
                {
                    cmd_no = m_dbg_dump_tap_cntr - 1;

                    m_dbg_mode_tap_cntr = 0;
                    m_scroll_hold_cntr = 0;
                }

                m_dbg_dump_tap_cntr = 1;
            }
            else if (mouse_x < 0.0f && mouse_y < 0.0f)
            {
                m_dbg_dump_tap_cntr++;
            }
            else
            {
                m_dbg_dump_tap_cntr = 0;
            }
        }
    }

    if (m_dbg_mode.getType() == MODE_CONSOLE)
    {
        r32 mouse_y = m_dbg_mode_scr->framebufferYToScreenY(fsInputMgr::getMouseY());

        if (fsInputMgr::isOn(fsInputMgr::KEY_LBUTTON))
        {
            if (mouse_y > 0.0f)
            {
                m_scroll_hold_cntr++;
            }
            else
            {
                m_scroll_hold_cntr--;
            }

            if (fsMath::abs(m_scroll_hold_cntr) >= fsTaskMgr::getAimFPS())
            {
                cmd_no = (m_scroll_hold_cntr > 0) ? 100 : 101;

                m_dbg_mode_tap_cntr = 0;
                m_dbg_dump_tap_cntr = 0;
                m_scroll_hold_cntr = 0;
            }
        }
        else
        {
            m_scroll_hold_cntr = 0;
        }
    }

    switch (cmd_no)
    {
    case 1:
        if (m_dbg_mode.getType() == MODE_OFF)
        {
            setDebugMode(MODE_MONITOR);
        }
        else if (m_dbg_mode.getType() == MODE_MONITOR)
        {
            setDebugMode(MODE_CONSOLE);
        }
        else
        {
            setDebugMode(MODE_OFF);
        }

        break;

    case 2:
        dumpMemory();
        break;

    case 3:
        dumpTask();
        break;

    case 4:
        dumpResource();
        break;

    case 5:
        dumpConfig();
        break;

    case 6:
        dumpScreen();
        break;

    case 7:
        dumpTexture();
        break;

    case 8:
        dumpShader();
        break;

    case 100:
        pageUpConsole();
        break;

    case 101:
        pageDownConsole();
        break;

    default:
        break;
    }
}