mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-09-02 01:29:06 +00:00
riven: auto-generate qload.inc
This commit is contained in:
parent
942e670268
commit
88f3f33658
@ -250,3 +250,33 @@ distclean:
|
|||||||
cd disk40_files && make distclean
|
cd disk40_files && make distclean
|
||||||
cd disk43_files && make distclean
|
cd disk43_files && make distclean
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
generate_common: generate_common.o
|
||||||
|
$(CC) $(LFLAGS) -o generate_common generate_common.o
|
||||||
|
|
||||||
|
generate_common.o: generate_common.c
|
||||||
|
$(CC) $(CFLAGS) -c generate_common.c
|
||||||
|
|
||||||
|
####
|
||||||
|
|
||||||
|
#qload_start = $1800
|
||||||
|
|
||||||
|
#full_decomp = qload_start+$DB
|
||||||
|
#wait = qload_start+$161
|
||||||
|
#wait_50xms = qload_start+$16f
|
||||||
|
#draw_pointer = qload_start+$178
|
||||||
|
#save_bg_14x14 = qload_start+$44f
|
||||||
|
#handle_keypress = qload_start+$4b9
|
||||||
|
#change_location = qload_start+$5f9
|
||||||
|
|
||||||
|
|
||||||
|
qload.inc: generate_common QLOAD_01
|
||||||
|
./generate_common -a 0x1800 -s full_decomp qload_01.lst > qload.inc
|
||||||
|
./generate_common -a 0x1800 -s wait qload_01.lst >> qload.inc
|
||||||
|
./generate_common -a 0x1800 -s wait_50xms qload_01.lst >> qload.inc
|
||||||
|
./generate_common -a 0x1800 -s draw_pointer qload_01.lst >> qload.inc
|
||||||
|
./generate_common -a 0x1800 -s save_bg_14x14 qload_01.lst >> qload.inc
|
||||||
|
./generate_common -a 0x1800 -s handle_keypress qload_01.lst >> qload.inc
|
||||||
|
./generate_common -a 0x1800 -s change_location qload_01.lst >> qload.inc
|
||||||
|
|
||||||
|
77
games/riven_hgr/generate_common.c
Normal file
77
games/riven_hgr/generate_common.c
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static FILE *fff;
|
||||||
|
|
||||||
|
|
||||||
|
static void find_address(char *symbol_name, int routine_offset) {
|
||||||
|
|
||||||
|
unsigned int addr=0;
|
||||||
|
char string[BUFSIZ],*result;
|
||||||
|
char temp_name[BUFSIZ];
|
||||||
|
|
||||||
|
strncpy(temp_name,symbol_name,BUFSIZ);
|
||||||
|
strncat(temp_name,":",2);
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
|
||||||
|
result=fgets(string,BUFSIZ,fff);
|
||||||
|
if (result==NULL) {
|
||||||
|
fprintf(stderr,"Error: %s not found!\n",symbol_name);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
result=strstr(string,temp_name);
|
||||||
|
if (result!=NULL) {
|
||||||
|
string[6]=0;
|
||||||
|
sscanf(string,"%x",&addr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
printf("%s\t=$%04x\n",symbol_name,addr+routine_offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
|
int c;
|
||||||
|
char *filename;
|
||||||
|
char symbol[BUFSIZ];
|
||||||
|
int routine_offset=0xd000;
|
||||||
|
|
||||||
|
while ( (c=getopt(argc, argv, "a:s:") ) != -1) {
|
||||||
|
|
||||||
|
switch(c) {
|
||||||
|
|
||||||
|
case 'a':
|
||||||
|
routine_offset=strtol(optarg, NULL, 0);
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
strncpy(symbol,optarg,BUFSIZ-1);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stderr,"Unknown option %c\n",c);
|
||||||
|
exit(-1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
filename=strdup(argv[optind]);
|
||||||
|
|
||||||
|
fff=fopen(filename,"r");
|
||||||
|
if (fff==NULL) {
|
||||||
|
fprintf(stderr,"ERROR! could not open %s\n",filename);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
find_address(symbol,routine_offset);
|
||||||
|
|
||||||
|
fclose(fff);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
@ -1,12 +0,0 @@
|
|||||||
; TODO: autoate generating this
|
|
||||||
|
|
||||||
qload_start = $1800
|
|
||||||
|
|
||||||
full_decomp = qload_start+$DB
|
|
||||||
wait = qload_start+$161
|
|
||||||
wait_50xms = qload_start+$16f
|
|
||||||
draw_pointer = qload_start+$178
|
|
||||||
save_bg_14x14 = qload_start+$44f
|
|
||||||
handle_keypress = qload_start+$4b9
|
|
||||||
change_location = qload_start+$5f9
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user