|
Packit |
5e46da |
/*
|
|
Packit |
5e46da |
* This file is part of libbluray
|
|
Packit |
5e46da |
* Copyright (C) 2010 hpi1
|
|
Packit |
5e46da |
*
|
|
Packit |
5e46da |
* This library is free software; you can redistribute it and/or
|
|
Packit |
5e46da |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit |
5e46da |
* License as published by the Free Software Foundation; either
|
|
Packit |
5e46da |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
5e46da |
*
|
|
Packit |
5e46da |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
5e46da |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
5e46da |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
5e46da |
* Lesser General Public License for more details.
|
|
Packit |
5e46da |
*
|
|
Packit |
5e46da |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit |
5e46da |
* License along with this library. If not, see
|
|
Packit |
5e46da |
* <http://www.gnu.org/licenses/>.
|
|
Packit |
5e46da |
*/
|
|
Packit |
5e46da |
|
|
Packit |
5e46da |
#include "bluray.h"
|
|
Packit |
5e46da |
|
|
Packit |
5e46da |
#include "hdmv/mobj_data.h"
|
|
Packit |
5e46da |
#include "hdmv/mobj_print.h"
|
|
Packit |
5e46da |
|
|
Packit |
5e46da |
#include <stdio.h>
|
|
Packit |
5e46da |
#include <string.h>
|
|
Packit |
5e46da |
|
|
Packit |
5e46da |
static void _mobj_print(MOBJ_OBJECTS *objects, int disasm)
|
|
Packit |
5e46da |
{
|
|
Packit |
5e46da |
int o, c;
|
|
Packit |
5e46da |
|
|
Packit |
5e46da |
printf("Number of objects: %d\n", objects->num_objects);
|
|
Packit |
5e46da |
|
|
Packit |
5e46da |
for (o = 0; o < objects->num_objects; o++) {
|
|
Packit |
5e46da |
|
|
Packit |
5e46da |
printf("Object %d:\n"
|
|
Packit |
5e46da |
" number of commands: %d\n"
|
|
Packit |
5e46da |
" resume intention flag: %d\n"
|
|
Packit |
5e46da |
" menu call mask: %d\n"
|
|
Packit |
5e46da |
" title search mask: %d\n",
|
|
Packit |
5e46da |
o, objects->objects[o].num_cmds,
|
|
Packit |
5e46da |
objects->objects[o].resume_intention_flag,
|
|
Packit |
5e46da |
objects->objects[o].menu_call_mask,
|
|
Packit |
5e46da |
objects->objects[o].title_search_mask);
|
|
Packit |
5e46da |
|
|
Packit |
5e46da |
if (disasm) {
|
|
Packit |
5e46da |
printf(" program:\n");
|
|
Packit |
5e46da |
for (c = 0; c < objects->objects[o].num_cmds; c++) {
|
|
Packit |
5e46da |
char buf[256];
|
|
Packit |
5e46da |
mobj_sprint_cmd(buf, &objects->objects[o].cmds[c]);
|
|
Packit |
5e46da |
printf(" %04d: %s\n", c, buf);
|
|
Packit |
5e46da |
}
|
|
Packit |
5e46da |
}
|
|
Packit |
5e46da |
}
|
|
Packit |
5e46da |
}
|
|
Packit |
5e46da |
|
|
Packit |
5e46da |
int main(int argc, const char *argv[])
|
|
Packit |
5e46da |
{
|
|
Packit |
5e46da |
int disasm = 0;
|
|
Packit |
5e46da |
MOBJ_OBJECTS *mobj = NULL;
|
|
Packit |
5e46da |
|
|
Packit |
5e46da |
if (argc < 2) {
|
|
Packit |
5e46da |
fprintf(stderr,
|
|
Packit |
5e46da |
"usage: %s [-d] <file>\n"
|
|
Packit |
5e46da |
"Options:\n"
|
|
Packit |
5e46da |
" d disassemble object code\n",
|
|
Packit |
5e46da |
argv[0]);
|
|
Packit |
5e46da |
return 1;
|
|
Packit |
5e46da |
}
|
|
Packit |
5e46da |
if (argc > 2) {
|
|
Packit |
5e46da |
disasm = !strcmp(argv[1], "-d");
|
|
Packit |
5e46da |
}
|
|
Packit |
5e46da |
|
|
Packit |
5e46da |
mobj = bd_read_mobj(argv[argc-1]);
|
|
Packit |
5e46da |
|
|
Packit |
5e46da |
if (!mobj) {
|
|
Packit |
5e46da |
fprintf(stderr, "Error loading %s\n", argv[argc-1]);
|
|
Packit |
5e46da |
return 1;
|
|
Packit |
5e46da |
}
|
|
Packit |
5e46da |
|
|
Packit |
5e46da |
_mobj_print(mobj, disasm);
|
|
Packit |
5e46da |
|
|
Packit |
5e46da |
bd_free_mobj(mobj);
|
|
Packit |
5e46da |
|
|
Packit |
5e46da |
return 0;
|
|
Packit |
5e46da |
}
|