comparison blastem.c @ 340:58a085cfc6bd

Set window title based on ROM header name
author Mike Pavone <pavone@retrodev.com>
date Wed, 15 May 2013 23:32:21 -0700
parents 5c34a9c39394
children 6ad8e36de685
comparison
equal deleted inserted replaced
339:80d934369fd5 340:58a085cfc6bd
1021 insert_breakpoint(&context, address, (uint8_t *)debugger); 1021 insert_breakpoint(&context, address, (uint8_t *)debugger);
1022 } 1022 }
1023 m68k_reset(&context); 1023 m68k_reset(&context);
1024 } 1024 }
1025 1025
1026 char title[64];
1027
1028 #define TITLE_START 0x150
1029 #define TITLE_END (TITLE_START+48)
1030
1031 void update_title()
1032 {
1033 uint16_t *last = cart + TITLE_END/2 - 1;
1034 while(last > cart + TITLE_START/2 && *last == 0x2020)
1035 {
1036 last--;
1037 }
1038 uint16_t *start = cart + TITLE_START/2;
1039 char *cur = title;
1040 char last_char = ' ';
1041 for (; start != last; start++)
1042 {
1043 if ((last_char != ' ' || (*start >> 8) != ' ') && (*start >> 8) < 0x80) {
1044 *(cur++) = *start >> 8;
1045 last_char = *start >> 8;
1046 }
1047 if (last_char != ' ' || (*start & 0xFF) != ' ' && (*start & 0xFF) < 0x80) {
1048 *(cur++) = *start;
1049 last_char = *start & 0xFF;
1050 }
1051 }
1052 *(cur++) = *start >> 8;
1053 if ((*start & 0xFF) != ' ') {
1054 *(cur++) = *start;
1055 }
1056 strcpy(cur, " - BlastEm");
1057 }
1058
1026 int main(int argc, char ** argv) 1059 int main(int argc, char ** argv)
1027 { 1060 {
1028 if (argc < 2) { 1061 if (argc < 2) {
1029 fputs("Usage: blastem FILENAME\n", stderr); 1062 fputs("Usage: blastem FILENAME\n", stderr);
1030 return 1; 1063 return 1;
1063 width = atoi(argv[i]); 1096 width = atoi(argv[i]);
1064 } else if (height < 0) { 1097 } else if (height < 0) {
1065 height = atoi(argv[i]); 1098 height = atoi(argv[i]);
1066 } 1099 }
1067 } 1100 }
1101 update_title();
1068 width = width < 320 ? 320 : width; 1102 width = width < 320 ? 320 : width;
1069 height = height < 240 ? (width/320) * 240 : height; 1103 height = height < 240 ? (width/320) * 240 : height;
1070 if (!headless) { 1104 if (!headless) {
1071 render_init(width, height); 1105 render_init(width, height, title);
1072 } 1106 }
1073 vdp_context v_context; 1107 vdp_context v_context;
1074 1108
1075 init_vdp_context(&v_context); 1109 init_vdp_context(&v_context);
1076 1110