Subversion Repositories Shiroi

Rev

Rev 20 | Rev 41 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 20 Rev 34
Line 1... Line 1...
1
/* $Id: main.c 20 2024-08-31 06:50:57Z nishi $ */
1
/* $Id: main.c 34 2024-09-01 10:13:47Z nishi $ */
2
 
2
 
3
#include <stdio.h>
3
#include <stdio.h>
4
#include <stdbool.h>
4
#include <stdbool.h>
5
#include <sys/stat.h>
5
#include <sys/stat.h>
6
#include <stdlib.h>
6
#include <stdlib.h>
Line 74... Line 74...
74
							}
74
							}
75
							printf("ROM size: %d\n", s.st_size);
75
							printf("ROM size: %d\n", s.st_size);
76
							FILE* f = fopen(line + j + 1, "rb");
76
							FILE* f = fopen(line + j + 1, "rb");
77
							fread(shiroi.ram, s.st_size, 1, f);
77
							fread(shiroi.ram, s.st_size, 1, f);
78
							fclose(f);
78
							fclose(f);
-
 
79
						} else if(strcmp(line, "romcard") == 0) {
-
 
80
							printf("ROMcard: %s\n", line + j + 1);
-
 
81
							if(stat(line + j + 1, &s) != 0) {
-
 
82
								fprintf(stderr, "ROM not found\n");
-
 
83
								free(ini);
-
 
84
								return 1;
-
 
85
							}
-
 
86
							printf("ROMcard size: %d\n", s.st_size);
-
 
87
							shiroi_card_t* card = shiroi_get_romcard_card(&shiroi);
-
 
88
							if(card != NULL) {
-
 
89
								FILE* f = fopen(line + j + 1, "rb");
-
 
90
								fread(card->romcard.data, s.st_size, 1, f);
-
 
91
								fclose(f);
-
 
92
							} else {
-
 
93
								fprintf(stderr, "ROMcard is not installed ; ignored\n");
-
 
94
							}
79
						} else if(line[0] == 's' && line[1] == 'l' && line[2] == 'o' && line[3] == 't') {
95
						} else if(line[0] == 's' && line[1] == 'l' && line[2] == 'o' && line[3] == 't') {
80
							int slot = atoi(line + 4);
96
							int slot = atoi(line + 4);
81
							const char* n = "";
97
							const char* n = "";
82
							int dev = -1;
98
							int dev = -1;
83
							if(strcmp(line + j + 1, "video_mark_1") == 0) {
99
							if(strcmp(line + j + 1, "video_mark_1") == 0) {
Line 96... Line 112...
96
								dev = SHIROI_TEXT_MARK_I;
112
								dev = SHIROI_TEXT_MARK_I;
97
								n = "Text Mark I";
113
								n = "Text Mark I";
98
							} else if(strcmp(line + j + 1, "debug") == 0) {
114
							} else if(strcmp(line + j + 1, "debug") == 0) {
99
								dev = SHIROI_DEBUG;
115
								dev = SHIROI_DEBUG;
100
								n = "Debug";
116
								n = "Debug";
-
 
117
							} else if(strcmp(line + j + 1, "romcard_mark_1") == 0) {
-
 
118
								dev = SHIROI_ROMCARD_MARK_I;
-
 
119
								n = "ROMcard Mark I";
101
							}
120
							}
102
							if(dev == -1) {
121
							if(dev == -1) {
103
								fprintf(stderr, "No such device called `%s' ; ignoring\n", line + j + 1);
122
								fprintf(stderr, "No such device called `%s' ; ignoring\n", line + j + 1);
104
							} else {
123
							} else {
105
								shiroi_install(&shiroi, slot, dev);
124
								shiroi_install(&shiroi, slot, dev);