mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 21:59:17 +00:00
Changed the list sanity checks to return warnings instead of errors in case of failure - apparently, this can occur in some games, e.g. Longbow and QFG1
svn-id: r44503
This commit is contained in:
parent
bbb2274a7d
commit
86016e4dc5
@ -44,7 +44,7 @@ Node *lookup_node(EngineState *s, reg_t addr) {
|
||||
NodeTable *nt = (NodeTable *)mobj;
|
||||
|
||||
if (!nt->isValidEntry(addr.offset)) {
|
||||
error("Attempt to use non-node %04x:%04x as list node", PRINT_REG(addr));
|
||||
warning("Attempt to use non-node %04x:%04x as list node", PRINT_REG(addr));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -55,14 +55,14 @@ List *lookup_list(EngineState *s, reg_t addr) {
|
||||
SegmentObj *mobj = GET_SEGMENT(*s->segMan, addr.segment, SEG_TYPE_LISTS);
|
||||
|
||||
if (!mobj) {
|
||||
error("Attempt to use non-list %04x:%04x as list", PRINT_REG(addr));
|
||||
warning("Attempt to use non-list %04x:%04x as list", PRINT_REG(addr));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ListTable *lt = (ListTable *)mobj;
|
||||
|
||||
if (!lt->isValidEntry(addr.offset)) {
|
||||
error("Attempt to use non-list %04x:%04x as list", PRINT_REG(addr));
|
||||
warning("Attempt to use non-list %04x:%04x as list", PRINT_REG(addr));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -152,7 +152,7 @@ reg_t kDisposeList(EngineState *s, int argc, reg_t *argv) {
|
||||
}
|
||||
|
||||
if (!sane_listp(s, argv[0]))
|
||||
error("List at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
|
||||
warning("List at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
|
||||
|
||||
/* if (!l->first.isNull()) {
|
||||
reg_t n_addr = l->first;
|
||||
@ -199,7 +199,7 @@ reg_t kFirstNode(EngineState *s, int argc, reg_t *argv) {
|
||||
List *l = lookup_list(s, argv[0]);
|
||||
|
||||
if (l && !sane_listp(s, argv[0]))
|
||||
error("List at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
|
||||
warning("List at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
|
||||
|
||||
if (l)
|
||||
return l->first;
|
||||
@ -211,7 +211,7 @@ reg_t kLastNode(EngineState *s, int argc, reg_t *argv) {
|
||||
List *l = lookup_list(s, argv[0]);
|
||||
|
||||
if (l && !sane_listp(s, argv[0]))
|
||||
error("List at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
|
||||
warning("List at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
|
||||
|
||||
if (l)
|
||||
return l->last;
|
||||
@ -223,7 +223,7 @@ reg_t kEmptyList(EngineState *s, int argc, reg_t *argv) {
|
||||
List *l = lookup_list(s, argv[0]);
|
||||
|
||||
if (!l || !sane_listp(s, argv[0]))
|
||||
error("List at %04x:%04x is invalid or not sane anymore", PRINT_REG(argv[0]));
|
||||
warning("List at %04x:%04x is invalid or not sane anymore", PRINT_REG(argv[0]));
|
||||
|
||||
return make_reg(0, ((l) ? l->first.isNull() : 0));
|
||||
}
|
||||
@ -238,7 +238,7 @@ void _k_add_to_front(EngineState *s, reg_t listbase, reg_t nodebase) {
|
||||
if (!new_n)
|
||||
warning("Attempt to add non-node (%04x:%04x) to list at %04x:%04x", PRINT_REG(nodebase), PRINT_REG(listbase));
|
||||
if (!l || !sane_listp(s, listbase))
|
||||
error("List at %04x:%04x is not sane anymore", PRINT_REG(listbase));
|
||||
warning("List at %04x:%04x is not sane anymore", PRINT_REG(listbase));
|
||||
|
||||
new_n->succ = l->first;
|
||||
new_n->pred = NULL_REG;
|
||||
@ -262,7 +262,7 @@ void _k_add_to_end(EngineState *s, reg_t listbase, reg_t nodebase) {
|
||||
if (!new_n)
|
||||
warning("Attempt to add non-node (%04x:%04x) to list at %04x:%04x", PRINT_REG(nodebase), PRINT_REG(listbase));
|
||||
if (!l || !sane_listp(s, listbase))
|
||||
error("List at %04x:%04x is not sane anymore", PRINT_REG(listbase));
|
||||
warning("List at %04x:%04x is not sane anymore", PRINT_REG(listbase));
|
||||
|
||||
new_n->succ = NULL_REG;
|
||||
new_n->pred = l->last;
|
||||
@ -279,7 +279,7 @@ void _k_add_to_end(EngineState *s, reg_t listbase, reg_t nodebase) {
|
||||
reg_t kNextNode(EngineState *s, int argc, reg_t *argv) {
|
||||
Node *n = lookup_node(s, argv[0]);
|
||||
if (!sane_nodep(s, argv[0])) {
|
||||
error("List node at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
|
||||
warning("List node at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
|
||||
return NULL_REG;
|
||||
}
|
||||
|
||||
@ -289,7 +289,7 @@ reg_t kNextNode(EngineState *s, int argc, reg_t *argv) {
|
||||
reg_t kPrevNode(EngineState *s, int argc, reg_t *argv) {
|
||||
Node *n = lookup_node(s, argv[0]);
|
||||
if (!sane_nodep(s, argv[0]))
|
||||
error("List node at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
|
||||
warning("List node at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
|
||||
|
||||
return n->pred;
|
||||
}
|
||||
@ -297,7 +297,7 @@ reg_t kPrevNode(EngineState *s, int argc, reg_t *argv) {
|
||||
reg_t kNodeValue(EngineState *s, int argc, reg_t *argv) {
|
||||
Node *n = lookup_node(s, argv[0]);
|
||||
if (!sane_nodep(s, argv[0])) {
|
||||
error("List node at %04x:%04x is not sane", PRINT_REG(argv[0]));
|
||||
warning("List node at %04x:%04x is not sane", PRINT_REG(argv[0]));
|
||||
return NULL_REG;
|
||||
}
|
||||
|
||||
@ -315,7 +315,7 @@ reg_t kAddAfter(EngineState *s, int argc, reg_t *argv) {
|
||||
Node *newnode = lookup_node(s, argv[2]);
|
||||
|
||||
if (!l || !sane_listp(s, argv[0]))
|
||||
error("List at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
|
||||
warning("List at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
|
||||
|
||||
// FIXME: This should be an error, but it's turned to a warning for now
|
||||
if (!newnode) {
|
||||
@ -361,7 +361,7 @@ reg_t kFindKey(EngineState *s, int argc, reg_t *argv) {
|
||||
debugC(2, kDebugLevelNodes, "Looking for key %04x:%04x in list %04x:%04x\n", PRINT_REG(key), PRINT_REG(list_pos));
|
||||
|
||||
if (!sane_listp(s, list_pos))
|
||||
error("List at %04x:%04x is not sane anymore", PRINT_REG(list_pos));
|
||||
warning("List at %04x:%04x is not sane anymore", PRINT_REG(list_pos));
|
||||
|
||||
node_pos = lookup_list(s, list_pos)->first;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user