mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-21 01:05:59 +00:00
SCI: Converted several fprintf(stderr) calls to warning/error (the remaining fprintf calls should probably be replaced by suitable debug/debugC/debugN invocations)
svn-id: r40993
This commit is contained in:
parent
b72c2a29fb
commit
813853ccc2
@ -489,7 +489,7 @@ static const char *sci1_default_knames[SCI1_KNAMES_DEFAULT_ENTRIES_NR] = {
|
||||
|
||||
int kernel_oops(EngineState *s, const char *file, int line, const char *reason) {
|
||||
sciprintf("Kernel Oops in file %s, line %d: %s\n", file, line, reason);
|
||||
fprintf(stderr, "Kernel Oops in file %s, line %d: %s\n", file, line, reason);
|
||||
warning("Kernel Oops in file %s, line %d: %s", file, line, reason);
|
||||
script_debug_flag = script_error_flag = 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1087,7 +1087,7 @@ void Script::listAllOutgoingReferences(EngineState *s, reg_t addr, void *param,
|
||||
warning("Request for outgoing script-object reference at %04x:%04x yielded invalid index %d", PRINT_REG(addr), idx);
|
||||
}
|
||||
} else {
|
||||
/* fprintf(stderr, "Unexpected request for outgoing script-object references at %04x:%04x\n", PRINT_REG(addr));*/
|
||||
/* warning("Unexpected request for outgoing script-object references at %04x:%04x", PRINT_REG(addr));*/
|
||||
/* Happens e.g. when we're looking into strings */
|
||||
}
|
||||
}
|
||||
@ -1109,7 +1109,7 @@ void CloneTable::listAllOutgoingReferences(EngineState *s, reg_t addr, void *par
|
||||
// assert(addr.segment == _segId);
|
||||
|
||||
if (!clone_table->isValidEntry(addr.offset)) {
|
||||
fprintf(stderr, "Unexpected request for outgoing references from clone at %04x:%04x\n", PRINT_REG(addr));
|
||||
warning("Unexpected request for outgoing references from clone at %04x:%04x", PRINT_REG(addr));
|
||||
// BREAKPOINT();
|
||||
return;
|
||||
}
|
||||
|
@ -514,8 +514,7 @@ ExecStack *add_exec_stack_entry(EngineState *s, reg_t pc, StackPtr sp, reg_t obj
|
||||
#endif
|
||||
|
||||
void vm_handle_fatal_error(EngineState *s, int line, const char *file) {
|
||||
fprintf(stderr, "Fatal VM error in %s, L%d; aborting...\n", file, line);
|
||||
error("Could not recover, exitting...\n");
|
||||
error("Fatal VM error in %s, L%d; aborting...", file, line);
|
||||
}
|
||||
|
||||
static Script *script_locate_by_segment(EngineState *s, SegmentId seg) {
|
||||
|
@ -297,7 +297,7 @@ int gfxr_interpreter_calculate_pic(gfx_resstate_t *state, gfxr_pic_t *scaled_pic
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "Attempt to reference invalid pic #%d\n", nr);
|
||||
warning("Attempt to reference invalid pic #%d", nr);
|
||||
}
|
||||
|
||||
printf(">> resource manager retrieved pic #%d\n", nr);
|
||||
@ -481,7 +481,7 @@ gfx_pixmap_t *gfxr_interpreter_get_cursor(gfx_resstate_t *state, int nr, void *i
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "Attempt to load invalid pointer %d\n", nr);
|
||||
warning("Attempt to load invalid pointer %d", nr);
|
||||
gfx_free_pixmap(state->driver, cursor);
|
||||
return NULL;
|
||||
}
|
||||
@ -1081,7 +1081,7 @@ int main(int argc, char **argv) {
|
||||
case 'x':
|
||||
set_mode = xres = atoi(optarg);
|
||||
if (xres < 1) {
|
||||
fprintf(stderr, "Invalid x scale factor!\n");
|
||||
warning("Invalid x scale factor!");
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
@ -1089,7 +1089,7 @@ int main(int argc, char **argv) {
|
||||
case 'y':
|
||||
set_mode = yres = atoi(optarg);
|
||||
if (yres < 1) {
|
||||
fprintf(stderr, "Invalid y scale factor!\n");
|
||||
warning("Invalid y scale factor!");
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
@ -1097,13 +1097,13 @@ int main(int argc, char **argv) {
|
||||
case 'c':
|
||||
set_mode = color_mode = atoi(optarg);
|
||||
if (color_mode < 1 || color_mode > 4) {
|
||||
fprintf(stderr, "Invalid number of bytes per pixel!\n");
|
||||
warning("Invalid number of bytes per pixel!");
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "Run 'gfx_test -h' for help\n");
|
||||
warning("Run 'gfx_test -h' for help");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1128,17 +1128,17 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
if (init_driver(drv)) {
|
||||
fprintf(stderr, "Initialization failed!\n");
|
||||
warning("Initialization failed!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
do_tests(tests);
|
||||
|
||||
if (gfxop_exit(state)) {
|
||||
fprintf(stderr, "Something weird happened while exitting...\n");
|
||||
warning("Something weird happened while exitting...");
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "No graphics driver found!\n");
|
||||
warning("No graphics driver found!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1085,7 +1085,7 @@ int gfxop_set_visible_map(GfxState *state, gfx_map_mask_t visible_map) {
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "Invalid display map %d selected!\n", visible_map);
|
||||
warning("Invalid display map %d selected!", visible_map);
|
||||
return GFX_ERROR;
|
||||
}
|
||||
|
||||
|
@ -74,10 +74,7 @@ static void AUXBUF_FILL_HELPER(gfxr_pic_t *pic, int old_xl, int old_xr, int y, i
|
||||
if (xl > old_xr) // No fillable strip above the last one
|
||||
return;
|
||||
|
||||
if ((ytotal + xl) < 0) {
|
||||
fprintf(stderr, "AARGH-%d\n", __LINE__);
|
||||
BREAKPOINT();
|
||||
}
|
||||
assert((ytotal + xl) >= 0);
|
||||
|
||||
xr = xl;
|
||||
while (xr < 320 && !(pic->aux_map[ytotal + xr] & clipmask)) {
|
||||
@ -85,10 +82,7 @@ static void AUXBUF_FILL_HELPER(gfxr_pic_t *pic, int old_xl, int old_xr, int y, i
|
||||
++xr;
|
||||
}
|
||||
|
||||
if ((ytotal + xr) > 64000) {
|
||||
fprintf(stderr, "AARGH-%d\n", __LINE__);
|
||||
BREAKPOINT();
|
||||
}
|
||||
assert((ytotal + xr) <= 64000);
|
||||
|
||||
--xr;
|
||||
|
||||
@ -137,14 +131,8 @@ static void AUXBUF_FILL_HELPER(gfxr_pic_t *pic, int old_xl, int old_xr, int y, i
|
||||
}
|
||||
}
|
||||
|
||||
if ((ytotal + xl) < 0) {
|
||||
fprintf(stderr, "AARGH-%d\n", __LINE__);
|
||||
BREAKPOINT();
|
||||
}
|
||||
if ((ytotal + xr + 1) > 64000) {
|
||||
fprintf(stderr, "AARGH-%d\n", __LINE__);
|
||||
BREAKPOINT();
|
||||
}
|
||||
assert((ytotal + xl) >= 0);
|
||||
assert((ytotal + xr + 1) <= 64000);
|
||||
|
||||
if (control)
|
||||
memset(pic->control_map->index_data + ytotal + xl, control, xr - xl + 1);
|
||||
|
@ -468,7 +468,7 @@ static void _gfxr_fill_ellipse(gfxr_pic_t *pic, byte *buffer, int linewidth, int
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "%s L%d: Invalid ellipse fill mode!\n", __FILE__, __LINE__);
|
||||
warning(" to %s,%d", __FILE__, __LINE__);
|
||||
return;
|
||||
|
||||
}
|
||||
@ -770,7 +770,7 @@ static void _gfxr_draw_subline(gfxr_pic_t *pic, int x, int y, int ex, int ey, in
|
||||
end.y = ey;
|
||||
|
||||
if (ex >= pic->visual_map->index_width || ey >= pic->visual_map->index_height || x < 0 || y < 0) {
|
||||
fprintf(stderr, "While drawing pic0: INVALID LINE %d,%d,%d,%d\n",
|
||||
warning("While drawing pic0: INVALID LINE %d,%d,%d,%d",
|
||||
start.x, start.y, end.x, end.y);
|
||||
return;
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ Common::Error SciEngine::run() {
|
||||
|
||||
|
||||
if (game_init(gamestate)) { /* Initialize */
|
||||
fprintf(stderr, "Game initialization failed: Aborting...\n");
|
||||
warning("Game initialization failed: Aborting...");
|
||||
// TODO: Add an "init failed" error?
|
||||
return Common::kUnknownError;
|
||||
}
|
||||
@ -272,17 +272,17 @@ Common::Error SciEngine::run() {
|
||||
|
||||
bool isVGA = _resmgr->_sciVersion >= SCI_VERSION_01_VGA && !(getFlags() & GF_SCI1_EGA);
|
||||
if (gfxop_init(_resmgr->_sciVersion, isVGA, &gfx_state, &gfx_options, _resmgr)) {
|
||||
fprintf(stderr, "Graphics initialization failed. Aborting...\n");
|
||||
warning("Graphics initialization failed. Aborting...");
|
||||
return Common::kUnknownError;
|
||||
}
|
||||
|
||||
if (game_init_graphics(gamestate)) { // Init interpreter graphics
|
||||
fprintf(stderr, "Game initialization failed: Error in GFX subsystem. Aborting...\n");
|
||||
warning("Game initialization failed: Error in GFX subsystem. Aborting...");
|
||||
return Common::kUnknownError;
|
||||
}
|
||||
|
||||
if (game_init_sound(gamestate, 0)) {
|
||||
fprintf(stderr, "Game initialization failed: Error in sound subsystem. Aborting...\n");
|
||||
warning("Game initialization failed: Error in sound subsystem. Aborting...");
|
||||
return Common::kUnknownError;
|
||||
}
|
||||
|
||||
|
@ -778,7 +778,7 @@ int SfxState::sfx_add_song(SongIterator *it, int priority, song_handle_t handle,
|
||||
fprintf(stderr, "[sfx-core] Adding song: %08lx at %d, it=%p\n", handle, priority, it);
|
||||
#endif
|
||||
if (!it) {
|
||||
fprintf(stderr, "[SFX] Attempt to add empty song with handle %08lx\n", handle);
|
||||
warning("[SFX] Attempt to add empty song with handle %08lx", handle);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ static int _parse_sci_midi_command(BaseSongIterator *self, byte *buf,
|
||||
}
|
||||
|
||||
if (cmd == 0xfe) {
|
||||
fprintf(stderr, "song iterator subsystem: Corrupted sound resource detected.\n");
|
||||
warning("song iterator subsystem: Corrupted sound resource detected.");
|
||||
return SI_FINISHED;
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/util.h"
|
||||
|
||||
#include "sci/tools.h"
|
||||
#include "sci/sfx/sequencer.h"
|
||||
#include "sci/sfx/device.h"
|
||||
@ -36,7 +38,7 @@ static Common::Error midi_gm_open(int patch_len, byte *data, int patch2_len, byt
|
||||
sfx_instrument_map_t *instrument_map = sfx_instrument_map_load_sci(data, patch_len);
|
||||
|
||||
if (!instrument_map) {
|
||||
fprintf(stderr, "[GM] No GM instrument map found, trying MT-32 instrument map..\n");
|
||||
warning("[GM] No GM instrument map found, trying MT-32 instrument map..");
|
||||
instrument_map = sfx_instrument_map_mt32_to_gm(data2, patch2_len);
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ sfx_instrument_map_t *sfx_instrument_map_load_sci(byte *data, size_t size) {
|
||||
return NULL;
|
||||
|
||||
if (size < PATCH_MIN_SIZE) {
|
||||
fprintf(stderr, "[instrument-map] Instrument map too small: %d of %d\n", (int) size, PATCH_MIN_SIZE);
|
||||
warning("[instrument-map] Instrument map too small: %d of %d", (int) size, PATCH_MIN_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -161,12 +161,12 @@ sfx_instrument_map_t *sfx_instrument_map_load_sci(byte *data, size_t size) {
|
||||
map->initialisation_block_size = (int16)READ_LE_UINT16(data + PATCH_INIT_DATA_SIZE_LE);
|
||||
if (map->initialisation_block_size) {
|
||||
if (size < PATCH_MIN_SIZE + map->initialisation_block_size) {
|
||||
fprintf(stderr, "[instrument-map] Instrument map too small for initialisation block: %d of %d\n", (int) size, PATCH_MIN_SIZE);
|
||||
warning("[instrument-map] Instrument map too small for initialisation block: %d of %d", (int) size, PATCH_MIN_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (size > PATCH_MIN_SIZE + map->initialisation_block_size)
|
||||
fprintf(stderr, "[instrument-map] Instrument larger than required by initialisation block: %d of %d\n", (int) size, PATCH_MIN_SIZE);
|
||||
warning("[instrument-map] Instrument larger than required by initialisation block: %d of %d", (int) size, PATCH_MIN_SIZE);
|
||||
|
||||
if (map->initialisation_block_size != 0) {
|
||||
map->initialisation_block = (byte *)malloc(map->initialisation_block_size);
|
||||
@ -254,7 +254,7 @@ static void close_decorated(decorated_midi_writer_t *self) {
|
||||
static int bound_hard_127(int i, const char *descr) {
|
||||
int r = BOUND_127(i);
|
||||
if (r != i)
|
||||
fprintf(stderr, "[instrument-map] Hard-clipping %02x to %02x in %s\n", i, r, descr);
|
||||
warning("[instrument-map] Hard-clipping %02x to %02x in %s", i, r, descr);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -423,7 +423,7 @@ static void init(midi_writer_t *writer, byte *data, size_t len) {
|
||||
byte *find = (byte *) memchr(data + offset, 0xf7, len - offset);
|
||||
|
||||
if (!find) {
|
||||
fprintf(stderr, "[instrument-map] Failed to find end of sysex message\n");
|
||||
warning("[instrument-map] Failed to find end of sysex message");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -455,7 +455,7 @@ static void init(midi_writer_t *writer, byte *data, size_t len) {
|
||||
}
|
||||
|
||||
if (args + offset > len) {
|
||||
fprintf(stderr, "[instrument-map] Insufficient bytes remaining for MIDI command %02x\n", op);
|
||||
warning("[instrument-map] Insufficient bytes remaining for MIDI command %02x", op);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ void test_simple_it() {
|
||||
ASSERT_NEXT(4);
|
||||
ASSERT_CUE(2);
|
||||
ASSERT_SIT;
|
||||
// fprintf(stderr, "XXX => %d\n", songit_next(&it, data, &result, IT_READER_MASK_ALL));
|
||||
// warning("XXX => %d", songit_next(&it, data, &result, IT_READER_MASK_ALL));
|
||||
ASSERT_NEXT(35);
|
||||
ASSERT_NEXT(SI_FINISHED);
|
||||
ASSERT_SIT;
|
||||
@ -418,6 +418,6 @@ int main(int argc, char **argv) {
|
||||
test_iterator_sci0_loop();
|
||||
test_iterator_sci0_mark_loop();
|
||||
if (errors != 0)
|
||||
fprintf(stderr, "[ERROR] %d errors total.\n", errors);
|
||||
warning("[ERROR] %d errors total.", errors);
|
||||
return (errors != 0);
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ bool vocab_get_words(ResourceManager *resmgr, WordMap &words) {
|
||||
seeker = 26 * 2; // vocab.000 starts with 26 16-bit pointers which we don't use
|
||||
|
||||
if (resource->size < seeker) {
|
||||
fprintf(stderr, "Invalid main vocabulary encountered: Too small\n");
|
||||
warning("Invalid main vocabulary encountered: Too small");
|
||||
return false;
|
||||
// Now this ought to be critical, but it'll just cause parse() and said() not to work
|
||||
}
|
||||
@ -291,7 +291,7 @@ bool vocab_get_branches(ResourceManager * resmgr, Common::Array<parse_tree_branc
|
||||
int branches_nr = resource->size / 20;
|
||||
|
||||
if (branches_nr == 0) {
|
||||
fprintf(stderr, "Parser tree data is empty!\n");
|
||||
warning("Parser tree data is empty!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user