[Scummvm-cvs-logs] SF.net SVN: scummvm:[38593] scummvm/trunk/engines/sci

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Feb 20 16:41:58 CET 2009


Revision: 38593
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38593&view=rev
Author:   fingolfin
Date:     2009-02-20 15:41:58 +0000 (Fri, 20 Feb 2009)

Log Message:
-----------
SCI: Renamed resource_source_t -> ResourceSource; some cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/sci/include/sciresource.h
    scummvm/trunk/engines/sci/scicore/resource.cpp
    scummvm/trunk/engines/sci/scicore/resource_map.cpp
    scummvm/trunk/engines/sci/scicore/resource_patch.cpp

Modified: scummvm/trunk/engines/sci/include/sciresource.h
===================================================================
--- scummvm/trunk/engines/sci/include/sciresource.h	2009-02-20 15:24:22 UTC (rev 38592)
+++ scummvm/trunk/engines/sci/include/sciresource.h	2009-02-20 15:41:58 UTC (rev 38593)
@@ -142,10 +142,10 @@
 	} location;
 	struct resource_source_struct *associated_map;
 	struct resource_source_struct *next;
-} resource_source_t;
+} ResourceSource;
 
 typedef struct _resource_altsource_struct {
-	resource_source_t *source;
+	ResourceSource *source;
 	unsigned int file_offset;
 	struct _resource_altsource_struct *next;
 } resource_altsource_t;
@@ -161,7 +161,7 @@
 	unsigned int size;
 
 	unsigned int file_offset; /* Offset in file */
-	resource_source_t *source;
+	ResourceSource *source;
 
 	unsigned char status;
 	unsigned short lockers; /* Number of places where this resource was locked */
@@ -178,7 +178,7 @@
 	int sci_version; /* SCI resource version to use */
 
 	int resources_nr;
-	resource_source_t *sources;
+	ResourceSource *sources;
 	resource_t *resources;
 
 	int memory_locked; /* Amount of resource bytes in locked memory */
@@ -212,7 +212,7 @@
 ** is exceeded.
 */
 
-resource_source_t *
+ResourceSource *
 scir_add_patch_dir(ResourceManager *mgr, int type, char *path);
 /* Add a path to the resource manager's list of sources.
 ** Parameters: (ResourceManager *) mgr: The resource manager to look up in
@@ -222,22 +222,22 @@
 ** Returns: A pointer to the added source structure, or NULL if an error occurred.
 */
 
-resource_source_t *
-scir_get_volume(ResourceManager *mgr, resource_source_t *map, int volume_nr);
+ResourceSource *
+scir_get_volume(ResourceManager *mgr, ResourceSource *map, int volume_nr);
 
-resource_source_t *
-scir_add_volume(ResourceManager *mgr, resource_source_t *map, char *filename,
+ResourceSource *
+scir_add_volume(ResourceManager *mgr, ResourceSource *map, char *filename,
                 int number, int extended_addressing);
 /* Add a volume to the resource manager's list of sources.
 ** Parameters: (ResourceManager *) mgr: The resource manager to look up in
-**             (resource_source_t *) map: The map associated with this volume
+**             (ResourceSource *) map: The map associated with this volume
 **             (char *) filename: The name of the volume to add
 **             (int) extended_addressing: 1 if this volume uses extended addressing,
 **                                        0 otherwise.
 ** Returns: A pointer to the added source structure, or NULL if an error occurred.
 */
 
-resource_source_t *
+ResourceSource *
 scir_add_external_map(ResourceManager *mgr, char *file_name);
 /* Add an external (i.e. separate file) map resource to the resource manager's list of sources.
 ** Parameters: (ResourceManager *) mgr: The resource manager to look up in
@@ -245,7 +245,7 @@
 ** Returns: A pointer to the added source structure, or NULL if an error occurred.
 */
 
-resource_source_t *
+ResourceSource *
 scir_add_internal_map(ResourceManager *mgr, resource_t *map);
 /* Add an internal (i.e. a resource) map resource to the resource manager's list of sources.
 ** Parameters: (ResourceManager *) mgr: The resource manager to look up in
@@ -308,7 +308,7 @@
 /**--- Resource map decoding functions ---*/
 
 int
-sci0_read_resource_map(ResourceManager *mgr, resource_source_t *map, resource_t **resources, int *resource_nr_p, int *sci_version);
+sci0_read_resource_map(ResourceManager *mgr, ResourceSource *map, resource_t **resources, int *resource_nr_p, int *sci_version);
 /* Reads the SCI0 resource.map file from a local directory
 ** Parameters: (char *) path: (unused)
 **             (resource_t **) resources: Pointer to a pointer
@@ -322,7 +322,7 @@
 */
 
 int
-sci1_read_resource_map(ResourceManager *mgr, resource_source_t *map, resource_source_t *vol,
+sci1_read_resource_map(ResourceManager *mgr, ResourceSource *map, ResourceSource *vol,
                        resource_t **resource_p, int *resource_nr_p, int *sci_version);
 /* Reads the SCI1 resource.map file from a local directory
 ** Parameters: (char *) path: (unused)
@@ -357,7 +357,7 @@
 */
 
 int
-sci0_read_resource_patches(resource_source_t *source, resource_t **resources, int *resource_nr_p);
+sci0_read_resource_patches(ResourceSource *source, resource_t **resources, int *resource_nr_p);
 /* Reads SCI0 patch files from a local directory
 ** Parameters: (char *) path: (unused)
 **             (resource_t **) resources: Pointer to a pointer
@@ -370,7 +370,7 @@
 */
 
 int
-sci1_read_resource_patches(resource_source_t *source, resource_t **resources, int *resource_nr_p);
+sci1_read_resource_patches(ResourceSource *source, resource_t **resources, int *resource_nr_p);
 /* Reads SCI1 patch files from a local directory
 ** Parameters: (char *) path: (unused)
 **             (resource_t **) resources: Pointer to a pointer
@@ -462,70 +462,16 @@
 */
 
 void
-_scir_add_altsource(resource_t *res, resource_source_t *source, unsigned int file_offset);
+_scir_add_altsource(resource_t *res, ResourceSource *source, unsigned int file_offset);
 /* Adds an alternative source to a resource
 ** Parameters: (resource_t *) res: The resource to add to
-**             (resource_source_t *) source: The source of the resource
+**             (ResourceSource *) source: The source of the resource
 **             (unsigned int) file_offset: Offset in the file the resource
 **                            is stored at
-** Retruns   : (void)
+** Returns   : (void)
 */
 
 
-/**** Internal #defines ****/
-
-#define SCI_RESOURCE_FILE_PATCH -1 /* Identifies resources read from patches */
-
-/* Resource type encoding */
-#define SCI0_B1_RESTYPE_MASK  0xf8
-#define SCI0_B1_RESTYPE_SHIFT 3
-#define SCI0_B3_RESFILE_MASK  0xfc
-#define SCI0_B3_RESFILE_SHIFT 2
-#define SCI01V_B3_RESFILE_MASK  0xf0
-#define SCI01V_B3_RESFILE_SHIFT 4
-
-#define SCI0_RESID_GET_TYPE(bytes) \
-    (((bytes)[1] & SCI0_B1_RESTYPE_MASK) >> SCI0_B1_RESTYPE_SHIFT)
-#define SCI0_RESID_GET_NUMBER(bytes) \
-    ((((bytes)[1] & ~SCI0_B1_RESTYPE_MASK) << 8) | ((bytes)[0]))
-
-#define SCI0_RESFILE_GET_FILE(bytes) \
-    (((bytes)[3] & SCI0_B3_RESFILE_MASK) >> SCI0_B3_RESFILE_SHIFT)
-#define SCI0_RESFILE_GET_OFFSET(bytes) \
-    ((((bytes)[3] & ~SCI0_B3_RESFILE_MASK) << 24) \
-      | (((bytes)[2]) << 16) \
-      | (((bytes)[1]) << 8) \
-      | (((bytes)[0]) << 0))
-
-#define SCI01V_RESFILE_GET_FILE(bytes) \
-    (((bytes)[3] & SCI01V_B3_RESFILE_MASK) >> SCI01V_B3_RESFILE_SHIFT)
-#define SCI01V_RESFILE_GET_OFFSET(bytes) \
-    ((((bytes)[3] & ~SCI01V_B3_RESFILE_MASK) << 24) \
-      | (((bytes)[2]) << 16) \
-      | (((bytes)[1]) << 8) \
-      | (((bytes)[0]) << 0))
-
-#define SCI1_B5_RESFILE_MASK 0xf0
-#define SCI1_B5_RESFILE_SHIFT 4
-
-#define SCI1_RESFILE_GET_FILE(bytes) \
-  (((bytes)[5] & SCI1_B5_RESFILE_MASK) >> SCI1_B5_RESFILE_SHIFT)
-
-#define SCI1_RESFILE_GET_OFFSET(bytes) \
-    ((((bytes)[5] & ~SCI1_B5_RESFILE_MASK) << 24) \
-      | (((bytes)[4]) << 16) \
-      | (((bytes)[3]) << 8) \
-      | (((bytes)[2]) << 0))
-
-#define SCI1_RESFILE_GET_NUMBER(bytes) \
-      ((((bytes)[1]) << 8) \
-      | (((bytes)[0]) << 0))
-
-#define SCI11_RESFILE_GET_OFFSET(bytes) \
-    ((((bytes)[4]) << 17) \
-      | (((bytes)[3]) << 9) \
-      | (((bytes)[2]) << 1))
-
 #endif
 
 

Modified: scummvm/trunk/engines/sci/scicore/resource.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/resource.cpp	2009-02-20 15:24:22 UTC (rev 38592)
+++ scummvm/trunk/engines/sci/scicore/resource.cpp	2009-02-20 15:41:58 UTC (rev 38593)
@@ -137,7 +137,7 @@
 /*-----------------------------*/
 
 void
-_scir_add_altsource(resource_t *res, resource_source_t *source, unsigned int file_offset) {
+_scir_add_altsource(resource_t *res, ResourceSource *source, unsigned int file_offset) {
 	resource_altsource_t *rsrc = (resource_altsource_t*)sci_malloc(sizeof(resource_altsource_t));
 
 	rsrc->next = res->alt_sources;
@@ -159,10 +159,10 @@
 /** Resource source list management **/
 /*-----------------------------------*/
 
-resource_source_t *
+ResourceSource *
 scir_add_external_map(ResourceManager *mgr, char *file_name) {
-	resource_source_t *newsrc = (resource_source_t *)
-	                            malloc(sizeof(resource_source_t));
+	ResourceSource *newsrc = (ResourceSource *)
+	                            malloc(sizeof(ResourceSource));
 
 	/* Add the new source to the SLL of sources */
 	newsrc->next = mgr->sources;
@@ -176,11 +176,11 @@
 	return newsrc;
 }
 
-resource_source_t *
-scir_add_volume(ResourceManager *mgr, resource_source_t *map, char *filename,
+ResourceSource *
+scir_add_volume(ResourceManager *mgr, ResourceSource *map, char *filename,
                 int number, int extended_addressing) {
-	resource_source_t *newsrc = (resource_source_t *)
-	                            malloc(sizeof(resource_source_t));
+	ResourceSource *newsrc = (ResourceSource *)
+	                            malloc(sizeof(ResourceSource));
 
 	/* Add the new source to the SLL of sources */
 	newsrc->next = mgr->sources;
@@ -194,10 +194,10 @@
 	return 0;
 }
 
-resource_source_t *
+ResourceSource *
 scir_add_patch_dir(ResourceManager *mgr, int type, char *dirname) {
-	resource_source_t *newsrc = (resource_source_t *)
-	                            malloc(sizeof(resource_source_t));
+	ResourceSource *newsrc = (ResourceSource *)
+	                            malloc(sizeof(ResourceSource));
 
 	/* Add the new source to the SLL of sources */
 	newsrc->next = mgr->sources;
@@ -209,9 +209,9 @@
 	return 0;
 }
 
-resource_source_t *
-scir_get_volume(ResourceManager *mgr, resource_source_t *map, int volume_nr) {
-	resource_source_t *seeker = mgr->sources;
+ResourceSource *
+scir_get_volume(ResourceManager *mgr, ResourceSource *map, int volume_nr) {
+	ResourceSource *seeker = mgr->sources;
 
 	while (seeker) {
 		if (seeker->source_type == RESSOURCE_TYPE_VOLUME &&
@@ -432,7 +432,7 @@
 	//char path_separator;
 	sci_dir_t dirent;
 	char *name;
-	resource_source_t *map;
+	ResourceSource *map;
 	int fd;
 	char fullname[MAXPATHLEN];
 
@@ -469,7 +469,7 @@
 }
 
 static int
-_scir_scan_new_sources(ResourceManager *mgr, int *detected_version, resource_source_t *source) {
+_scir_scan_new_sources(ResourceManager *mgr, int *detected_version, ResourceSource *source) {
 	int preset_version = mgr->sci_version;
 	int resource_error = 0;
 	int dummy = mgr->sci_version;
@@ -569,7 +569,7 @@
 }
 
 static void
-_scir_free_resource_sources(resource_source_t *rss) {
+_scir_free_resource_sources(ResourceSource *rss) {
 	if (rss) {
 		_scir_free_resource_sources(rss->next);
 		free(rss);

Modified: scummvm/trunk/engines/sci/scicore/resource_map.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/resource_map.cpp	2009-02-20 15:24:22 UTC (rev 38592)
+++ scummvm/trunk/engines/sci/scicore/resource_map.cpp	2009-02-20 15:41:58 UTC (rev 38593)
@@ -36,6 +36,57 @@
 #define SCI1_RESMAP_ENTRIES_SIZE 6
 #define SCI11_RESMAP_ENTRIES_SIZE 5
 
+/* Resource type encoding */
+#define SCI0_B1_RESTYPE_MASK  0xf8
+#define SCI0_B1_RESTYPE_SHIFT 3
+#define SCI0_B3_RESFILE_MASK  0xfc
+#define SCI0_B3_RESFILE_SHIFT 2
+#define SCI01V_B3_RESFILE_MASK  0xf0
+#define SCI01V_B3_RESFILE_SHIFT 4
+
+#define SCI0_RESID_GET_TYPE(bytes) \
+    (((bytes)[1] & SCI0_B1_RESTYPE_MASK) >> SCI0_B1_RESTYPE_SHIFT)
+#define SCI0_RESID_GET_NUMBER(bytes) \
+    ((((bytes)[1] & ~SCI0_B1_RESTYPE_MASK) << 8) | ((bytes)[0]))
+
+#define SCI0_RESFILE_GET_FILE(bytes) \
+    (((bytes)[3] & SCI0_B3_RESFILE_MASK) >> SCI0_B3_RESFILE_SHIFT)
+#define SCI0_RESFILE_GET_OFFSET(bytes) \
+    ((((bytes)[3] & ~SCI0_B3_RESFILE_MASK) << 24) \
+      | (((bytes)[2]) << 16) \
+      | (((bytes)[1]) << 8) \
+      | (((bytes)[0]) << 0))
+
+#define SCI01V_RESFILE_GET_FILE(bytes) \
+    (((bytes)[3] & SCI01V_B3_RESFILE_MASK) >> SCI01V_B3_RESFILE_SHIFT)
+#define SCI01V_RESFILE_GET_OFFSET(bytes) \
+    ((((bytes)[3] & ~SCI01V_B3_RESFILE_MASK) << 24) \
+      | (((bytes)[2]) << 16) \
+      | (((bytes)[1]) << 8) \
+      | (((bytes)[0]) << 0))
+
+#define SCI1_B5_RESFILE_MASK 0xf0
+#define SCI1_B5_RESFILE_SHIFT 4
+
+#define SCI1_RESFILE_GET_FILE(bytes) \
+  (((bytes)[5] & SCI1_B5_RESFILE_MASK) >> SCI1_B5_RESFILE_SHIFT)
+
+#define SCI1_RESFILE_GET_OFFSET(bytes) \
+    ((((bytes)[5] & ~SCI1_B5_RESFILE_MASK) << 24) \
+      | (((bytes)[4]) << 16) \
+      | (((bytes)[3]) << 8) \
+      | (((bytes)[2]) << 0))
+
+#define SCI1_RESFILE_GET_NUMBER(bytes) \
+      ((((bytes)[1]) << 8) \
+      | (((bytes)[0]) << 0))
+
+#define SCI11_RESFILE_GET_OFFSET(bytes) \
+    ((((bytes)[4]) << 17) \
+      | (((bytes)[3]) << 9) \
+      | (((bytes)[2]) << 1))
+
+
 static int
 detect_odd_sci01(int fh) {
 	byte buf[6];
@@ -73,7 +124,7 @@
 }
 
 static int
-sci_res_read_entry(ResourceManager *mgr, resource_source_t *map,
+sci_res_read_entry(ResourceManager *mgr, ResourceSource *map,
                    byte *buf, resource_t *res, int sci_version) {
 	res->id = buf[0] | (buf[1] << 8);
 	res->type = SCI0_RESID_GET_TYPE(buf);
@@ -149,7 +200,7 @@
 
 
 int
-sci0_read_resource_map(ResourceManager *mgr, resource_source_t *map, resource_t **resource_p, int *resource_nr_p, int *sci_version) {
+sci0_read_resource_map(ResourceManager *mgr, ResourceSource *map, resource_t **resource_p, int *resource_nr_p, int *sci_version) {
 	int fsize;
 	int fd;
 	resource_t *resources;
@@ -334,7 +385,7 @@
 }
 
 int
-sci1_read_resource_map(ResourceManager *mgr, resource_source_t *map, resource_source_t *vol,
+sci1_read_resource_map(ResourceManager *mgr, ResourceSource *map, ResourceSource *vol,
                        resource_t **resource_p, int *resource_nr_p, int *sci_version) {
 	int fsize;
 	int fd;

Modified: scummvm/trunk/engines/sci/scicore/resource_patch.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/resource_patch.cpp	2009-02-20 15:24:22 UTC (rev 38592)
+++ scummvm/trunk/engines/sci/scicore/resource_patch.cpp	2009-02-20 15:41:58 UTC (rev 38593)
@@ -39,7 +39,7 @@
 
 /* version-agnostic patch application */
 static void
-process_patch(resource_source_t *source,
+process_patch(ResourceSource *source,
               char *entry, int restype, int resnumber, resource_t **resource_p, int *resource_nr_p) {
 	int fsize;
 	char filename[MAXPATHLEN];
@@ -119,7 +119,7 @@
 
 
 int
-sci0_read_resource_patches(resource_source_t *source, resource_t **resource_p, int *resource_nr_p) {
+sci0_read_resource_patches(ResourceSource *source, resource_t **resource_p, int *resource_nr_p) {
 	sci_dir_t dir;
 	char *entry;
 	char *caller_cwd = sci_getcwd();
@@ -166,7 +166,7 @@
 }
 
 int
-sci1_read_resource_patches(resource_source_t *source, resource_t **resource_p, int *resource_nr_p) {
+sci1_read_resource_patches(ResourceSource *source, resource_t **resource_p, int *resource_nr_p) {
 	sci_dir_t dir;
 	char *entry;
 	char *caller_cwd = sci_getcwd();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list