SCI: Tons of cleanup
svn-id: r38721
This commit is contained in:
parent
0d41ca8d38
commit
9f2c0dcc6f
10 changed files with 55 additions and 138 deletions
|
@ -634,7 +634,7 @@ int game_init(EngineState *s) {
|
|||
s->debug_mode = 0x0; // Disable all debugging
|
||||
s->onscreen_console = 0; // No onscreen console unless explicitly requested
|
||||
|
||||
srand(time(NULL)); // Initialize random number generator
|
||||
srand(g_system->getMillis()); // Initialize random number generator
|
||||
|
||||
// script_dissect(0, s->selector_names, s->selector_names_nr);
|
||||
game_obj = script_lookup_export(s, 0, 0);
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
# undef ARRAYSIZE
|
||||
#endif
|
||||
|
||||
|
||||
#include <time.h> // FIXME: For struct tm
|
||||
|
||||
#include "common/system.h"
|
||||
|
||||
#include "sci/sci.h"
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <time.h> // FIXME: For struct tm
|
||||
#include "sci/include/sci_memory.h"
|
||||
#include "sci/include/gfx_operations.h"
|
||||
#include "sci/include/sfx_engine.h"
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <time.h> // FIXME: For struct tm
|
||||
#include "sci/include/sci_memory.h"
|
||||
#include "sci/include/gfx_operations.h"
|
||||
#include "sci/include/sfx_engine.h"
|
||||
|
@ -3991,7 +3992,7 @@ _cfsml_read_script_t(Common::SeekableReadStream *fh, script_t* save_struc, const
|
|||
|
||||
// Auto-generated CFSML declaration and function block ends here
|
||||
// Auto-generation performed by cfsml.pl 0.8.2
|
||||
#line 446 "engines/sci/engine/savegame.cfsml"
|
||||
#line 447 "engines/sci/engine/savegame.cfsml"
|
||||
|
||||
void write_songlib_t(Common::WriteStream *fh, songlib_t *songlib) {
|
||||
song_t *seeker = *(songlib->lib);
|
||||
|
@ -4008,7 +4009,7 @@ void write_songlib_t(Common::WriteStream *fh, songlib_t *songlib) {
|
|||
_cfsml_write_song_t(fh, seeker);
|
||||
WSprintf(fh, "\n");
|
||||
// End of auto-generated CFSML data writer code
|
||||
#line 458 "engines/sci/engine/savegame.cfsml"
|
||||
#line 459 "engines/sci/engine/savegame.cfsml"
|
||||
seeker = seeker->next;
|
||||
}
|
||||
WSprintf(fh, "]\n");
|
||||
|
@ -4054,7 +4055,7 @@ int read_songlib_t(Common::SeekableReadStream *fh, songlib_t *songlib, const cha
|
|||
}
|
||||
}
|
||||
// End of auto-generated CFSML data reader code
|
||||
#line 482 "engines/sci/engine/savegame.cfsml"
|
||||
#line 483 "engines/sci/engine/savegame.cfsml"
|
||||
song_lib_add(*songlib, newsong);
|
||||
}
|
||||
l = fh->readLine(); // "]"
|
||||
|
@ -4095,7 +4096,7 @@ void write_int_hash_map_tp(Common::WriteStream *fh, int_hash_map_t **foo) {
|
|||
_cfsml_write_int_hash_map_t(fh, *foo);
|
||||
WSprintf(fh, "\n");
|
||||
// End of auto-generated CFSML data writer code
|
||||
#line 518 "engines/sci/engine/savegame.cfsml"
|
||||
#line 519 "engines/sci/engine/savegame.cfsml"
|
||||
}
|
||||
|
||||
void write_song_tp(Common::WriteStream *fh, song_t **foo) {
|
||||
|
@ -4104,7 +4105,7 @@ void write_song_tp(Common::WriteStream *fh, song_t **foo) {
|
|||
_cfsml_write_song_t(fh, *foo);
|
||||
WSprintf(fh, "\n");
|
||||
// End of auto-generated CFSML data writer code
|
||||
#line 522 "engines/sci/engine/savegame.cfsml"
|
||||
#line 523 "engines/sci/engine/savegame.cfsml"
|
||||
}
|
||||
|
||||
song_iterator_t *build_iterator(EngineState *s, int song_nr, int type, songit_id_t id);
|
||||
|
@ -4136,7 +4137,7 @@ int read_song_tp(Common::SeekableReadStream *fh, song_t **foo, const char *lastv
|
|||
}
|
||||
}
|
||||
// End of auto-generated CFSML data reader code
|
||||
#line 532 "engines/sci/engine/savegame.cfsml"
|
||||
#line 533 "engines/sci/engine/savegame.cfsml"
|
||||
(*foo)->delay = 0;
|
||||
(*foo)->it = NULL;
|
||||
(*foo)->next_playing = (*foo)->next_stopping = (*foo)->next = NULL;
|
||||
|
@ -4167,7 +4168,7 @@ int read_int_hash_map_tp(Common::SeekableReadStream *fh, int_hash_map_t **foo, c
|
|||
}
|
||||
}
|
||||
// End of auto-generated CFSML data reader code
|
||||
#line 541 "engines/sci/engine/savegame.cfsml"
|
||||
#line 542 "engines/sci/engine/savegame.cfsml"
|
||||
(*foo)->holes = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
@ -4183,7 +4184,7 @@ void write_int_hash_map_node_tp(Common::WriteStream *fh, int_hash_map_t::node_t
|
|||
write_int_hash_map_node_tp(fh, &((*foo)->next));
|
||||
WSprintf(fh, "\n");
|
||||
// End of auto-generated CFSML data writer code
|
||||
#line 552 "engines/sci/engine/savegame.cfsml"
|
||||
#line 553 "engines/sci/engine/savegame.cfsml"
|
||||
} else
|
||||
WSprintf(fh, "L");
|
||||
WSprintf(fh, "]");
|
||||
|
@ -4233,7 +4234,7 @@ void write_menubar_tp(Common::WriteStream *fh, menubar_t **foo) {
|
|||
_cfsml_write_menubar_t(fh, (*foo));
|
||||
WSprintf(fh, "\n");
|
||||
// End of auto-generated CFSML data writer code
|
||||
#line 597 "engines/sci/engine/savegame.cfsml"
|
||||
#line 598 "engines/sci/engine/savegame.cfsml"
|
||||
} else { // Nothing to write
|
||||
WSprintf(fh, "\\null\\");
|
||||
}
|
||||
|
@ -4267,7 +4268,7 @@ int read_menubar_tp(Common::SeekableReadStream *fh, menubar_t **foo, const char
|
|||
}
|
||||
}
|
||||
// End of auto-generated CFSML data reader code
|
||||
#line 609 "engines/sci/engine/savegame.cfsml"
|
||||
#line 610 "engines/sci/engine/savegame.cfsml"
|
||||
}
|
||||
return *hiteof;
|
||||
}
|
||||
|
@ -4279,7 +4280,7 @@ void write_mem_obj_t(Common::WriteStream *fh, mem_obj_t *foo) {
|
|||
_cfsml_write_int(fh, &foo->segmgr_id);
|
||||
WSprintf(fh, "\n");
|
||||
// End of auto-generated CFSML data writer code
|
||||
#line 616 "engines/sci/engine/savegame.cfsml"
|
||||
#line 617 "engines/sci/engine/savegame.cfsml"
|
||||
switch (foo->type) {
|
||||
case MEM_OBJ_SCRIPT:
|
||||
#line 814 "engines/sci/engine/savegame.cfsml"
|
||||
|
@ -4287,7 +4288,7 @@ void write_mem_obj_t(Common::WriteStream *fh, mem_obj_t *foo) {
|
|||
_cfsml_write_script_t(fh, &foo->data.script);
|
||||
WSprintf(fh, "\n");
|
||||
// End of auto-generated CFSML data writer code
|
||||
#line 619 "engines/sci/engine/savegame.cfsml"
|
||||
#line 620 "engines/sci/engine/savegame.cfsml"
|
||||
break;
|
||||
case MEM_OBJ_CLONES:
|
||||
#line 814 "engines/sci/engine/savegame.cfsml"
|
||||
|
@ -4295,7 +4296,7 @@ void write_mem_obj_t(Common::WriteStream *fh, mem_obj_t *foo) {
|
|||
_cfsml_write_clone_table_t(fh, &foo->data.clones);
|
||||
WSprintf(fh, "\n");
|
||||
// End of auto-generated CFSML data writer code
|
||||
#line 622 "engines/sci/engine/savegame.cfsml"
|
||||
#line 623 "engines/sci/engine/savegame.cfsml"
|
||||
break;
|
||||
case MEM_OBJ_LOCALS:
|
||||
#line 814 "engines/sci/engine/savegame.cfsml"
|
||||
|
@ -4303,7 +4304,7 @@ void write_mem_obj_t(Common::WriteStream *fh, mem_obj_t *foo) {
|
|||
_cfsml_write_local_variables_t(fh, &foo->data.locals);
|
||||
WSprintf(fh, "\n");
|
||||
// End of auto-generated CFSML data writer code
|
||||
#line 625 "engines/sci/engine/savegame.cfsml"
|
||||
#line 626 "engines/sci/engine/savegame.cfsml"
|
||||
break;
|
||||
case MEM_OBJ_SYS_STRINGS:
|
||||
#line 814 "engines/sci/engine/savegame.cfsml"
|
||||
|
@ -4311,7 +4312,7 @@ void write_mem_obj_t(Common::WriteStream *fh, mem_obj_t *foo) {
|
|||
_cfsml_write_sys_strings_t(fh, &foo->data.sys_strings);
|
||||
WSprintf(fh, "\n");
|
||||
// End of auto-generated CFSML data writer code
|
||||
#line 628 "engines/sci/engine/savegame.cfsml"
|
||||
#line 629 "engines/sci/engine/savegame.cfsml"
|
||||
break;
|
||||
case MEM_OBJ_STACK:
|
||||
#line 814 "engines/sci/engine/savegame.cfsml"
|
||||
|
@ -4319,7 +4320,7 @@ void write_mem_obj_t(Common::WriteStream *fh, mem_obj_t *foo) {
|
|||
_cfsml_write_int(fh, &foo->data.stack.nr);
|
||||
WSprintf(fh, "\n");
|
||||
// End of auto-generated CFSML data writer code
|
||||
#line 631 "engines/sci/engine/savegame.cfsml"
|
||||
#line 632 "engines/sci/engine/savegame.cfsml"
|
||||
break;
|
||||
case MEM_OBJ_HUNK:
|
||||
break;
|
||||
|
@ -4329,7 +4330,7 @@ void write_mem_obj_t(Common::WriteStream *fh, mem_obj_t *foo) {
|
|||
_cfsml_write_list_table_t(fh, &foo->data.lists);
|
||||
WSprintf(fh, "\n");
|
||||
// End of auto-generated CFSML data writer code
|
||||
#line 636 "engines/sci/engine/savegame.cfsml"
|
||||
#line 637 "engines/sci/engine/savegame.cfsml"
|
||||
break;
|
||||
case MEM_OBJ_NODES:
|
||||
#line 814 "engines/sci/engine/savegame.cfsml"
|
||||
|
@ -4337,7 +4338,7 @@ void write_mem_obj_t(Common::WriteStream *fh, mem_obj_t *foo) {
|
|||
_cfsml_write_node_table_t(fh, &foo->data.nodes);
|
||||
WSprintf(fh, "\n");
|
||||
// End of auto-generated CFSML data writer code
|
||||
#line 639 "engines/sci/engine/savegame.cfsml"
|
||||
#line 640 "engines/sci/engine/savegame.cfsml"
|
||||
break;
|
||||
case MEM_OBJ_DYNMEM:
|
||||
#line 814 "engines/sci/engine/savegame.cfsml"
|
||||
|
@ -4345,7 +4346,7 @@ void write_mem_obj_t(Common::WriteStream *fh, mem_obj_t *foo) {
|
|||
_cfsml_write_dynmem_t(fh, &foo->data.dynmem);
|
||||
WSprintf(fh, "\n");
|
||||
// End of auto-generated CFSML data writer code
|
||||
#line 642 "engines/sci/engine/savegame.cfsml"
|
||||
#line 643 "engines/sci/engine/savegame.cfsml"
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -4380,7 +4381,7 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l
|
|||
}
|
||||
}
|
||||
// End of auto-generated CFSML data reader code
|
||||
#line 654 "engines/sci/engine/savegame.cfsml"
|
||||
#line 655 "engines/sci/engine/savegame.cfsml"
|
||||
switch (foo->type) {
|
||||
case MEM_OBJ_SCRIPT:
|
||||
// Auto-generated CFSML data reader code
|
||||
|
@ -4406,7 +4407,7 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l
|
|||
}
|
||||
}
|
||||
// End of auto-generated CFSML data reader code
|
||||
#line 657 "engines/sci/engine/savegame.cfsml"
|
||||
#line 658 "engines/sci/engine/savegame.cfsml"
|
||||
break;
|
||||
case MEM_OBJ_CLONES:
|
||||
// Auto-generated CFSML data reader code
|
||||
|
@ -4432,7 +4433,7 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l
|
|||
}
|
||||
}
|
||||
// End of auto-generated CFSML data reader code
|
||||
#line 660 "engines/sci/engine/savegame.cfsml"
|
||||
#line 661 "engines/sci/engine/savegame.cfsml"
|
||||
break;
|
||||
case MEM_OBJ_LOCALS:
|
||||
// Auto-generated CFSML data reader code
|
||||
|
@ -4458,7 +4459,7 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l
|
|||
}
|
||||
}
|
||||
// End of auto-generated CFSML data reader code
|
||||
#line 663 "engines/sci/engine/savegame.cfsml"
|
||||
#line 664 "engines/sci/engine/savegame.cfsml"
|
||||
break;
|
||||
case MEM_OBJ_SYS_STRINGS:
|
||||
// Auto-generated CFSML data reader code
|
||||
|
@ -4484,7 +4485,7 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l
|
|||
}
|
||||
}
|
||||
// End of auto-generated CFSML data reader code
|
||||
#line 666 "engines/sci/engine/savegame.cfsml"
|
||||
#line 667 "engines/sci/engine/savegame.cfsml"
|
||||
break;
|
||||
case MEM_OBJ_LISTS:
|
||||
// Auto-generated CFSML data reader code
|
||||
|
@ -4510,7 +4511,7 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l
|
|||
}
|
||||
}
|
||||
// End of auto-generated CFSML data reader code
|
||||
#line 669 "engines/sci/engine/savegame.cfsml"
|
||||
#line 670 "engines/sci/engine/savegame.cfsml"
|
||||
break;
|
||||
case MEM_OBJ_NODES:
|
||||
// Auto-generated CFSML data reader code
|
||||
|
@ -4536,7 +4537,7 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l
|
|||
}
|
||||
}
|
||||
// End of auto-generated CFSML data reader code
|
||||
#line 672 "engines/sci/engine/savegame.cfsml"
|
||||
#line 673 "engines/sci/engine/savegame.cfsml"
|
||||
break;
|
||||
case MEM_OBJ_STACK:
|
||||
// Auto-generated CFSML data reader code
|
||||
|
@ -4562,7 +4563,7 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l
|
|||
}
|
||||
}
|
||||
// End of auto-generated CFSML data reader code
|
||||
#line 675 "engines/sci/engine/savegame.cfsml"
|
||||
#line 676 "engines/sci/engine/savegame.cfsml"
|
||||
foo->data.stack.entries = (reg_t *)sci_calloc(foo->data.stack.nr, sizeof(reg_t));
|
||||
break;
|
||||
case MEM_OBJ_HUNK:
|
||||
|
@ -4592,7 +4593,7 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l
|
|||
}
|
||||
}
|
||||
// End of auto-generated CFSML data reader code
|
||||
#line 682 "engines/sci/engine/savegame.cfsml"
|
||||
#line 683 "engines/sci/engine/savegame.cfsml"
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -4606,7 +4607,7 @@ void write_mem_obj_tp(Common::WriteStream *fh, mem_obj_t **foo) {
|
|||
write_mem_obj_t(fh, (*foo));
|
||||
WSprintf(fh, "\n");
|
||||
// End of auto-generated CFSML data writer code
|
||||
#line 691 "engines/sci/engine/savegame.cfsml"
|
||||
#line 692 "engines/sci/engine/savegame.cfsml"
|
||||
} else { // Nothing to write
|
||||
WSprintf(fh, "\\null\\");
|
||||
}
|
||||
|
@ -4639,7 +4640,7 @@ int read_mem_obj_tp(Common::SeekableReadStream *fh, mem_obj_t **foo, const char
|
|||
}
|
||||
}
|
||||
// End of auto-generated CFSML data reader code
|
||||
#line 702 "engines/sci/engine/savegame.cfsml"
|
||||
#line 703 "engines/sci/engine/savegame.cfsml"
|
||||
return *hiteof;
|
||||
}
|
||||
return 0;
|
||||
|
@ -4693,13 +4694,13 @@ int gamestate_save(EngineState *s, Common::WriteStream *fh, const char* savename
|
|||
_cfsml_write_SavegameMetadata(fh, meta);
|
||||
WSprintf(fh, "\n");
|
||||
// End of auto-generated CFSML data writer code
|
||||
#line 751 "engines/sci/engine/savegame.cfsml"
|
||||
#line 752 "engines/sci/engine/savegame.cfsml"
|
||||
#line 814 "engines/sci/engine/savegame.cfsml"
|
||||
// Auto-generated CFSML data writer code
|
||||
_cfsml_write_EngineState(fh, s);
|
||||
WSprintf(fh, "\n");
|
||||
// End of auto-generated CFSML data writer code
|
||||
#line 752 "engines/sci/engine/savegame.cfsml"
|
||||
#line 753 "engines/sci/engine/savegame.cfsml"
|
||||
|
||||
delete meta;
|
||||
|
||||
|
@ -5002,7 +5003,7 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
|
|||
}
|
||||
}
|
||||
// End of auto-generated CFSML data reader code
|
||||
#line 1026 "engines/sci/engine/savegame.cfsml"
|
||||
#line 1027 "engines/sci/engine/savegame.cfsml"
|
||||
if ((meta->savegame_version < FREESCI_MINIMUM_SAVEGAME_VERSION) ||
|
||||
(meta->savegame_version > FREESCI_CURRENT_SAVEGAME_VERSION)) {
|
||||
if (meta->savegame_version < FREESCI_MINIMUM_SAVEGAME_VERSION)
|
||||
|
@ -5054,7 +5055,7 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
|
|||
}
|
||||
}
|
||||
// End of auto-generated CFSML data reader code
|
||||
#line 1049 "engines/sci/engine/savegame.cfsml"
|
||||
#line 1050 "engines/sci/engine/savegame.cfsml"
|
||||
|
||||
sfx_exit(&s->sound);
|
||||
_gamestate_unfrob(retval);
|
||||
|
@ -5178,7 +5179,7 @@ bool get_savegame_metadata(Common::SeekableReadStream* stream, SavegameMetadata*
|
|||
}
|
||||
}
|
||||
// End of auto-generated CFSML data reader code
|
||||
#line 1144 "engines/sci/engine/savegame.cfsml"
|
||||
#line 1145 "engines/sci/engine/savegame.cfsml"
|
||||
|
||||
if (read_eof)
|
||||
return false;
|
||||
|
|
|
@ -33,12 +33,6 @@ namespace Common {
|
|||
class WriteStream;
|
||||
}
|
||||
|
||||
// FIXME. Remove after transiton to File class
|
||||
#include <sys/stat.h>
|
||||
|
||||
// FIXME. Remove this eventually
|
||||
#include <time.h>
|
||||
|
||||
#include "sci/tools.h"
|
||||
#include "sci/include/sciresource.h"
|
||||
#include "sci/include/script.h"
|
||||
|
@ -76,7 +70,7 @@ namespace Sci {
|
|||
#define MAX_GAMEDIR_SIZE 32 /* Used for subdirectory inside of "~/.freesci/" */
|
||||
#define MAX_SAVEGAME_NR 20 /* Maximum number of savegames */
|
||||
|
||||
#define MAX_SAVE_DIR_SIZE MAX_HOMEDIR_SIZE + STRLEN_FREESCI_GAMEDIR + MAX_GAMEDIR_SIZE + 4
|
||||
#define MAX_SAVE_DIR_SIZE MAXPATHLEN + STRLEN_FREESCI_GAMEDIR + MAX_GAMEDIR_SIZE + 4
|
||||
/* +4 for the three slashes and trailing \0 */
|
||||
|
||||
/* values for EngineState.restarting_flag */
|
||||
|
|
|
@ -53,7 +53,7 @@ typedef enum {
|
|||
#define GFXR_RES_NR(id) (id & 0xffff)
|
||||
|
||||
|
||||
typedef struct gfx_resource_struct {
|
||||
struct gfx_resource_t {
|
||||
int ID; /* Resource ID */
|
||||
int lock_sequence_nr; /* See description of lock_counter in gfx_resstate_t */
|
||||
int mode; /* A mode type hash */
|
||||
|
@ -72,7 +72,7 @@ typedef struct gfx_resource_struct {
|
|||
gfxr_pic_t *pic;
|
||||
} unscaled_data;
|
||||
|
||||
} gfx_resource_t;
|
||||
};
|
||||
|
||||
|
||||
struct _gfx_options;
|
||||
|
|
|
@ -40,15 +40,6 @@ namespace Sci {
|
|||
#define SCI_MAX_RESOURCE_SIZE 0x0400000
|
||||
/* The maximum allowed size for a compressed or decompressed resource */
|
||||
|
||||
#ifdef WIN32
|
||||
# define DIR_SEPARATOR_STR "\\"
|
||||
# define PATH_SEPARATOR_STR ";"
|
||||
#else
|
||||
# define DIR_SEPARATOR_STR "/"
|
||||
# define PATH_SEPARATOR_STR ":"
|
||||
#endif
|
||||
|
||||
|
||||
/*** RESOURCE STATUS TYPES ***/
|
||||
#define SCI_STATUS_NOMALLOC 0
|
||||
#define SCI_STATUS_ALLOCATED 1
|
||||
|
@ -146,7 +137,8 @@ struct resource_altsource_t {
|
|||
};
|
||||
|
||||
|
||||
typedef struct _resource_struct {
|
||||
/** Struct for storing resources in memory */
|
||||
struct resource_t {
|
||||
unsigned char *data;
|
||||
|
||||
unsigned short number;
|
||||
|
@ -161,11 +153,11 @@ typedef struct _resource_struct {
|
|||
unsigned char status;
|
||||
unsigned short lockers; /* Number of places where this resource was locked */
|
||||
|
||||
struct _resource_struct *next; /* Position marker for the LRU queue */
|
||||
struct _resource_struct *prev;
|
||||
resource_t *next; /* Position marker for the LRU queue */
|
||||
resource_t *prev;
|
||||
|
||||
resource_altsource_t *alt_sources; /* SLL of alternative resource data sources */
|
||||
} resource_t; /* for storing resources in memory */
|
||||
};
|
||||
|
||||
|
||||
struct ResourceManager {
|
||||
|
|
|
@ -88,7 +88,7 @@ MODULE_OBJS = \
|
|||
|
||||
# Generate savegame.cpp
|
||||
$(srcdir)/engines/sci/engine/savegame.cpp: $(srcdir)/engines/sci/engine/savegame.cfsml $(srcdir)/tools/cfsml.pl
|
||||
cat $< | perl $(srcdir)/tools/cfsml.pl -f $(<) > $@
|
||||
cat $< | perl $(srcdir)/tools/cfsml.pl -f engines/sci/engine/savegame.cfsml > $@
|
||||
|
||||
# This module can be built as a plugin
|
||||
ifeq ($(ENABLE_SCI), DYNAMIC_PLUGIN)
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#ifdef UNIX
|
||||
#include <fnmatch.h>
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#include "common/archive.h"
|
||||
|
@ -315,41 +316,6 @@ void sci_finish_find(sci_dir_t *dir) {
|
|||
|
||||
#endif
|
||||
|
||||
int sci_mkpath(const char *path) {
|
||||
const char *path_position = path;
|
||||
char *next_separator = NULL;
|
||||
|
||||
if (chdir(G_DIR_SEPARATOR_S)) { // Go to root
|
||||
sciprintf("Error: Could not change to root directory '%s'", G_DIR_SEPARATOR_S);
|
||||
return -1;
|
||||
}
|
||||
|
||||
do {
|
||||
if (next_separator)
|
||||
*next_separator = G_DIR_SEPARATOR_S[0];
|
||||
next_separator = (char *)strchr(path_position, G_DIR_SEPARATOR_S[0]);
|
||||
|
||||
if (next_separator)
|
||||
*next_separator = 0;
|
||||
|
||||
if (*path_position) { // Unless we're at the first slash...
|
||||
if (chdir(path_position)) {
|
||||
if (scimkdir(path_position, 0700) || chdir(path_position)) {
|
||||
sciprintf("Error: Could not create subdirectory '%s' in", path_position);
|
||||
if (next_separator)
|
||||
*next_separator = G_DIR_SEPARATOR_S[0];
|
||||
sciprintf(" '%s'!\n", path);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
path_position = next_separator + 1;
|
||||
|
||||
} while (next_separator);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Returns the case-sensitive filename of a file.
|
||||
** Expects *dir to be uninitialized and the caller to free it afterwards.
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#define SCI_TOOLS_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/endian.h"
|
||||
|
||||
/** This header file defines (mostly) generic tools and utility functions.
|
||||
** It also handles portability stuff, in cooperation with scitypes.h
|
||||
|
@ -40,13 +41,6 @@
|
|||
#define SCI_INVALID_FD -1
|
||||
#define IS_VALID_FD(a) ((a) != SCI_INVALID_FD) /* Tests validity of a file descriptor */
|
||||
|
||||
#ifdef WIN32
|
||||
# ifndef _Win32
|
||||
# define _Win32
|
||||
/* Work around problem with some versions of flex */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*#define _SCI_RESOURCE_DEBUG */
|
||||
/*#define _SCI_DECOMPRESS_DEBUG*/
|
||||
|
||||
|
@ -85,8 +79,6 @@
|
|||
|
||||
|
||||
|
||||
#define MAX_HOMEDIR_SIZE 255
|
||||
|
||||
#ifdef WIN32
|
||||
# define FO_BINARY "b"
|
||||
#else
|
||||
|
@ -107,32 +99,10 @@ namespace Sci {
|
|||
|
||||
/**** FUNCTION DECLARATIONS ****/
|
||||
|
||||
#ifdef WIN32
|
||||
# define scimkdir(arg1,arg2) mkdir(arg1)
|
||||
#else
|
||||
# define scimkdir(arg1,arg2) mkdir(arg1,arg2)
|
||||
#endif
|
||||
#define getInt16 (int16)READ_UINT16
|
||||
#define getUInt16 READ_UINT16
|
||||
#define putInt16 WRITE_UINT16
|
||||
|
||||
static inline gint16 getInt16(byte *d) {
|
||||
return (gint16)(*d | (d[1] << 8));
|
||||
}
|
||||
|
||||
#define getUInt16(d) (guint16)(getInt16(d))
|
||||
|
||||
/* Turns a little endian 16 bit value into a machine-dependant 16 bit value
|
||||
** Parameters: d: Pointer to the memory position from which to read
|
||||
** Returns : (gint16) The (possibly converted) 16 bit value
|
||||
** getUInt16 returns the int unsigned.
|
||||
*/
|
||||
|
||||
static inline void putInt16(byte* dest, int src) {
|
||||
dest[0] = (byte)src & 0xff;
|
||||
dest[1] = (byte)(src >> 8) & 0xff;
|
||||
}
|
||||
/* Converse of getInt16()
|
||||
** Parameters: (byte *) dest: The position to write to
|
||||
** (int) src: value to write
|
||||
*/
|
||||
|
||||
/* --- */
|
||||
|
||||
|
@ -220,13 +190,6 @@ char *sci_getcwd();
|
|||
** Returns : (char *) a malloc'd cwd, or NULL if it couldn't be determined.
|
||||
*/
|
||||
|
||||
int sci_mkpath(const char *path);
|
||||
/* Asserts that the specified path is available
|
||||
** Parameters: (const char *) path: Path to verify/create
|
||||
** Returns : (int) 0 on success, <0 on error
|
||||
** This function will create any directories that couldn't be found
|
||||
*/
|
||||
|
||||
int sci_fd_size(int fd);
|
||||
/* Returns the filesize of an open file
|
||||
** Parameters: (int) fd: File descriptor of open file
|
||||
|
@ -244,9 +207,6 @@ It uses StrAt() to read the individual elements, so we must determine
|
|||
whether a string is really a string or an array. */
|
||||
int is_print_str(char *str);
|
||||
|
||||
# define sci_unlink unlink
|
||||
# define sci_rmdir rmdir
|
||||
|
||||
/** Find first set bit in bits and return its index. Returns 0 if bits is 0. */
|
||||
int sci_ffs(int bits);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue