Hey again,
After looking at the linker code, i noticed that a dummy RNAM (room
names) chunk was being written in the index file. From what i can tell,
the room names are omitted from more or less all V6+ games (i guess
either the developers didn't want people finding the end game room, or
maybe it was just a space saving initiative).
In any case, the attached patch should add support for writing RNAM
chunks provided you pass the along "-write-room-names" to the linker
when building.
Note that i don't know if all LEC interpreters will read this chunk data
correctly as there is always the possibility that the format was changed
between V5 and V8 - something which SCUMM hackers are unlikely to track
if the data isn't present in the first place.
Regards,
- James S Urquhart
Index: scc_ld.c
===================================================================
--- scc_ld.c (revision 264)
+++ scc_ld.c (working copy)
@@ -1161,7 +1161,7 @@
int scc_ld_write_idx(scc_ld_room_t* room, scc_fd_t* fd,
int local_n,int array_n,int flobj_n,
- int inv_n) {
+ int inv_n, int write_room_names) {
int room_n = 0,scr_n = scc_ns_res_max(scc_ns,SCC_RES_SCR) + 1;
int chset_n = scc_ns_res_max(scc_ns,SCC_RES_CHSET) + 1;
int obj_n = scc_ns_res_max(scc_ns,SCC_RES_OBJ) + 1;
@@ -1170,6 +1170,7 @@
int var_n = scc_ns_res_max(scc_ns,SCC_RES_VAR)+1;
int bvar_n = scc_ns_res_max(scc_ns,SCC_RES_BVAR)+1;
int i;
+ char rnam_buf[10];
scc_ld_room_t* r;
@@ -1184,9 +1185,30 @@
bvar_n = ((bvar_n+7)/8)*8;
scc_fd_w32(fd,MKID('R','N','A','M'));
- scc_fd_w32be(fd,8 + 1);
- scc_fd_w8(fd,0);
+ if (write_room_names)
+ {
+ // NOTE: ScummVM uses a different codepath for HE v8 games as the format
+ // is slightly different. But for now we will just implement
+ // this format.
+ scc_fd_w32be(fd, 8 + ((room_n-1)*10) + 1);
+
+ for (r = room ; r ; r = r->next)
+ {
+ scc_fd_w8(fd, r->sym->addr);
+ strncpy(rnam_buf, r->sym->sym, 9);
+ for (i=0; i<10; i++)
+ rnam_buf[i] ^= 0xFF;
+ scc_fd_write(fd, rnam_buf, 9);
+ }
+ scc_fd_w8(fd, 0);
+ }
+ else
+ {
+ scc_fd_w32be(fd,8 + 1);
+ scc_fd_w8(fd,0);
+ }
+
scc_fd_w32(fd,MKID('M','A','X','S'));
scc_fd_w32be(fd,8 + 15*2);
@@ -1274,12 +1296,13 @@
}
static void usage(char* prog) {
- scc_log(LOG_MSG,"Usage: %s [-o basename] [-rooms] input.roobj [file2.roobj ...]\n",prog);
+ scc_log(LOG_MSG,"Usage: %s [-o basename] [-rooms] [-write-room-names] input.roobj [file2.roobj ...]\n",prog);
exit(-1);
}
static char* out_file = NULL;
static int dump_rooms = 0;
+static int write_room_names = 0;
static int enckey = 0;
static int max_local = 200;
static int max_array = 100;
@@ -1297,6 +1320,7 @@
{ "max-inventory", SCC_PARAM_INT, 0, 0xFFFF, &max_inventory },
{ "v", SCC_PARAM_FLAG, LOG_MSG, LOG_V, &scc_log_level },
{ "vv", SCC_PARAM_FLAG, LOG_MSG, LOG_DBG, &scc_log_level },
+ { "write-room-names", SCC_PARAM_FLAG, 0, 1, &write_room_names },
{ NULL, 0, 0, 0, NULL }
};
@@ -1423,7 +1447,7 @@
scc_log(LOG_ERR,"Failed to open file %s\n",name);
return 5;
}
- if(!scc_ld_write_idx(scc_room,fd,max_local,max_array,max_flobj,max_inventory)) {
+ if(!scc_ld_write_idx(scc_room,fd,max_local,max_array,max_flobj,max_inventory, write_room_names)) {
scc_log(LOG_ERR,"Failed to write index file.\n");
return 6;
}
_______________________________________________
ScummC-general mailing list
[email protected]
https://mail.gna.org/listinfo/scummc-general