annotate system/system_config.cc @ 47:5f548e5957a8

* get rid of the "deprecated conversion from string constant to ‘char*’" warnings
author thib
date Wed, 15 Apr 2009 20:26:32 +0000
parents 651237260724
children ed6c21dde840
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
223b71206888 Initial import
thib
parents:
diff changeset
1 /* system_config.cc
223b71206888 Initial import
thib
parents:
diff changeset
2 * gameexe.ini ¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß
223b71206888 Initial import
thib
parents:
diff changeset
3 */
223b71206888 Initial import
thib
parents:
diff changeset
4
223b71206888 Initial import
thib
parents:
diff changeset
5 /*
223b71206888 Initial import
thib
parents:
diff changeset
6 *
223b71206888 Initial import
thib
parents:
diff changeset
7 * Copyright (C) 2000- Kazunori Ueno(JAGARL) <jagarl@creator.club.ne.jp>
223b71206888 Initial import
thib
parents:
diff changeset
8 *
223b71206888 Initial import
thib
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
223b71206888 Initial import
thib
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
223b71206888 Initial import
thib
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
223b71206888 Initial import
thib
parents:
diff changeset
12 * (at your option) any later version.
223b71206888 Initial import
thib
parents:
diff changeset
13 *
223b71206888 Initial import
thib
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
223b71206888 Initial import
thib
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
223b71206888 Initial import
thib
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
223b71206888 Initial import
thib
parents:
diff changeset
17 * GNU General Public License for more details.
223b71206888 Initial import
thib
parents:
diff changeset
18 *
27
3a6aaeab7b4e * Fixed a typo in Jagarl's name
thib
parents: 26
diff changeset
19 * You should have received a copy of the GNU General Public License along
3a6aaeab7b4e * Fixed a typo in Jagarl's name
thib
parents: 26
diff changeset
20 * with this program; if not, write to the Free Software Foundation, Inc.,
3a6aaeab7b4e * Fixed a typo in Jagarl's name
thib
parents: 26
diff changeset
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
0
223b71206888 Initial import
thib
parents:
diff changeset
22 *
223b71206888 Initial import
thib
parents:
diff changeset
23 */
223b71206888 Initial import
thib
parents:
diff changeset
24
223b71206888 Initial import
thib
parents:
diff changeset
25 #include <stdio.h>
223b71206888 Initial import
thib
parents:
diff changeset
26 #include <string.h>
223b71206888 Initial import
thib
parents:
diff changeset
27 #include <stdlib.h>
223b71206888 Initial import
thib
parents:
diff changeset
28 #include <stdarg.h>
223b71206888 Initial import
thib
parents:
diff changeset
29 #include <ctype.h>
223b71206888 Initial import
thib
parents:
diff changeset
30 #include <map>
223b71206888 Initial import
thib
parents:
diff changeset
31 #include <string>
223b71206888 Initial import
thib
parents:
diff changeset
32 #include "system_config.h"
223b71206888 Initial import
thib
parents:
diff changeset
33 #include "../system/file.h"
223b71206888 Initial import
thib
parents:
diff changeset
34
223b71206888 Initial import
thib
parents:
diff changeset
35 using namespace std;
223b71206888 Initial import
thib
parents:
diff changeset
36
223b71206888 Initial import
thib
parents:
diff changeset
37 // #define DEBUG_CONFIG
223b71206888 Initial import
thib
parents:
diff changeset
38 #ifdef DEBUG_CONFIG
223b71206888 Initial import
thib
parents:
diff changeset
39 # define dprintf(X) printf X
223b71206888 Initial import
thib
parents:
diff changeset
40 #else
223b71206888 Initial import
thib
parents:
diff changeset
41 # define dprintf(X)
223b71206888 Initial import
thib
parents:
diff changeset
42 #endif /* DEBUG_CONFIG */
223b71206888 Initial import
thib
parents:
diff changeset
43
223b71206888 Initial import
thib
parents:
diff changeset
44 #define MAXTOKEN 10 /* = ¤Ç¶èÀÚ¤é¤ì¤¿Îΰè¤ÎºÇÂç¿ô */
223b71206888 Initial import
thib
parents:
diff changeset
45 #define MAXVARS 32 /* , ¤Ç¶èÀÚ¤é¤ì¤¿¿ôÃͤκÇÂç¿ô */
223b71206888 Initial import
thib
parents:
diff changeset
46
223b71206888 Initial import
thib
parents:
diff changeset
47 // ½é´ü²½¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß
223b71206888 Initial import
thib
parents:
diff changeset
48 /* config ¤Ï ʸ»úÎ󡢿ôÎ󡢤½¤ÎÊ£¹ç¤Ê¤É¡¢¤¤¤í¤¤¤í¤Ê·Á¼°¤¬¤¢¤ê¤¦¤ë */
223b71206888 Initial import
thib
parents:
diff changeset
49 /* ʸ»úÎó¤È¿ôÎó¤Ï°ìÈÌ¤Ë AyuSys_Config ¥¯¥é¥¹¤Ë´Þ¤á¤ë */
223b71206888 Initial import
thib
parents:
diff changeset
50
223b71206888 Initial import
thib
parents:
diff changeset
51
223b71206888 Initial import
thib
parents:
diff changeset
52 /**********************************************************/
223b71206888 Initial import
thib
parents:
diff changeset
53 /* ¤È¤ê¤¢¤¨¤º¥Ï¥Ã¥·¥åÈæ³ÓÉÕ¤­Ê¸»úÎó */
223b71206888 Initial import
thib
parents:
diff changeset
54 class HashStr {
223b71206888 Initial import
thib
parents:
diff changeset
55 const char* str;
223b71206888 Initial import
thib
parents:
diff changeset
56 unsigned int hash;
223b71206888 Initial import
thib
parents:
diff changeset
57 public:
223b71206888 Initial import
thib
parents:
diff changeset
58 HashStr(const char*);
223b71206888 Initial import
thib
parents:
diff changeset
59 HashStr(const HashStr& orig);
223b71206888 Initial import
thib
parents:
diff changeset
60 ~HashStr() {
223b71206888 Initial import
thib
parents:
diff changeset
61 if (str) delete[] str;
223b71206888 Initial import
thib
parents:
diff changeset
62 }
223b71206888 Initial import
thib
parents:
diff changeset
63 const char* c_str(void) const { return str; }
223b71206888 Initial import
thib
parents:
diff changeset
64 friend inline int operator<(const HashStr& a, const HashStr& b) {
223b71206888 Initial import
thib
parents:
diff changeset
65 if (a.hash == b.hash) {
223b71206888 Initial import
thib
parents:
diff changeset
66 if (a.str == 0) return 1;
223b71206888 Initial import
thib
parents:
diff changeset
67 else if (b.str == 0) return 0;
223b71206888 Initial import
thib
parents:
diff changeset
68 else return strcmp(a.str, b.str);
223b71206888 Initial import
thib
parents:
diff changeset
69 }
223b71206888 Initial import
thib
parents:
diff changeset
70 else return a.hash < b.hash;
223b71206888 Initial import
thib
parents:
diff changeset
71 }
223b71206888 Initial import
thib
parents:
diff changeset
72 };
223b71206888 Initial import
thib
parents:
diff changeset
73 HashStr::HashStr(const char* s ) {
223b71206888 Initial import
thib
parents:
diff changeset
74 if (s == 0 || s[0] == '\0') {
223b71206888 Initial import
thib
parents:
diff changeset
75 str = 0; hash = 0; return; /* invalid string */
223b71206888 Initial import
thib
parents:
diff changeset
76 }
223b71206888 Initial import
thib
parents:
diff changeset
77 char* new_str = new char[strlen(s)+1];
223b71206888 Initial import
thib
parents:
diff changeset
78 strcpy(new_str, s);
223b71206888 Initial import
thib
parents:
diff changeset
79 str = new_str;
223b71206888 Initial import
thib
parents:
diff changeset
80 /* calc hash... ŬÅö */
223b71206888 Initial import
thib
parents:
diff changeset
81 int h = strlen(s);
223b71206888 Initial import
thib
parents:
diff changeset
82 while(*s != 0) {
223b71206888 Initial import
thib
parents:
diff changeset
83 h = *s + ((h * (0x9449+*s))>>7);
223b71206888 Initial import
thib
parents:
diff changeset
84 s++;
223b71206888 Initial import
thib
parents:
diff changeset
85 }
223b71206888 Initial import
thib
parents:
diff changeset
86 hash = (unsigned int)h;
223b71206888 Initial import
thib
parents:
diff changeset
87 }
223b71206888 Initial import
thib
parents:
diff changeset
88 HashStr::HashStr(const HashStr& orig) {
223b71206888 Initial import
thib
parents:
diff changeset
89 if (orig.str == 0 || orig.str[0] == '\0') {
223b71206888 Initial import
thib
parents:
diff changeset
90 str = 0; hash = 0; return; /* invalid */
223b71206888 Initial import
thib
parents:
diff changeset
91 }
223b71206888 Initial import
thib
parents:
diff changeset
92 char* new_str = new char[strlen(orig.str)+1];
223b71206888 Initial import
thib
parents:
diff changeset
93 strcpy(new_str, orig.str);
223b71206888 Initial import
thib
parents:
diff changeset
94 str = new_str;
223b71206888 Initial import
thib
parents:
diff changeset
95 hash = orig.hash;
223b71206888 Initial import
thib
parents:
diff changeset
96 }
223b71206888 Initial import
thib
parents:
diff changeset
97
223b71206888 Initial import
thib
parents:
diff changeset
98 /**********************************************************
223b71206888 Initial import
thib
parents:
diff changeset
99 **AyuSys_Config_[String | Intlist] :
223b71206888 Initial import
thib
parents:
diff changeset
100 ** ÀßÄê¤ÎËÜÂÎ
223b71206888 Initial import
thib
parents:
diff changeset
101 ** original : ¸µÀßÄê
223b71206888 Initial import
thib
parents:
diff changeset
102 ** old_data : Á°²ó ClearDiff() ¤·¤¿¤È¤­¤ÎÀßÄê
223b71206888 Initial import
thib
parents:
diff changeset
103 ** new_data : ClearDiff() °Ê¹ß¤ËÀßÄꤷ¤¿ÆâÍƤòÊݸ
223b71206888 Initial import
thib
parents:
diff changeset
104 ** ¥Ç¡¼¥¿ÀßÄꡧ
223b71206888 Initial import
thib
parents:
diff changeset
105 ** Init() : ¸µÀßÄê¤òºîÀ®
223b71206888 Initial import
thib
parents:
diff changeset
106 ** Set() : ÀßÄê¤òÊѹ¹
223b71206888 Initial import
thib
parents:
diff changeset
107 ** Get() : ºÇ¤â¿·¤·¤¤ÀßÄê¤òÆÀ¤ë
223b71206888 Initial import
thib
parents:
diff changeset
108 **
223b71206888 Initial import
thib
parents:
diff changeset
109 ** Êѹ¹¤Îµ­Ï¿¡§
223b71206888 Initial import
thib
parents:
diff changeset
110 ** Diff() : Á°²ó¤ÎClearDiff() ¤«¤éÊѹ¹¤·¤¿ÆâÍƤòÆÀ¤ë
223b71206888 Initial import
thib
parents:
diff changeset
111 ** DiffLen() : Diff() ¤ÇɬÍפÊʸ»úÎóŤòÆÀ¤ë
223b71206888 Initial import
thib
parents:
diff changeset
112 ** ClearDiff() : Êѹ¹µ­Ï¿¤ò¾Ã¤¹
223b71206888 Initial import
thib
parents:
diff changeset
113 ** PatchOld() : Diff() ¤ÇÆÀ¤¿µ­Ï¿¤Ë´ð¤Å¤­¡¢Êѹ¹Á°¤Î¾õÂÖ¤ËÌ᤹
223b71206888 Initial import
thib
parents:
diff changeset
114 ** PatchNew() : Diff() ¤ÇÆÀ¤¿µ­Ï¿¤Ë´ð¤Å¤­¡¢Êѹ¹¸å¤Î¾õÂÖ¤ËÌ᤹
223b71206888 Initial import
thib
parents:
diff changeset
115 **
223b71206888 Initial import
thib
parents:
diff changeset
116 ** ¸µÀßÄ꤫¤é¤ÎÊѹ¹¤Îµ­Ï¿¡§
223b71206888 Initial import
thib
parents:
diff changeset
117 ** SetOriginal() : ¸µÀßÄê¤ËÌ᤹
223b71206888 Initial import
thib
parents:
diff changeset
118 ** DiffOriginal() : ¸µÀßÄ꤫¤é¸½ºß¤ÎÀßÄê¤ÎÊѹ¹¤òÆÀ¤ë
223b71206888 Initial import
thib
parents:
diff changeset
119 ** DiffOriginalLen() : DiffOriginal() ¤ÇɬÍפÊʸ»úÎóŤòÆÀ¤ë
223b71206888 Initial import
thib
parents:
diff changeset
120 ** PatchOriginal() : DiffOriginal() ¤ÇÆÀ¤¿µ­Ï¿¤Ë´ð¤Å¤­¡¢ÀßÄê¤òÉüµì¤¹¤ë
223b71206888 Initial import
thib
parents:
diff changeset
121 */
223b71206888 Initial import
thib
parents:
diff changeset
122
223b71206888 Initial import
thib
parents:
diff changeset
123 /************************************************
223b71206888 Initial import
thib
parents:
diff changeset
124 ** AyuSysConfigStringItem
223b71206888 Initial import
thib
parents:
diff changeset
125 ** ʸ»úÎó¤ò¥Ç¡¼¥¿¤È¤·¤Æ¤â¤ÄÀßÄê¹àÌÜ
223b71206888 Initial import
thib
parents:
diff changeset
126 */
223b71206888 Initial import
thib
parents:
diff changeset
127 class AyuSysConfigStringItem {
223b71206888 Initial import
thib
parents:
diff changeset
128 char* original_data;
223b71206888 Initial import
thib
parents:
diff changeset
129 char* old_data;
223b71206888 Initial import
thib
parents:
diff changeset
130 char* new_data;
223b71206888 Initial import
thib
parents:
diff changeset
131 public:
223b71206888 Initial import
thib
parents:
diff changeset
132 AyuSysConfigStringItem(void) {
223b71206888 Initial import
thib
parents:
diff changeset
133 original_data = 0;
223b71206888 Initial import
thib
parents:
diff changeset
134 old_data = 0;
223b71206888 Initial import
thib
parents:
diff changeset
135 new_data = 0;
223b71206888 Initial import
thib
parents:
diff changeset
136 }
223b71206888 Initial import
thib
parents:
diff changeset
137 AyuSysConfigStringItem(const AyuSysConfigStringItem& o) {
223b71206888 Initial import
thib
parents:
diff changeset
138 original_data = 0; old_data = 0; new_data = 0;
223b71206888 Initial import
thib
parents:
diff changeset
139 if (o.original_data) {
223b71206888 Initial import
thib
parents:
diff changeset
140 original_data = new char[strlen(o.original_data)+1];
223b71206888 Initial import
thib
parents:
diff changeset
141 strcpy(original_data, o.original_data);
223b71206888 Initial import
thib
parents:
diff changeset
142 }
223b71206888 Initial import
thib
parents:
diff changeset
143 if (o.old_data) {
223b71206888 Initial import
thib
parents:
diff changeset
144 old_data = new char[strlen(o.old_data)+1];
223b71206888 Initial import
thib
parents:
diff changeset
145 strcpy(old_data, o.old_data);
223b71206888 Initial import
thib
parents:
diff changeset
146 }
223b71206888 Initial import
thib
parents:
diff changeset
147 if (o.new_data) {
223b71206888 Initial import
thib
parents:
diff changeset
148 new_data = new char[strlen(o.new_data)+1];
223b71206888 Initial import
thib
parents:
diff changeset
149 strcpy(new_data, o.new_data);
223b71206888 Initial import
thib
parents:
diff changeset
150 }
223b71206888 Initial import
thib
parents:
diff changeset
151 }
223b71206888 Initial import
thib
parents:
diff changeset
152 /* ÀßÄꡧInit ¤Ç½é´ü²½¡¢Set ¤ÇÊѹ¹¡¢Get ¤ÇÊѹ¹¤òÍ¥À褷¤Æ¼è¤ê½Ð¤¹ */
223b71206888 Initial import
thib
parents:
diff changeset
153 void Init(int deal, const char* str) { /* deal ¤Ï̵»ë */
223b71206888 Initial import
thib
parents:
diff changeset
154 if (original_data) delete[] original_data;
223b71206888 Initial import
thib
parents:
diff changeset
155 int len = strlen(str);
223b71206888 Initial import
thib
parents:
diff changeset
156 original_data = new char[len+1];
223b71206888 Initial import
thib
parents:
diff changeset
157 strcpy(original_data, str);
223b71206888 Initial import
thib
parents:
diff changeset
158 original_data[len] = '\0';
223b71206888 Initial import
thib
parents:
diff changeset
159 }
223b71206888 Initial import
thib
parents:
diff changeset
160 void Set(int deal, const char* str) { /* deal ¤Ï̵»ë */
223b71206888 Initial import
thib
parents:
diff changeset
161 if (new_data) delete[] new_data;
223b71206888 Initial import
thib
parents:
diff changeset
162 int len = strlen(str);
223b71206888 Initial import
thib
parents:
diff changeset
163 new_data = new char[len+1];
223b71206888 Initial import
thib
parents:
diff changeset
164 strcpy(new_data, str);
223b71206888 Initial import
thib
parents:
diff changeset
165 new_data[len] = '\0';
223b71206888 Initial import
thib
parents:
diff changeset
166 }
223b71206888 Initial import
thib
parents:
diff changeset
167 const char* Get(int deal) const {/* deal ¤Ï̵»ë */
223b71206888 Initial import
thib
parents:
diff changeset
168 if (new_data) return new_data;
223b71206888 Initial import
thib
parents:
diff changeset
169 else if (old_data) return old_data;
223b71206888 Initial import
thib
parents:
diff changeset
170 return original_data;
223b71206888 Initial import
thib
parents:
diff changeset
171 }
223b71206888 Initial import
thib
parents:
diff changeset
172 const char* GetOriginal(int deal) const {
223b71206888 Initial import
thib
parents:
diff changeset
173 return original_data;
223b71206888 Initial import
thib
parents:
diff changeset
174 }
223b71206888 Initial import
thib
parents:
diff changeset
175 int Deal(void) const {
223b71206888 Initial import
thib
parents:
diff changeset
176 return 1;
223b71206888 Initial import
thib
parents:
diff changeset
177 }
223b71206888 Initial import
thib
parents:
diff changeset
178 /* ¥ª¥ê¥¸¥Ê¥ë¤«¤é¤ÎÊѲ½¤ÎÄ´ºº :
223b71206888 Initial import
thib
parents:
diff changeset
179 ** DiffOriginal ¤ÇÊѲ½¤òʸ»úÎó¤Ç¼è¤ê½Ð¤·¡¢PatchOriginal ¤Ç
223b71206888 Initial import
thib
parents:
diff changeset
180 ** ÊѲ½¤òÈ¿±Ç
223b71206888 Initial import
thib
parents:
diff changeset
181 */
223b71206888 Initial import
thib
parents:
diff changeset
182 int DiffOriginalLen(void) {
223b71206888 Initial import
thib
parents:
diff changeset
183 if (new_data == 0) return 0;
223b71206888 Initial import
thib
parents:
diff changeset
184 return strlen(new_data)+1;
223b71206888 Initial import
thib
parents:
diff changeset
185 }
223b71206888 Initial import
thib
parents:
diff changeset
186 void DiffOriginal(string& data) {
223b71206888 Initial import
thib
parents:
diff changeset
187 if (new_data == 0) { /* ¤¢¤êÆÀ¤Ê¤¤ */
223b71206888 Initial import
thib
parents:
diff changeset
188 fprintf(stderr,"AyuSysConfigStringItem::DiffOriginal : this method must not called if not required!\n");
223b71206888 Initial import
thib
parents:
diff changeset
189 return;
223b71206888 Initial import
thib
parents:
diff changeset
190 }
223b71206888 Initial import
thib
parents:
diff changeset
191 char* out_data = new char[strlen(new_data)*2+1];
223b71206888 Initial import
thib
parents:
diff changeset
192 char* buf = out_data;
223b71206888 Initial import
thib
parents:
diff changeset
193 int i;
223b71206888 Initial import
thib
parents:
diff changeset
194 for (i=0; new_data[i]!=0; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
195 switch(new_data[i]) {
223b71206888 Initial import
thib
parents:
diff changeset
196 case '?': *buf++ = '?'; *buf++ = '0'; break;
223b71206888 Initial import
thib
parents:
diff changeset
197 case '"': *buf++ = '?'; *buf++ = '1'; break;
223b71206888 Initial import
thib
parents:
diff changeset
198 case '\'': *buf++ = '?'; *buf++ = '2'; break;
223b71206888 Initial import
thib
parents:
diff changeset
199 case ',': *buf++ = '?'; *buf++ = '3'; break;
223b71206888 Initial import
thib
parents:
diff changeset
200 case '.': *buf++ = '?'; *buf++ = '4'; break;
223b71206888 Initial import
thib
parents:
diff changeset
201 case ':': *buf++ = '?'; *buf++ = '5'; break;
223b71206888 Initial import
thib
parents:
diff changeset
202 case ';': *buf++ = '?'; *buf++ = '6'; break;
223b71206888 Initial import
thib
parents:
diff changeset
203 case '=': *buf++ = '?'; *buf++ = '7'; break;
223b71206888 Initial import
thib
parents:
diff changeset
204 case '<': *buf++ = '?'; *buf++ = '8'; break;
223b71206888 Initial import
thib
parents:
diff changeset
205 case '>': *buf++ = '?'; *buf++ = '9'; break;
223b71206888 Initial import
thib
parents:
diff changeset
206 default: *buf++ = new_data[i]; break;
223b71206888 Initial import
thib
parents:
diff changeset
207 }
223b71206888 Initial import
thib
parents:
diff changeset
208 }
223b71206888 Initial import
thib
parents:
diff changeset
209 *buf++ = 0;
223b71206888 Initial import
thib
parents:
diff changeset
210 data += out_data;
223b71206888 Initial import
thib
parents:
diff changeset
211 delete[] out_data;
223b71206888 Initial import
thib
parents:
diff changeset
212 return;
223b71206888 Initial import
thib
parents:
diff changeset
213 }
223b71206888 Initial import
thib
parents:
diff changeset
214 const char* PatchOriginal(const char* data) {
47
5f548e5957a8 * get rid of the "deprecated conversion from string constant to ‘char*’" warnings
thib
parents: 40
diff changeset
215 static const char* table = "?\"',.:;=<>";
0
223b71206888 Initial import
thib
parents:
diff changeset
216 if (new_data) delete[] new_data;
223b71206888 Initial import
thib
parents:
diff changeset
217 if (old_data) delete[] old_data;
223b71206888 Initial import
thib
parents:
diff changeset
218 new_data = 0; old_data = 0;
223b71206888 Initial import
thib
parents:
diff changeset
219 new_data = new char[1024];
223b71206888 Initial import
thib
parents:
diff changeset
220 int i,j = 0;
223b71206888 Initial import
thib
parents:
diff changeset
221 for (i=0; i<1020; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
222 switch(data[j]) {
223b71206888 Initial import
thib
parents:
diff changeset
223 case '?':
223b71206888 Initial import
thib
parents:
diff changeset
224 if (data[j+1] >= '0' && data[j+1] <= '9') {
223b71206888 Initial import
thib
parents:
diff changeset
225 new_data[i] = table[ data[j+1] - '0'];
223b71206888 Initial import
thib
parents:
diff changeset
226 j += 2;
223b71206888 Initial import
thib
parents:
diff changeset
227 break;
223b71206888 Initial import
thib
parents:
diff changeset
228 }
223b71206888 Initial import
thib
parents:
diff changeset
229 case '"': case '\'': case ',': case '.': case ':':
223b71206888 Initial import
thib
parents:
diff changeset
230 case ';': case '=': case '<': case '>':
223b71206888 Initial import
thib
parents:
diff changeset
231 goto for_end;
223b71206888 Initial import
thib
parents:
diff changeset
232 default: new_data[i] = data[j++]; break;
223b71206888 Initial import
thib
parents:
diff changeset
233 }
223b71206888 Initial import
thib
parents:
diff changeset
234 }
223b71206888 Initial import
thib
parents:
diff changeset
235 for_end:
223b71206888 Initial import
thib
parents:
diff changeset
236 new_data[i] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
237 return data;
223b71206888 Initial import
thib
parents:
diff changeset
238 }
223b71206888 Initial import
thib
parents:
diff changeset
239 void SetOriginal(void) {
223b71206888 Initial import
thib
parents:
diff changeset
240 if (new_data) delete[] new_data;
223b71206888 Initial import
thib
parents:
diff changeset
241 if (old_data) delete[] old_data;
223b71206888 Initial import
thib
parents:
diff changeset
242 new_data = 0; old_data = 0;
223b71206888 Initial import
thib
parents:
diff changeset
243 }
223b71206888 Initial import
thib
parents:
diff changeset
244 void Dump(FILE* f) const {
223b71206888 Initial import
thib
parents:
diff changeset
245 if (original_data) fprintf(f, "original %s ",original_data);
223b71206888 Initial import
thib
parents:
diff changeset
246 if (old_data) fprintf(f, "old_data %s ",old_data);
223b71206888 Initial import
thib
parents:
diff changeset
247 if (new_data) fprintf(f, "new_data %s ",new_data);
223b71206888 Initial import
thib
parents:
diff changeset
248 fprintf(f, "\n");
223b71206888 Initial import
thib
parents:
diff changeset
249 }
223b71206888 Initial import
thib
parents:
diff changeset
250 };
223b71206888 Initial import
thib
parents:
diff changeset
251
223b71206888 Initial import
thib
parents:
diff changeset
252 /************************************************
223b71206888 Initial import
thib
parents:
diff changeset
253 ** AyuSysConfigIntlistItem
223b71206888 Initial import
thib
parents:
diff changeset
254 ** ¿ôÃÍÎó¤ò¥Ç¡¼¥¿¤È¤·¤Æ¤â¤ÄÀßÄê¹àÌÜ
223b71206888 Initial import
thib
parents:
diff changeset
255 */
223b71206888 Initial import
thib
parents:
diff changeset
256 class AyuSysConfigIntlistItem {
223b71206888 Initial import
thib
parents:
diff changeset
257 int item_deal;
223b71206888 Initial import
thib
parents:
diff changeset
258 int* original_data;
223b71206888 Initial import
thib
parents:
diff changeset
259 int* old_data;
223b71206888 Initial import
thib
parents:
diff changeset
260 int* new_data;
223b71206888 Initial import
thib
parents:
diff changeset
261 public:
223b71206888 Initial import
thib
parents:
diff changeset
262 AyuSysConfigIntlistItem(void) {
223b71206888 Initial import
thib
parents:
diff changeset
263 item_deal = 0;
223b71206888 Initial import
thib
parents:
diff changeset
264 original_data = 0;
223b71206888 Initial import
thib
parents:
diff changeset
265 old_data = 0;
223b71206888 Initial import
thib
parents:
diff changeset
266 new_data = 0;
223b71206888 Initial import
thib
parents:
diff changeset
267 }
223b71206888 Initial import
thib
parents:
diff changeset
268 AyuSysConfigIntlistItem(const AyuSysConfigIntlistItem& o) {
223b71206888 Initial import
thib
parents:
diff changeset
269 item_deal = o.item_deal;
223b71206888 Initial import
thib
parents:
diff changeset
270 original_data = 0; old_data = 0; new_data = 0;
223b71206888 Initial import
thib
parents:
diff changeset
271 if (o.original_data) {
223b71206888 Initial import
thib
parents:
diff changeset
272 original_data = new int[item_deal];
223b71206888 Initial import
thib
parents:
diff changeset
273 memcpy(original_data, o.original_data, sizeof(int)*item_deal);
223b71206888 Initial import
thib
parents:
diff changeset
274 }
223b71206888 Initial import
thib
parents:
diff changeset
275 if (o.old_data) {
223b71206888 Initial import
thib
parents:
diff changeset
276 old_data = new int[item_deal];
223b71206888 Initial import
thib
parents:
diff changeset
277 memcpy(old_data, o.old_data, sizeof(int)*item_deal);
223b71206888 Initial import
thib
parents:
diff changeset
278 }
223b71206888 Initial import
thib
parents:
diff changeset
279 if (o.new_data) {
223b71206888 Initial import
thib
parents:
diff changeset
280 new_data = new int[item_deal];
223b71206888 Initial import
thib
parents:
diff changeset
281 memcpy(new_data, o.new_data, sizeof(int)*item_deal);
223b71206888 Initial import
thib
parents:
diff changeset
282 }
223b71206888 Initial import
thib
parents:
diff changeset
283 }
223b71206888 Initial import
thib
parents:
diff changeset
284 /* ÀßÄꡧInit ¤Ç½é´ü²½¡¢Set ¤ÇÊѹ¹¡¢Get ¤ÇÊѹ¹¤òÍ¥À褷¤Æ¼è¤ê½Ð¤¹ */
223b71206888 Initial import
thib
parents:
diff changeset
285 void Init(int deal, const int* list) { /* deal ¤Ï̵»ë */
223b71206888 Initial import
thib
parents:
diff changeset
286 if (original_data) delete[] original_data;
223b71206888 Initial import
thib
parents:
diff changeset
287 original_data = 0;
223b71206888 Initial import
thib
parents:
diff changeset
288 if (deal <= 0) {
223b71206888 Initial import
thib
parents:
diff changeset
289 item_deal = 0; return;
223b71206888 Initial import
thib
parents:
diff changeset
290 }
223b71206888 Initial import
thib
parents:
diff changeset
291 item_deal = deal;
223b71206888 Initial import
thib
parents:
diff changeset
292 original_data = new int[item_deal];
223b71206888 Initial import
thib
parents:
diff changeset
293 memcpy(original_data, list, sizeof(int)*deal);
223b71206888 Initial import
thib
parents:
diff changeset
294 }
223b71206888 Initial import
thib
parents:
diff changeset
295 void Set(int deal, const int* list) { /* deal ¤Ï̵»ë */
223b71206888 Initial import
thib
parents:
diff changeset
296 item_deal = deal;
223b71206888 Initial import
thib
parents:
diff changeset
297 if (new_data) delete[] new_data;
223b71206888 Initial import
thib
parents:
diff changeset
298 new_data = new int[item_deal];
223b71206888 Initial import
thib
parents:
diff changeset
299 memcpy(new_data, list, sizeof(int)*item_deal);
223b71206888 Initial import
thib
parents:
diff changeset
300 }
223b71206888 Initial import
thib
parents:
diff changeset
301 const int* Get(int deal) const {/* deal ¤Ï̵»ë */
223b71206888 Initial import
thib
parents:
diff changeset
302 if (item_deal == 0) return 0;
223b71206888 Initial import
thib
parents:
diff changeset
303 if (deal > item_deal) {
223b71206888 Initial import
thib
parents:
diff changeset
304 fprintf(stderr,"AyuSysConfigIntlistItem::Get : invalid items deal %d (correct: %d)\n",deal,item_deal);
223b71206888 Initial import
thib
parents:
diff changeset
305 return 0;
223b71206888 Initial import
thib
parents:
diff changeset
306 }
223b71206888 Initial import
thib
parents:
diff changeset
307 if (new_data) return new_data;
223b71206888 Initial import
thib
parents:
diff changeset
308 else if (old_data) return old_data;
223b71206888 Initial import
thib
parents:
diff changeset
309 return original_data;
223b71206888 Initial import
thib
parents:
diff changeset
310 }
223b71206888 Initial import
thib
parents:
diff changeset
311 const int* GetOriginal(int deal) const {/* deal ¤Ï̵»ë */
223b71206888 Initial import
thib
parents:
diff changeset
312 if (item_deal == 0) return 0;
223b71206888 Initial import
thib
parents:
diff changeset
313 if (deal > item_deal) {
223b71206888 Initial import
thib
parents:
diff changeset
314 fprintf(stderr,"AyuSysConfigIntlistItem::Get : invalid items deal %d (correct: %d)\n",deal,item_deal);
223b71206888 Initial import
thib
parents:
diff changeset
315 return 0;
223b71206888 Initial import
thib
parents:
diff changeset
316 }
223b71206888 Initial import
thib
parents:
diff changeset
317 return original_data;
223b71206888 Initial import
thib
parents:
diff changeset
318 }
223b71206888 Initial import
thib
parents:
diff changeset
319 int Deal(void) const {
223b71206888 Initial import
thib
parents:
diff changeset
320 return item_deal;
223b71206888 Initial import
thib
parents:
diff changeset
321 }
223b71206888 Initial import
thib
parents:
diff changeset
322 /* ¥ª¥ê¥¸¥Ê¥ë¤«¤é¤ÎÊѲ½¤ÎÄ´ºº :
223b71206888 Initial import
thib
parents:
diff changeset
323 ** DiffOriginal ¤ÇÊѲ½¤òʸ»úÎó¤Ç¼è¤ê½Ð¤·¡¢PatchOriginal ¤Ç
223b71206888 Initial import
thib
parents:
diff changeset
324 ** ÊѲ½¤òÈ¿±Ç
223b71206888 Initial import
thib
parents:
diff changeset
325 */
223b71206888 Initial import
thib
parents:
diff changeset
326 int DiffOriginalLen(void) {
223b71206888 Initial import
thib
parents:
diff changeset
327 if (new_data == 0) return 0;
223b71206888 Initial import
thib
parents:
diff changeset
328 return 12 * item_deal + 1;
223b71206888 Initial import
thib
parents:
diff changeset
329 }
223b71206888 Initial import
thib
parents:
diff changeset
330 void DiffOriginal(string& data) {
223b71206888 Initial import
thib
parents:
diff changeset
331 if (new_data == 0) { /* ¤¢¤êÆÀ¤Ê¤¤ */
223b71206888 Initial import
thib
parents:
diff changeset
332 fprintf(stderr,"AyuSysConfigStringItem::DiffOriginal : this method must not called if not required!\n");
223b71206888 Initial import
thib
parents:
diff changeset
333 return;
223b71206888 Initial import
thib
parents:
diff changeset
334 }
223b71206888 Initial import
thib
parents:
diff changeset
335 int i; char buf[1024];
223b71206888 Initial import
thib
parents:
diff changeset
336 for (i=0; i<item_deal; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
337 sprintf(buf, "%d,",new_data[i]);
223b71206888 Initial import
thib
parents:
diff changeset
338 data += buf;
223b71206888 Initial import
thib
parents:
diff changeset
339 }
223b71206888 Initial import
thib
parents:
diff changeset
340 return;
223b71206888 Initial import
thib
parents:
diff changeset
341 }
223b71206888 Initial import
thib
parents:
diff changeset
342 const char* PatchOriginal(const char* data) {
223b71206888 Initial import
thib
parents:
diff changeset
343 if (old_data) delete[] old_data;
223b71206888 Initial import
thib
parents:
diff changeset
344 if (new_data) delete[] new_data;
223b71206888 Initial import
thib
parents:
diff changeset
345 old_data = 0; new_data = 0;
223b71206888 Initial import
thib
parents:
diff changeset
346 new_data = new int[item_deal];
223b71206888 Initial import
thib
parents:
diff changeset
347 int i;
223b71206888 Initial import
thib
parents:
diff changeset
348 for (i=0; i<item_deal; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
349 new_data[i] = atoi(data);
223b71206888 Initial import
thib
parents:
diff changeset
350 if (strchr(data, ',') == 0) break;
223b71206888 Initial import
thib
parents:
diff changeset
351 data = strchr(data, ',') + 1;
223b71206888 Initial import
thib
parents:
diff changeset
352 }
223b71206888 Initial import
thib
parents:
diff changeset
353 return data;
223b71206888 Initial import
thib
parents:
diff changeset
354 }
223b71206888 Initial import
thib
parents:
diff changeset
355 void SetOriginal(void) {
223b71206888 Initial import
thib
parents:
diff changeset
356 if (new_data) delete[] new_data;
223b71206888 Initial import
thib
parents:
diff changeset
357 if (old_data) delete[] old_data;
223b71206888 Initial import
thib
parents:
diff changeset
358 new_data = 0; old_data = 0;
223b71206888 Initial import
thib
parents:
diff changeset
359 }
223b71206888 Initial import
thib
parents:
diff changeset
360 void Dump(FILE* f) const {
223b71206888 Initial import
thib
parents:
diff changeset
361 fprintf(f, "item deal %d, ",item_deal);
223b71206888 Initial import
thib
parents:
diff changeset
362 if (original_data) {
223b71206888 Initial import
thib
parents:
diff changeset
363 fprintf(f, "(%d", original_data[0]);
223b71206888 Initial import
thib
parents:
diff changeset
364 int i;for (i=1; i<item_deal; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
365 fprintf(f, ",%d",original_data[i]);
223b71206888 Initial import
thib
parents:
diff changeset
366 }
223b71206888 Initial import
thib
parents:
diff changeset
367 fprintf(f, ") ");
223b71206888 Initial import
thib
parents:
diff changeset
368 }
223b71206888 Initial import
thib
parents:
diff changeset
369 if (old_data) {
223b71206888 Initial import
thib
parents:
diff changeset
370 fprintf(f, "old %08x(%d", (unsigned int)(old_data), old_data[0]);
223b71206888 Initial import
thib
parents:
diff changeset
371 int i;for (i=1; i<item_deal; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
372 fprintf(f, ",%d",old_data[i]);
223b71206888 Initial import
thib
parents:
diff changeset
373 }
223b71206888 Initial import
thib
parents:
diff changeset
374 fprintf(f, ") ");
223b71206888 Initial import
thib
parents:
diff changeset
375 }
223b71206888 Initial import
thib
parents:
diff changeset
376 if (new_data) {
223b71206888 Initial import
thib
parents:
diff changeset
377 fprintf(f, "new %08x(%d", (unsigned int)(new_data), new_data[0]);
223b71206888 Initial import
thib
parents:
diff changeset
378 int i;for (i=1; i<item_deal; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
379 fprintf(f, ",%d",new_data[i]);
223b71206888 Initial import
thib
parents:
diff changeset
380 }
223b71206888 Initial import
thib
parents:
diff changeset
381 fprintf(f, ") ");
223b71206888 Initial import
thib
parents:
diff changeset
382 }
223b71206888 Initial import
thib
parents:
diff changeset
383 fprintf(f, "\n");
223b71206888 Initial import
thib
parents:
diff changeset
384 }
223b71206888 Initial import
thib
parents:
diff changeset
385 };
223b71206888 Initial import
thib
parents:
diff changeset
386
223b71206888 Initial import
thib
parents:
diff changeset
387 // template map<HashStr, AyuSysConfigStringItem>;
223b71206888 Initial import
thib
parents:
diff changeset
388 // template map<HashStr, AyuSysConfigIntlistItem>;
223b71206888 Initial import
thib
parents:
diff changeset
389
223b71206888 Initial import
thib
parents:
diff changeset
390 /************************************************
223b71206888 Initial import
thib
parents:
diff changeset
391 ** AyuSysConfigItem
223b71206888 Initial import
thib
parents:
diff changeset
392 ** ¥Ç¡¼¥¿Ì¾ -> ¥Ç¡¼¥¿ËÜÂΤΠmap ¤È¡¢map Á´ÂΤË
223b71206888 Initial import
thib
parents:
diff changeset
393 ** ÍÍ¡¹¤ÊÁàºî¤ò¹Ô¤¦¤¿¤á¤Î¥á¥½¥Ã¥É
223b71206888 Initial import
thib
parents:
diff changeset
394 */
223b71206888 Initial import
thib
parents:
diff changeset
395
223b71206888 Initial import
thib
parents:
diff changeset
396 template<class ItemType, class DataType> class AyuSysConfigItem {
223b71206888 Initial import
thib
parents:
diff changeset
397 typedef map<HashStr,ItemType> maptype;
223b71206888 Initial import
thib
parents:
diff changeset
398 typedef typename maptype::iterator mapiterator;
223b71206888 Initial import
thib
parents:
diff changeset
399 typedef typename maptype::const_iterator const_mapiterator;
223b71206888 Initial import
thib
parents:
diff changeset
400 maptype data;
223b71206888 Initial import
thib
parents:
diff changeset
401 public:
223b71206888 Initial import
thib
parents:
diff changeset
402 void SetOrig(HashStr& name, int deal, const DataType* str) {
223b71206888 Initial import
thib
parents:
diff changeset
403 if (str == 0) return; /* ̵¸ú */
223b71206888 Initial import
thib
parents:
diff changeset
404 data[name].Init(deal, str);
223b71206888 Initial import
thib
parents:
diff changeset
405 }
223b71206888 Initial import
thib
parents:
diff changeset
406 void Set(HashStr& name, int deal, const DataType* new_data) {
223b71206888 Initial import
thib
parents:
diff changeset
407 if (new_data == 0) return; /* ̵¸ú */
223b71206888 Initial import
thib
parents:
diff changeset
408 /* ÀßÄê¤ò¸¡º÷ */
223b71206888 Initial import
thib
parents:
diff changeset
409 mapiterator it = data.find(name);
223b71206888 Initial import
thib
parents:
diff changeset
410 /* ÀßÄ꤬¸µÀßÄê¤Ë¸«¤Ä¤«¤é¤Ê¤¤¤Ê¤é¼ºÇÔ */
223b71206888 Initial import
thib
parents:
diff changeset
411 if (it == data.end()) {
223b71206888 Initial import
thib
parents:
diff changeset
412 fprintf(stderr,"AyuSysConfigItem::Set : there is no '%s' parameter\n",name.c_str());
223b71206888 Initial import
thib
parents:
diff changeset
413 return;
223b71206888 Initial import
thib
parents:
diff changeset
414 }
223b71206888 Initial import
thib
parents:
diff changeset
415 /* ÀßÄê¤òÊѹ¹ */
223b71206888 Initial import
thib
parents:
diff changeset
416 it->second.Set(deal, new_data);
223b71206888 Initial import
thib
parents:
diff changeset
417 }
223b71206888 Initial import
thib
parents:
diff changeset
418 /* ¿·¤·¤¤ÀßÄê¤òÍ¥À褷¤ÆÊÖ¤¹ */
223b71206888 Initial import
thib
parents:
diff changeset
419 const DataType* Get(int deal, HashStr& name) const {
223b71206888 Initial import
thib
parents:
diff changeset
420 const_mapiterator it = data.find(name);
223b71206888 Initial import
thib
parents:
diff changeset
421 if (it == data.end()) return 0;
223b71206888 Initial import
thib
parents:
diff changeset
422 return it->second.Get(deal);
223b71206888 Initial import
thib
parents:
diff changeset
423 }
223b71206888 Initial import
thib
parents:
diff changeset
424 const DataType* GetOriginal(int deal, HashStr& name) const {
223b71206888 Initial import
thib
parents:
diff changeset
425 const_mapiterator it = data.find(name);
223b71206888 Initial import
thib
parents:
diff changeset
426 if (it == data.end()) return 0;
223b71206888 Initial import
thib
parents:
diff changeset
427 return it->second.GetOriginal(deal);
223b71206888 Initial import
thib
parents:
diff changeset
428 }
223b71206888 Initial import
thib
parents:
diff changeset
429 int Deal(HashStr& name) const {
223b71206888 Initial import
thib
parents:
diff changeset
430 const_mapiterator it = data.find(name);
223b71206888 Initial import
thib
parents:
diff changeset
431 if (it == data.end()) return 0;
223b71206888 Initial import
thib
parents:
diff changeset
432 return it->second.Deal();
223b71206888 Initial import
thib
parents:
diff changeset
433 }
223b71206888 Initial import
thib
parents:
diff changeset
434 /* ¥ª¥ê¥¸¥Ê¥ë¤«¤é¤ÎÊѲ½¤ÎÄ´ºº :
223b71206888 Initial import
thib
parents:
diff changeset
435 ** DiffOriginal ¤ÇÊѲ½¤òʸ»úÎó¤Ç¼è¤ê½Ð¤·¡¢PatchOriginal ¤Ç
223b71206888 Initial import
thib
parents:
diff changeset
436 ** ÊѲ½¤òÈ¿±Ç
223b71206888 Initial import
thib
parents:
diff changeset
437 */
223b71206888 Initial import
thib
parents:
diff changeset
438 void DiffOriginal(string& ret_str) {
223b71206888 Initial import
thib
parents:
diff changeset
439 mapiterator it = data.begin();
223b71206888 Initial import
thib
parents:
diff changeset
440 for (; it != data.end(); it++) {
223b71206888 Initial import
thib
parents:
diff changeset
441 int len = it->second.DiffOriginalLen();
223b71206888 Initial import
thib
parents:
diff changeset
442 if (len) {
223b71206888 Initial import
thib
parents:
diff changeset
443 ret_str += it->first.c_str();
223b71206888 Initial import
thib
parents:
diff changeset
444 ret_str += "=";
223b71206888 Initial import
thib
parents:
diff changeset
445 it->second.DiffOriginal(ret_str);
223b71206888 Initial import
thib
parents:
diff changeset
446 ret_str += ";";
223b71206888 Initial import
thib
parents:
diff changeset
447 }
223b71206888 Initial import
thib
parents:
diff changeset
448 }
223b71206888 Initial import
thib
parents:
diff changeset
449 ret_str += ";";
223b71206888 Initial import
thib
parents:
diff changeset
450 return;
223b71206888 Initial import
thib
parents:
diff changeset
451 }
223b71206888 Initial import
thib
parents:
diff changeset
452 const char* PatchOriginal(const char* diff_data) {
223b71206888 Initial import
thib
parents:
diff changeset
453 while(*diff_data != ';') {
223b71206888 Initial import
thib
parents:
diff changeset
454 char name[1024];
223b71206888 Initial import
thib
parents:
diff changeset
455 const char* data_start = strchr(diff_data, '=');
223b71206888 Initial import
thib
parents:
diff changeset
456 if (data_start == 0) break;
223b71206888 Initial import
thib
parents:
diff changeset
457 strncpy(name, diff_data, data_start-diff_data);
223b71206888 Initial import
thib
parents:
diff changeset
458 name[data_start-diff_data] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
459 data_start++;
223b71206888 Initial import
thib
parents:
diff changeset
460 mapiterator it = data.find(name);
223b71206888 Initial import
thib
parents:
diff changeset
461 if (it != data.end()) {
223b71206888 Initial import
thib
parents:
diff changeset
462 diff_data = data_start;
223b71206888 Initial import
thib
parents:
diff changeset
463 it->second.PatchOriginal(diff_data);
223b71206888 Initial import
thib
parents:
diff changeset
464 }
223b71206888 Initial import
thib
parents:
diff changeset
465 diff_data = strchr(diff_data, ';');
223b71206888 Initial import
thib
parents:
diff changeset
466 if (diff_data) diff_data++;
223b71206888 Initial import
thib
parents:
diff changeset
467 }
223b71206888 Initial import
thib
parents:
diff changeset
468 if (*diff_data == ';') {
223b71206888 Initial import
thib
parents:
diff changeset
469 diff_data++;
223b71206888 Initial import
thib
parents:
diff changeset
470 } else {
223b71206888 Initial import
thib
parents:
diff changeset
471 fprintf(stderr,"AyusysConfigItem::PatchOriginal: invalid data %s\n",diff_data);
223b71206888 Initial import
thib
parents:
diff changeset
472 }
223b71206888 Initial import
thib
parents:
diff changeset
473 return diff_data;
223b71206888 Initial import
thib
parents:
diff changeset
474 }
223b71206888 Initial import
thib
parents:
diff changeset
475 void SetOriginal(void) {
223b71206888 Initial import
thib
parents:
diff changeset
476 mapiterator it = data.begin();
223b71206888 Initial import
thib
parents:
diff changeset
477 for (; it != data.end(); it++) {
223b71206888 Initial import
thib
parents:
diff changeset
478 it->second.SetOriginal();
223b71206888 Initial import
thib
parents:
diff changeset
479 }
223b71206888 Initial import
thib
parents:
diff changeset
480 }
223b71206888 Initial import
thib
parents:
diff changeset
481 void Dump(FILE* f) const {
223b71206888 Initial import
thib
parents:
diff changeset
482 const_mapiterator it = data.begin();
223b71206888 Initial import
thib
parents:
diff changeset
483 for (; it != data.end(); it++) {
223b71206888 Initial import
thib
parents:
diff changeset
484 fprintf(f, "name %s: ",it->first.c_str());
223b71206888 Initial import
thib
parents:
diff changeset
485 it->second.Dump(f);
223b71206888 Initial import
thib
parents:
diff changeset
486 }
223b71206888 Initial import
thib
parents:
diff changeset
487 }
223b71206888 Initial import
thib
parents:
diff changeset
488 };
223b71206888 Initial import
thib
parents:
diff changeset
489 // template AyuSysConfigItem<AyuSysConfigStringItem, char>;
223b71206888 Initial import
thib
parents:
diff changeset
490 // template AyuSysConfigItem<AyuSysConfigIntlistItem, int>;
223b71206888 Initial import
thib
parents:
diff changeset
491
223b71206888 Initial import
thib
parents:
diff changeset
492 /************************************************/
223b71206888 Initial import
thib
parents:
diff changeset
493 /* ¥é¥Ã¥Ñ */
223b71206888 Initial import
thib
parents:
diff changeset
494 struct AyuSysConfigString {
223b71206888 Initial import
thib
parents:
diff changeset
495 AyuSysConfigItem<AyuSysConfigStringItem,char> orig;
223b71206888 Initial import
thib
parents:
diff changeset
496 void Dump(FILE* f) const {
223b71206888 Initial import
thib
parents:
diff changeset
497 fprintf(f, "string config:\n");
223b71206888 Initial import
thib
parents:
diff changeset
498 orig.Dump(f);
223b71206888 Initial import
thib
parents:
diff changeset
499 }
223b71206888 Initial import
thib
parents:
diff changeset
500 };
223b71206888 Initial import
thib
parents:
diff changeset
501 struct AyuSysConfigIntlist {
223b71206888 Initial import
thib
parents:
diff changeset
502 AyuSysConfigItem<AyuSysConfigIntlistItem, int> orig;
223b71206888 Initial import
thib
parents:
diff changeset
503 void Dump(FILE* f) const {
223b71206888 Initial import
thib
parents:
diff changeset
504 fprintf(f, "integer array config:\n");
223b71206888 Initial import
thib
parents:
diff changeset
505 orig.Dump(f);
223b71206888 Initial import
thib
parents:
diff changeset
506 }
223b71206888 Initial import
thib
parents:
diff changeset
507 };
223b71206888 Initial import
thib
parents:
diff changeset
508
223b71206888 Initial import
thib
parents:
diff changeset
509 /************************************************/
223b71206888 Initial import
thib
parents:
diff changeset
510 /* AyuSysConfig ¥¯¥é¥¹ */
223b71206888 Initial import
thib
parents:
diff changeset
511 int AyuSysConfig::SearchParam(const char* name) const{
223b71206888 Initial import
thib
parents:
diff changeset
512 HashStr str(name);
223b71206888 Initial import
thib
parents:
diff changeset
513 if (str_config->orig.Get(1, str)) return 1; /* char* ¤Î¥Ñ¥é¥á¡¼¥¿ */
223b71206888 Initial import
thib
parents:
diff changeset
514 else if (int_config->orig.Get(1, str)) return 2; /* int ¤Î¥Ñ¥é¥á¡¼¥¿ */
223b71206888 Initial import
thib
parents:
diff changeset
515 /* XXX.015.XXX ¤ÎÎà¤Î¥­¡¼Ì¾¤ò XXX.000.XXX ¤Î·Á¤Ëµ¬³Ê²½¤·¤ÆºÆ¸¡º÷ */
223b71206888 Initial import
thib
parents:
diff changeset
516 char name_copy[1024];
223b71206888 Initial import
thib
parents:
diff changeset
517 strncpy(name_copy, name, 1000);
223b71206888 Initial import
thib
parents:
diff changeset
518 name_copy[1000] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
519 char* s;
223b71206888 Initial import
thib
parents:
diff changeset
520 for (s=name_copy; s != 0; s = strchr(s,'.')) {
223b71206888 Initial import
thib
parents:
diff changeset
521 if (isdigit(s[1]) && isdigit(s[2]) && isdigit(s[3])) {
223b71206888 Initial import
thib
parents:
diff changeset
522 s[1] = '0'; s[2] = '0'; s[3] = '0';
223b71206888 Initial import
thib
parents:
diff changeset
523 }
223b71206888 Initial import
thib
parents:
diff changeset
524 s++;
223b71206888 Initial import
thib
parents:
diff changeset
525 }
223b71206888 Initial import
thib
parents:
diff changeset
526 HashStr str2(name_copy);
223b71206888 Initial import
thib
parents:
diff changeset
527 if (str_config->orig.Get(1, str2)) return 1; /* char* ¤Î¥Ñ¥é¥á¡¼¥¿ */
223b71206888 Initial import
thib
parents:
diff changeset
528 else if (int_config->orig.Get(1, str2)) return 2; /* int ¤Î¥Ñ¥é¥á¡¼¥¿ */
223b71206888 Initial import
thib
parents:
diff changeset
529 else return 0;
223b71206888 Initial import
thib
parents:
diff changeset
530 }
223b71206888 Initial import
thib
parents:
diff changeset
531 const char* AyuSysConfig::GetParaStr(const char* name) const{
223b71206888 Initial import
thib
parents:
diff changeset
532 HashStr str(name);
223b71206888 Initial import
thib
parents:
diff changeset
533 const char* ret = str_config->orig.Get(1,str);
223b71206888 Initial import
thib
parents:
diff changeset
534 if (ret == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
535 // fprintf(stderr,"Cannot find config name '%s'\n",name);
223b71206888 Initial import
thib
parents:
diff changeset
536 }
223b71206888 Initial import
thib
parents:
diff changeset
537 return ret;
223b71206888 Initial import
thib
parents:
diff changeset
538 }
223b71206888 Initial import
thib
parents:
diff changeset
539 int AyuSysConfig::GetParam(const char* name, int deal, ...) const{
223b71206888 Initial import
thib
parents:
diff changeset
540 HashStr str(name);
223b71206888 Initial import
thib
parents:
diff changeset
541 va_list va; int i;
223b71206888 Initial import
thib
parents:
diff changeset
542 const int* vars = int_config->orig.Get(deal, str);
223b71206888 Initial import
thib
parents:
diff changeset
543 if (vars == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
544 // fprintf(stderr,"Cannot find config name '%s'\n",name);
223b71206888 Initial import
thib
parents:
diff changeset
545 va_start(va, deal);
223b71206888 Initial import
thib
parents:
diff changeset
546 for (i=0; i<deal; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
547 int* var = va_arg(va, int*);
223b71206888 Initial import
thib
parents:
diff changeset
548 if (var) *var = 0;
223b71206888 Initial import
thib
parents:
diff changeset
549 }
223b71206888 Initial import
thib
parents:
diff changeset
550 return -1;
223b71206888 Initial import
thib
parents:
diff changeset
551 } else {
223b71206888 Initial import
thib
parents:
diff changeset
552 va_start(va, deal);
223b71206888 Initial import
thib
parents:
diff changeset
553 for (i=0; i<deal; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
554 int* var = va_arg(va, int*);
223b71206888 Initial import
thib
parents:
diff changeset
555 if (var) *var = vars[i];
223b71206888 Initial import
thib
parents:
diff changeset
556 }
223b71206888 Initial import
thib
parents:
diff changeset
557 }
223b71206888 Initial import
thib
parents:
diff changeset
558 return 0;
223b71206888 Initial import
thib
parents:
diff changeset
559 }
223b71206888 Initial import
thib
parents:
diff changeset
560 int AyuSysConfig::GetOriginalParam(const char* name, int deal, ...) const{
223b71206888 Initial import
thib
parents:
diff changeset
561 HashStr str(name);
223b71206888 Initial import
thib
parents:
diff changeset
562 va_list va; int i;
223b71206888 Initial import
thib
parents:
diff changeset
563 const int* vars = int_config->orig.GetOriginal(deal, str);
223b71206888 Initial import
thib
parents:
diff changeset
564 if (vars == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
565 // fprintf(stderr,"Cannot find config name '%s'\n",name);
223b71206888 Initial import
thib
parents:
diff changeset
566 va_start(va, deal);
223b71206888 Initial import
thib
parents:
diff changeset
567 for (i=0; i<deal; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
568 int* var = va_arg(va, int*);
223b71206888 Initial import
thib
parents:
diff changeset
569 if (var) *var = 0;
223b71206888 Initial import
thib
parents:
diff changeset
570 }
223b71206888 Initial import
thib
parents:
diff changeset
571 return -1;
223b71206888 Initial import
thib
parents:
diff changeset
572 } else {
223b71206888 Initial import
thib
parents:
diff changeset
573 va_start(va, deal);
223b71206888 Initial import
thib
parents:
diff changeset
574 for (i=0; i<deal; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
575 int* var = va_arg(va, int*);
223b71206888 Initial import
thib
parents:
diff changeset
576 if (var) *var = vars[i];
223b71206888 Initial import
thib
parents:
diff changeset
577 }
223b71206888 Initial import
thib
parents:
diff changeset
578 }
223b71206888 Initial import
thib
parents:
diff changeset
579 return 0;
223b71206888 Initial import
thib
parents:
diff changeset
580 }
223b71206888 Initial import
thib
parents:
diff changeset
581 const int* AyuSysConfig::GetParamArray(const char* name, int& deal) const{
223b71206888 Initial import
thib
parents:
diff changeset
582 HashStr str(name);
223b71206888 Initial import
thib
parents:
diff changeset
583 if (int_config->orig.Deal(str) == 0) { deal = 0; return 0; }
223b71206888 Initial import
thib
parents:
diff changeset
584 deal = int_config->orig.Deal(str);
223b71206888 Initial import
thib
parents:
diff changeset
585 const int* vars = int_config->orig.Get(deal, str);
223b71206888 Initial import
thib
parents:
diff changeset
586 if (vars == 0) { deal = 0; return 0; }
223b71206888 Initial import
thib
parents:
diff changeset
587 return vars;
223b71206888 Initial import
thib
parents:
diff changeset
588 }
223b71206888 Initial import
thib
parents:
diff changeset
589 void AyuSysConfig::SetParaStr(const char* name, const char* var) {
223b71206888 Initial import
thib
parents:
diff changeset
590 HashStr str(name);
223b71206888 Initial import
thib
parents:
diff changeset
591 dirty_flag = 1; change_flag = 1;
223b71206888 Initial import
thib
parents:
diff changeset
592 str_config->orig.Set(str, 1, var);
223b71206888 Initial import
thib
parents:
diff changeset
593 }
223b71206888 Initial import
thib
parents:
diff changeset
594 void AyuSysConfig::SetParam(const char* name, int deal, ...) {
223b71206888 Initial import
thib
parents:
diff changeset
595 if (deal >= MAXVARS) return ;
223b71206888 Initial import
thib
parents:
diff changeset
596 HashStr str(name);
223b71206888 Initial import
thib
parents:
diff changeset
597 int vars[MAXVARS]; va_list va; int i;
223b71206888 Initial import
thib
parents:
diff changeset
598 va_start(va, deal);
223b71206888 Initial import
thib
parents:
diff changeset
599 for (i=0; i<deal; i++) vars[i] = va_arg(va, int);
223b71206888 Initial import
thib
parents:
diff changeset
600 int_config->orig.Set(str, deal, vars);
223b71206888 Initial import
thib
parents:
diff changeset
601 dirty_flag = 1; change_flag = 1;
223b71206888 Initial import
thib
parents:
diff changeset
602 return;
223b71206888 Initial import
thib
parents:
diff changeset
603 }
223b71206888 Initial import
thib
parents:
diff changeset
604 void AyuSysConfig::SetOrigParaStr(const char* name, const char* var) {
223b71206888 Initial import
thib
parents:
diff changeset
605 HashStr str(name);
223b71206888 Initial import
thib
parents:
diff changeset
606 str_config->orig.SetOrig(str, 1, var);
223b71206888 Initial import
thib
parents:
diff changeset
607 change_flag = 1;
223b71206888 Initial import
thib
parents:
diff changeset
608 }
223b71206888 Initial import
thib
parents:
diff changeset
609 void AyuSysConfig::SetOrigParam(const char* name, int deal, ...) {
223b71206888 Initial import
thib
parents:
diff changeset
610 if (deal >= MAXVARS) return;
223b71206888 Initial import
thib
parents:
diff changeset
611 HashStr str(name);
223b71206888 Initial import
thib
parents:
diff changeset
612 int vars[MAXVARS]; va_list va; int i;
223b71206888 Initial import
thib
parents:
diff changeset
613 va_start(va, deal);
223b71206888 Initial import
thib
parents:
diff changeset
614 for(i=0; i<deal; i++) vars[i] = va_arg(va, int);
223b71206888 Initial import
thib
parents:
diff changeset
615 int_config->orig.SetOrig(str, deal, vars);
223b71206888 Initial import
thib
parents:
diff changeset
616 change_flag = 1;
223b71206888 Initial import
thib
parents:
diff changeset
617 }
223b71206888 Initial import
thib
parents:
diff changeset
618 void AyuSysConfig::SetOrigParamArray(const char* name, int deal, int* array) {
223b71206888 Initial import
thib
parents:
diff changeset
619 HashStr str(name);
223b71206888 Initial import
thib
parents:
diff changeset
620 int_config->orig.SetOrig(str, deal, array);
223b71206888 Initial import
thib
parents:
diff changeset
621 }
223b71206888 Initial import
thib
parents:
diff changeset
622 void AyuSysConfig::SetOriginal(void) {
223b71206888 Initial import
thib
parents:
diff changeset
623 /* Á´¤Æ¤ÎÀßÄê¤ò¸µ¤ËÌ᤹ */
223b71206888 Initial import
thib
parents:
diff changeset
624 str_config->orig.SetOriginal();
223b71206888 Initial import
thib
parents:
diff changeset
625 int_config->orig.SetOriginal();
223b71206888 Initial import
thib
parents:
diff changeset
626 change_flag = 1;
223b71206888 Initial import
thib
parents:
diff changeset
627 }
223b71206888 Initial import
thib
parents:
diff changeset
628 void AyuSysConfig::DiffOriginal(string& data) {
223b71206888 Initial import
thib
parents:
diff changeset
629 str_config->orig.DiffOriginal(data);
223b71206888 Initial import
thib
parents:
diff changeset
630 int_config->orig.DiffOriginal(data);
223b71206888 Initial import
thib
parents:
diff changeset
631 return;
223b71206888 Initial import
thib
parents:
diff changeset
632 }
223b71206888 Initial import
thib
parents:
diff changeset
633 const char* AyuSysConfig::PatchOriginal(const char* data) {
223b71206888 Initial import
thib
parents:
diff changeset
634 data = str_config->orig.PatchOriginal(data);
223b71206888 Initial import
thib
parents:
diff changeset
635 data = int_config->orig.PatchOriginal(data);
223b71206888 Initial import
thib
parents:
diff changeset
636 return data;
223b71206888 Initial import
thib
parents:
diff changeset
637 }
223b71206888 Initial import
thib
parents:
diff changeset
638
223b71206888 Initial import
thib
parents:
diff changeset
639 void AyuSysConfig::Dump(FILE* f) const {
223b71206888 Initial import
thib
parents:
diff changeset
640 str_config->Dump(f);
223b71206888 Initial import
thib
parents:
diff changeset
641 int_config->Dump(f);
223b71206888 Initial import
thib
parents:
diff changeset
642 }
223b71206888 Initial import
thib
parents:
diff changeset
643
223b71206888 Initial import
thib
parents:
diff changeset
644 /************************************************
223b71206888 Initial import
thib
parents:
diff changeset
645 ** AyuSysConfig ¤Î¥³¥ó¥¹¥È¥é¥¯¥¿¡§
223b71206888 Initial import
thib
parents:
diff changeset
646 ** Á´¤Æ¤Î config ¹àÌܤò½é´ü²½¤¹¤ë
223b71206888 Initial import
thib
parents:
diff changeset
647 */
223b71206888 Initial import
thib
parents:
diff changeset
648 AyuSysConfig::AyuSysConfig(void) {
223b71206888 Initial import
thib
parents:
diff changeset
649 int i;
223b71206888 Initial import
thib
parents:
diff changeset
650
223b71206888 Initial import
thib
parents:
diff changeset
651 change_flag = 1; dirty_flag = 0;
223b71206888 Initial import
thib
parents:
diff changeset
652 str_config = new AyuSysConfigString;
223b71206888 Initial import
thib
parents:
diff changeset
653 int_config = new AyuSysConfigIntlist;
223b71206888 Initial import
thib
parents:
diff changeset
654
223b71206888 Initial import
thib
parents:
diff changeset
655 /****** ʸ»úÎó *******/
223b71206888 Initial import
thib
parents:
diff changeset
656 SetOrigParaStr("#WAKUPDT", "GRDAT"); /* ÏÈ¡¢¥Þ¥¦¥¹¥«¡¼¥½¥ë¤Ê¤É¤Î²èÁü¥Õ¥¡¥¤¥ë */
223b71206888 Initial import
thib
parents:
diff changeset
657 SetOrigParaStr("#REGNAME", "xclannad"); /* ¥ì¥¸¥¹¥È¥ê̾¡£¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤ÎºîÀ®¤Ë»È¤¦ */
223b71206888 Initial import
thib
parents:
diff changeset
658 SetOrigParaStr("#CAPTION", "xclannad"); /* ¥¦¥£¥ó¥É¥¦¤Î¥¿¥¤¥È¥ë */
223b71206888 Initial import
thib
parents:
diff changeset
659 SetOrigParaStr("#SAVENAME","SAVE.INI"); /* ¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤Î̾Á° */
223b71206888 Initial import
thib
parents:
diff changeset
660 SetOrigParaStr("#SAVETITLE", "This is save file"); /* ¥»¡¼¥Ö¥Õ¥¡¥¤¥ë¤ÎÀèƬ¤Îʸ»úÎó */
223b71206888 Initial import
thib
parents:
diff changeset
661 SetOrigParaStr("#SAVENOTITLE", "-----------------"); /* »È¤ï¤ì¤Æ¤Ê¤¤¥»¡¼¥Ö¥Ç¡¼¥¿¤Î̾Á° */
223b71206888 Initial import
thib
parents:
diff changeset
662 SetOrigParaStr("#CGM_FILE", "MODE.CGM");/* CG mode ¤ÎÀßÄ꤬Êݸ¤µ¤ì¤¿¥Õ¥¡¥¤¥ë̾ */
223b71206888 Initial import
thib
parents:
diff changeset
663 SetOrigParaStr("#CGTABLE_FILE", "MODE.CGM");/* CG mode ¤ÎÀßÄ꤬Êݸ¤µ¤ì¤¿¥Õ¥¡¥¤¥ë̾ */
223b71206888 Initial import
thib
parents:
diff changeset
664
223b71206888 Initial import
thib
parents:
diff changeset
665 SetOrigParaStr("#WAKU.000.000.NAME", ""); // ¥Æ¥­¥¹¥È¥¦¥£¥ó¥É¥¦¤ÎÁë¾þ¤ê²èÁü̾
223b71206888 Initial import
thib
parents:
diff changeset
666 SetOrigParaStr("#WAKU.000.000.BACK", ""); // ¥Æ¥­¥¹¥È¥¦¥£¥ó¥É¥¦¤Î¥Æ¥­¥¹¥ÈÇطʲèÁü̾
223b71206888 Initial import
thib
parents:
diff changeset
667 SetOrigParaStr("#WAKU.000.000.BTN", ""); // ¥Æ¥­¥¹¥È¥¦¥£¥ó¥É¥¦¤Î¥Ü¥¿¥ó²èÁü̾
223b71206888 Initial import
thib
parents:
diff changeset
668
223b71206888 Initial import
thib
parents:
diff changeset
669 SetOrigParaStr("#MOUSE_CURSOR.000.NAME", ""); // ¥Þ¥¦¥¹¥«¡¼¥½¥ë¤Î¥Õ¥¡¥¤¥ë̾
223b71206888 Initial import
thib
parents:
diff changeset
670 SetOrigParaStr("#CURSOR.000.NAME", ""); // ¥ê¥¿¡¼¥ó¥«¡¼¥½¥ë¤Î¥Õ¥¡¥¤¥ë̾
223b71206888 Initial import
thib
parents:
diff changeset
671 SetOrigParaStr("#SELBTN.000.NAME", ""); // ÁªÂò»èÇØ·Ê
223b71206888 Initial import
thib
parents:
diff changeset
672 SetOrigParaStr("#SELBTN.000.BACK", ""); // ÁªÂò»èÇØ·Ê
223b71206888 Initial import
thib
parents:
diff changeset
673
223b71206888 Initial import
thib
parents:
diff changeset
674 char name_str[8] = "#NAME.A";
223b71206888 Initial import
thib
parents:
diff changeset
675 for (i='A'; i<='Z'; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
676 name_str[6] = i;
223b71206888 Initial import
thib
parents:
diff changeset
677 SetOrigParaStr(name_str, "");
223b71206888 Initial import
thib
parents:
diff changeset
678 }
223b71206888 Initial import
thib
parents:
diff changeset
679
223b71206888 Initial import
thib
parents:
diff changeset
680 /****** ¿ôÃÍÎó *******/
223b71206888 Initial import
thib
parents:
diff changeset
681 SetOrigParam("#CANCELCALL", 2, 0,0); /* ¥­¥ã¥ó¥»¥ë¥Ü¥¿¥ó(±¦¥¯¥ê¥Ã¥¯)¤·¤¿¤È¤­¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¥µ¥Ö¥ë¡¼¥Á¥óÈÖ¹æ(¥á¥Ë¥å¡¼) */
223b71206888 Initial import
thib
parents:
diff changeset
682 SetOrigParam("#COM2_TITLE", 1, 1); /* ¡© */
223b71206888 Initial import
thib
parents:
diff changeset
683 SetOrigParam("#COM2_TITLE_COLOR", 1, 2); /* ÁªÂò»è¥¿¥¤¥È¥ë¤Î¿§ */
223b71206888 Initial import
thib
parents:
diff changeset
684 SetOrigParam("#COM2_TITLE_INDENT", 1, 2); /* ¡© */
223b71206888 Initial import
thib
parents:
diff changeset
685 SetOrigParam("#SAVEFILETIME", 1, 24); /* ¥»¡¼¥Ö¤¹¤ë¾ì½ê¤Î¿ô */
223b71206888 Initial import
thib
parents:
diff changeset
686 SetOrigParam("#SEEN_START", 1, 0); /* ¥²¡¼¥à¤ò³«»Ï¤¹¤ë¥·¥Ê¥ê¥ªÈÖ¹æ */
223b71206888 Initial import
thib
parents:
diff changeset
687 SetOrigParam("#SEEN_SRT", 1, 0); /* ¥²¡¼¥à¤ò³«»Ï¤¹¤ë¥·¥Ê¥ê¥ªÈÖ¹æ(¹¥¤­¹¥¤­Âç¹¥¤­) */
223b71206888 Initial import
thib
parents:
diff changeset
688 SetOrigParam("#SEEN_MENU", 1, 0); /* ¥á¥Ë¥å¡¼¤Î¥·¥Ê¥ê¥ªÈÖ¹æ */
223b71206888 Initial import
thib
parents:
diff changeset
689 SetOrigParam("#SEEN_TEXT_CURRENT", 1, 0); /* seen.txt ¤ò root directory ¤ËÃÖ¤¯¤« */
223b71206888 Initial import
thib
parents:
diff changeset
690 SetOrigParam("#FADE_TIME", 1, 40); /* ²èÌ̤Υե§¡¼¥É¡¦¥¢¥¦¥È¤Î®ÅÙ */
223b71206888 Initial import
thib
parents:
diff changeset
691 SetOrigParam("#NVL_SYSTEM",1, 0); /* ¥Æ¥­¥¹¥È¥¦¥£¥ó¥É¥¦¤¬Á´²èÌ̤«Èݤ« */
223b71206888 Initial import
thib
parents:
diff changeset
692 SetOrigParam("#WINDOW_ATTR", 5, -1, 128,128, 190, 0); /* ¥Æ¥­¥¹¥È¥¦¥£¥ó¥É¥¦¤Î¿§ */
223b71206888 Initial import
thib
parents:
diff changeset
693 SetOrigParam("#WINDOW_ATTR_AREA", 4, 4,4,4,4); /* ¥Æ¥­¥¹¥È¥¦¥£¥ó¥É¥¦¤ÎÈÏ°Ï */
223b71206888 Initial import
thib
parents:
diff changeset
694 SetOrigParam("#WINDOW_ATTR_TYPE", 1, 0); /* ¥Æ¥­¥¹¥È¥¦¥£¥ó¥É¥¦¤òȾƩÌÀ¤Ë¤¹¤ë¤« */
223b71206888 Initial import
thib
parents:
diff changeset
695 SetOrigParam("#WINDOW_MSG_POS", 2, 22, 350); /* ¥Æ¥­¥¹¥È¥¦¥£¥ó¥É¥¦¤Î°ÌÃÖ */
223b71206888 Initial import
thib
parents:
diff changeset
696 SetOrigParam("#WINDOW_COM_POS", 2,450, 250); /* ÁªÂò¥¦¥£¥ó¥É¥¦¤Î°ÌÃÖ */
223b71206888 Initial import
thib
parents:
diff changeset
697 SetOrigParam("#WINDOW_GRP_POS", 2, 16, 100); /* ¤Ê¤Ë¤«¤Î¥¦¥£¥ó¥É¥¦¤Î°ÌÃÖ */
223b71206888 Initial import
thib
parents:
diff changeset
698 SetOrigParam("#WINDOW_SUB_POS", 2, 48, 100); /* ¤Ê¤Ë¤«¤Î¥¦¥£¥ó¥É¥¦¤Î°ÌÃÖ */
223b71206888 Initial import
thib
parents:
diff changeset
699 SetOrigParam("#WINDOW_SYS_POS", 2, 32, 100); /* ¤Ê¤Ë¤«¤Î¥¦¥£¥ó¥É¥¦¤Î°ÌÃÖ */
223b71206888 Initial import
thib
parents:
diff changeset
700 SetOrigParam("#WINDOW_WAKU_TYPE", 1, 0); /* ¥Æ¥­¥¹¥È¥¦¥£¥ó¥É¥¦¤ÎÏȤμïÎà¡£xkanon Æȼ«ÀßÄê */
223b71206888 Initial import
thib
parents:
diff changeset
701 SetOrigParam("#RETN_CONT", 1, 16); /* ¥ê¥¿¡¼¥ó¥«¡¼¥½¥ë¤Î¿ô */
223b71206888 Initial import
thib
parents:
diff changeset
702 SetOrigParam("#RETN_SPEED",1,100); /* ¥ê¥¿¡¼¥ó¥«¡¼¥½¥ë¤ÎÆ°¤¯Â®ÅÙ */
223b71206888 Initial import
thib
parents:
diff changeset
703 SetOrigParam("#RETN_XSIZE", 1, 16); /* ¥ê¥¿¡¼¥ó¥«¡¼¥½¥ë¤ÎÂ礭¤µ */
223b71206888 Initial import
thib
parents:
diff changeset
704 SetOrigParam("#RETN_YSIZE", 1, 16); /* ¥ê¥¿¡¼¥ó¥«¡¼¥½¥ë¤ÎÂ礭¤µ */
223b71206888 Initial import
thib
parents:
diff changeset
705 SetOrigParam("#FONT_SIZE", 1, 26); /* ¥Õ¥©¥ó¥È¤ÎÂ礭¤µ */
223b71206888 Initial import
thib
parents:
diff changeset
706 SetOrigParam("#FONT_WEIGHT", 1, 100); /* ¥Õ¥©¥ó¥È¤Î weight */
223b71206888 Initial import
thib
parents:
diff changeset
707 SetOrigParam("#MSG_MOJI_SIZE", 2, 12, 29); /* ʸ»ú¤ÎÂ礭¤µ(Ⱦ³Ñ) */
223b71206888 Initial import
thib
parents:
diff changeset
708 SetOrigParam("#MESSAGE_SIZE", 2, 23, 3); /* ¥á¥Ã¥»¡¼¥¸¥¦¥£¥ó¥É¥¦¤Îʸ»ú¿ô */
223b71206888 Initial import
thib
parents:
diff changeset
709 SetOrigParam("#COM_MESSAGE_SIZE", 2, 23, 3); /* ¥á¥Ã¥»¡¼¥¸¥¦¥£¥ó¥É¥¦¤Îʸ»ú¿ô */
223b71206888 Initial import
thib
parents:
diff changeset
710 SetOrigParam("#INIT_MESSAGE_SPEED", 1, 30); /* ¥Æ¥­¥¹¥Èɽ¼¨Â®ÅÙ */
223b71206888 Initial import
thib
parents:
diff changeset
711 SetOrigParam("#INIT_MESSAGE_SPEED_MOD", 1, 0); /* ¥Æ¥­¥¹¥Èɽ¼¨ no wait */
223b71206888 Initial import
thib
parents:
diff changeset
712 SetOrigParam("#MESSAGE_KEY_WAIT_USE", 1, 0); /* ¥Æ¥­¥¹¥È¿Ê¹Ô¥ª¡¼¥È¥â¡¼¥É */
223b71206888 Initial import
thib
parents:
diff changeset
713 SetOrigParam("#MESSAGE_KEY_WAIT_TIME", 1, 1500); /* ¥ª¡¼¥È¥â¡¼¥É¤Ç¤Î¥­¡¼ÂÔ¤Á»þ´Ö */
223b71206888 Initial import
thib
parents:
diff changeset
714
223b71206888 Initial import
thib
parents:
diff changeset
715 SetOrigParam("#GRP_DC_TIMES", 1, 4); /* ΢²èÌ̤οô */
223b71206888 Initial import
thib
parents:
diff changeset
716 SetOrigParam("#MUSIC_LINEAR_PAC",1,0); /* PCM ¥Ç¡¼¥¿¤Î 8bit -> 16bit ÊÑ´¹¤ò¹Ô¤¦¤« */
223b71206888 Initial import
thib
parents:
diff changeset
717 SetOrigParam("#MUSIC_TYPE",1,0); /* PCM ¥Ç¡¼¥¿¤Î¼ïÎà */
223b71206888 Initial import
thib
parents:
diff changeset
718 SetOrigParam("#WINDOW_MSGBK_BOX",1,0); /* ¥Ð¥Ã¥¯¥í¥°ÍѤΥܥ¿¥ó */
223b71206888 Initial import
thib
parents:
diff changeset
719 SetOrigParam("#WINDOW_MSGBK_LBOX_POS",4,15,7,8,0); /* ¥Ð¥Ã¥¯¥í¥°ÍѤΥܥ¿¥ó(º¸)¤Î°ÌÃÖ */
223b71206888 Initial import
thib
parents:
diff changeset
720 SetOrigParam("#WINDOW_MSGBK_RBOX_POS",4,7,7,0,0); /* ¥Ð¥Ã¥¯¥í¥°ÍѤΥܥ¿¥ó(º¸)¤Î°ÌÃÖ */
223b71206888 Initial import
thib
parents:
diff changeset
721 SetOrigParam("#MSGBK_MOD",1,0); /* ¥Ð¥Ã¥¯¥í¥°ÍѤΥܥ¿¥ó¤ò»ÈÍѤ¹¤ë¤« */
223b71206888 Initial import
thib
parents:
diff changeset
722
223b71206888 Initial import
thib
parents:
diff changeset
723 SetOrigParam("#WAKU.000.000.TYPE", 1, 5);
223b71206888 Initial import
thib
parents:
diff changeset
724 SetOrigParam("#WAKU.000.000.MOVE_BOX", 5, 0, 0, 0, 0, 0); // ¥Æ¥­¥¹¥È¥¦¥£¥ó¥É¥¦¤Î°ÜÆ°Íѥܥ¿¥ó°ÌÃÖ
223b71206888 Initial import
thib
parents:
diff changeset
725 SetOrigParam("#WAKU.000.000.CLEAR_BOX", 5, 0, 0, 0, 0, 0); // °ì»þ¾ÃµîÍѥܥ¿¥ó°ÌÃÖ
223b71206888 Initial import
thib
parents:
diff changeset
726 SetOrigParam("#WAKU.000.000.READJUMP_BOX", 5, 0, 0, 0, 0, 0); // ¥¹¥­¥Ã¥×Íѥܥ¿¥ó°ÌÃÖ
223b71206888 Initial import
thib
parents:
diff changeset
727 SetOrigParam("#WAKU.000.000.AUTOMODE_BOX", 5, 0, 0, 0, 0, 0); // ¥ª¡¼¥ÈÍѥܥ¿¥ó°ÌÃÖ
223b71206888 Initial import
thib
parents:
diff changeset
728 SetOrigParam("#WAKU.000.000.MSGBK_BOX", 5, 0, 0, 0, 0, 0); // ¥Ð¥Ã¥¯¥í¥°¥Ü¥¿¥ó°ÌÃÖ
223b71206888 Initial import
thib
parents:
diff changeset
729 SetOrigParam("#WAKU.000.000.MSGBKLEFT_BOX", 5, 0, 0, 0, 0, 0); // ¥Ð¥Ã¥¯¥í¥°¡Ê¿Ê¤á¤ë¡Ë¥Ü¥¿¥ó°ÌÃÖ
223b71206888 Initial import
thib
parents:
diff changeset
730 SetOrigParam("#WAKU.000.000.MSGBKRIGHT_BOX", 5, 0, 0, 0, 0, 0); // ¥Ð¥Ã¥¯¥í¥°¡ÊÌá¤ë¡Ë¥Ü¥¿¥ó°ÌÃÖ
223b71206888 Initial import
thib
parents:
diff changeset
731 SetOrigParam("#WAKU.000.000.EXBTN_000_BOX", 5, 0, 0, 0, 0, 0); // ¤½¤Î¾¥Ü¥¿¥ó£°°ÌÃÖ
223b71206888 Initial import
thib
parents:
diff changeset
732 SetOrigParam("#WAKU.000.000.EXBTN_001_BOX", 5, 0, 0, 0, 0, 0); // ¤½¤Î¾¥Ü¥¿¥ó£±°ÌÃÖ
223b71206888 Initial import
thib
parents:
diff changeset
733 SetOrigParam("#WAKU.000.000.EXBTN_002_BOX", 5, 0, 0, 0, 0, 0); // ¤½¤Î¾¥Ü¥¿¥ó£²°ÌÃÖ
223b71206888 Initial import
thib
parents:
diff changeset
734
223b71206888 Initial import
thib
parents:
diff changeset
735 SetOrigParam("#WINDOW.000.MOJI_SIZE", 1, 21); // ʸ»ú¥µ¥¤¥º
223b71206888 Initial import
thib
parents:
diff changeset
736 SetOrigParam("#WINDOW.000.MOJI_REP", 2, -1, 2); // ʸ»ú¤Î;͵
223b71206888 Initial import
thib
parents:
diff changeset
737 SetOrigParam("#WINDOW.000.MOJI_CNT", 2, 20, 3); // ¥¦¥£¥ó¥É¥¦Æâ¤Îʸ»ú¿ô
223b71206888 Initial import
thib
parents:
diff changeset
738 SetOrigParam("#WINDOW.000.MOJI_POS", 4, 100, 0, 180, 40); // ¥Æ¥­¥¹¥È°ÌÃÖ¡£3¤ÄÌܤ¬x ¤Ç1¤ÄÌܤ¬y¤é¤·¤¤
223b71206888 Initial import
thib
parents:
diff changeset
739 SetOrigParam("#WINDOW.000.MOJI_SHADOW", 1, 0); // ʸ»ú¤Ë±Æ¤òÉÕ¤±¤ë¤«
223b71206888 Initial import
thib
parents:
diff changeset
740 SetOrigParam("#WINDOW.000.LUBY_SIZE", 1, 8); // ¥ë¥Ó¤Îʸ»ú¥µ¥¤¥º
223b71206888 Initial import
thib
parents:
diff changeset
741 SetOrigParam("#WINDOW.000.MOJI_MIN", 2, 8, 1); // ʸ»úƱ»Î¤Î·ä´Ö¡©
223b71206888 Initial import
thib
parents:
diff changeset
742 SetOrigParam("#WINDOW.000.SELCOM_USE", 1, 0); // ÁªÂò»è¤Î¼ÂÁõÊýË¡
223b71206888 Initial import
thib
parents:
diff changeset
743 SetOrigParam("#WINDOW.000.POS", 4, 100, 0, 0, 260); // ¥¦¥£¥ó¥É¥¦°ÌÃÖ
223b71206888 Initial import
thib
parents:
diff changeset
744 SetOrigParam("#WINDOW.000.ATTR_MOD", 1, 0); // ¥¦¥£¥ó¥É¥¦¿§
223b71206888 Initial import
thib
parents:
diff changeset
745 SetOrigParam("#WINDOW.000.ATTR", 5, -1, -1, -1, -1, -1); // ¥¦¥£¥ó¥É¥¦¿§
223b71206888 Initial import
thib
parents:
diff changeset
746 /* SELCOM ¤Ï¤è¤¯¤ï¤«¤é¤ó¤Î¤Ç̵»ë */
223b71206888 Initial import
thib
parents:
diff changeset
747 SetOrigParam("#WINDOW.000.OPEN_ANM_MOD", 1, 0); // ¥¦¥£¥ó¥É¥¦¤ò³«¤¯¤È¤­¤Î¸ú²Ì¤é¤·¤¤
223b71206888 Initial import
thib
parents:
diff changeset
748 SetOrigParam("#WINDOW.000.OPEN_ANM_TIME", 1, 500);
223b71206888 Initial import
thib
parents:
diff changeset
749 SetOrigParam("#WINDOW.000.CLOSE_ANM_MOD", 1, 0); // ¥¦¥£¥ó¥É¥¦¤òÊĤ¸¤ë¤È¤­¤Î¸ú²Ì¤é¤·¤¤
223b71206888 Initial import
thib
parents:
diff changeset
750 SetOrigParam("#WINDOW.000.CLOSE_ANM_TIME", 1, 500);
223b71206888 Initial import
thib
parents:
diff changeset
751 SetOrigParam("#WINDOW.000.WAKU_SETNO", 1, 0); // ÏȤμïÎà
223b71206888 Initial import
thib
parents:
diff changeset
752 SetOrigParam("#WINDOW.000.MOVE_USE", 1, 0); // ¥¦¥£¥ó¥É¥¦ÏÈ°ÜÆ°¥Ü¥¿¥ó»ÈÍѤβÄÈÝ
223b71206888 Initial import
thib
parents:
diff changeset
753 SetOrigParam("#WINDOW.000.CLEAR_USE", 1, 0); // ¥¦¥£¥ó¥É¥¦ÏȾõî¥Ü¥¿¥ó»ÈÍѤβÄÈÝ
223b71206888 Initial import
thib
parents:
diff changeset
754 SetOrigParam("#WINDOW.000.READJUMP_USE", 1, 0); // ¥¹¥­¥Ã¥×¥Ü¥¿¥ó»ÈÍѤβÄÈÝ
223b71206888 Initial import
thib
parents:
diff changeset
755 SetOrigParam("#WINDOW.000.AUTOMODE_USE", 1, 0); // ¥¹¥­¥Ã¥×¥Ü¥¿¥ó»ÈÍѤβÄÈÝ
223b71206888 Initial import
thib
parents:
diff changeset
756 SetOrigParam("#WINDOW.000.MSGBK_USE", 1, 0); // ¥Ð¥Ã¥¯¥í¥°¥Ü¥¿¥ó»ÈÍѤβÄÈÝ
223b71206888 Initial import
thib
parents:
diff changeset
757 SetOrigParam("#WINDOW.000.MSGBKLEFT_USE", 1, 0); // ¥Ð¥Ã¥¯¥í¥°¡Ê¿Ê¤à¡Ë¥Ü¥¿¥ó»ÈÍѤβÄÈÝ
223b71206888 Initial import
thib
parents:
diff changeset
758 SetOrigParam("#WINDOW.000.MSGBKRIGHT_USE", 1, 0); // ¥Ð¥Ã¥¯¥í¥°¡ÊÌá¤ë¡Ë¥Ü¥¿¥ó»ÈÍѤβÄÈÝ
223b71206888 Initial import
thib
parents:
diff changeset
759 SetOrigParam("#WINDOW.000.EXBTN_000_USE", 1, 0); // ¤½¤Î¾¥Ü¥¿¥ó£°»ÈÍѤβÄÈÝ
223b71206888 Initial import
thib
parents:
diff changeset
760 SetOrigParam("#WINDOW.000.EXBTN_001_USE", 1, 0); // ¤½¤Î¾¥Ü¥¿¥ó£±»ÈÍѤβÄÈÝ
223b71206888 Initial import
thib
parents:
diff changeset
761 SetOrigParam("#WINDOW.000.EXBTN_002_USE", 1, 0); // ¤½¤Î¾¥Ü¥¿¥ó£²»ÈÍѤβÄÈÝ
223b71206888 Initial import
thib
parents:
diff changeset
762 SetOrigParam("#WINDOW.000.NAME_MOD", 1, 0); // ̾Á°¥¦¥£¥ó¥É¥¦¤òÊÌÅÓ»ÈÍѤ¹¤ë¤«
223b71206888 Initial import
thib
parents:
diff changeset
763 SetOrigParam("#WINDOW.000.NAME_MOJI_SIZE", 1, 20); // ̾Á°¥Õ¥©¥ó¥È¤Î¥µ¥¤¥º
223b71206888 Initial import
thib
parents:
diff changeset
764 SetOrigParam("#WINDOW.000.NAME_MOJI_POS", 2, 0, 0); // ̾Á°¥¦¥£¥ó¥É¥¦¤Îʸ»ú¤Î°ÌÃÖ
223b71206888 Initial import
thib
parents:
diff changeset
765 SetOrigParam("#WINDOW.000.NAME_MOJI_MIN", 1, 0); // ̾Á°¥¦¥£¥ó¥É¥¦¤ÎÉý
223b71206888 Initial import
thib
parents:
diff changeset
766 SetOrigParam("#WINDOW.000.NAME_CENTERING", 1, 1); // ̾Á°¤Î¥»¥ó¥¿¥ê¥ó¥°¤Î̵ͭ
223b71206888 Initial import
thib
parents:
diff changeset
767 SetOrigParam("#WINDOW.000.NAME_POS", 2, 159, 78); // ̾Á°¥¦¥£¥ó¥É¥¦°ÌÃ֡ʺ¸²¼°ÌÃ֤餷¤¤¡Ë
223b71206888 Initial import
thib
parents:
diff changeset
768 SetOrigParam("#WINDOW.000.NAME_WAKU_SETNO", 1, -1); // ̾Á°¥¦¥£¥ó¥É¥¦°ÌÃ֡ʺ¸²¼°ÌÃ֤餷¤¤¡Ë
223b71206888 Initial import
thib
parents:
diff changeset
769 SetOrigParam("#WINDOW.000.FACE.000", 5, 0, 0, 1, 1, 1); // ´é¥¦¥£¥ó¥É¥¦°ÌÃÖ(»Ï¤á£²¤Ä¤¬x,y¡¢MOJI_POS¤«¤é¤ÎÁêÂаÌÃ֤ʤΤËÃí°Õ)
223b71206888 Initial import
thib
parents:
diff changeset
770 SetOrigParam("#WINDOW.000.KEYCUR_MOD", 3, 0, 0, 0); // ¥ê¥¿¡¼¥ó¥«¡¼¥½¥ë¤Î°ÌÃÖ
223b71206888 Initial import
thib
parents:
diff changeset
771
223b71206888 Initial import
thib
parents:
diff changeset
772
223b71206888 Initial import
thib
parents:
diff changeset
773 SetOrigParam("#CURSOR.000.SIZE", 2, 0, 0); // ¥ê¥¿¡¼¥ó¥«¡¼¥½¥ë¤ÎÂ礭¤µ
223b71206888 Initial import
thib
parents:
diff changeset
774 SetOrigParam("#CURSOR.000.CONT", 1, 50); // ¥ê¥¿¡¼¥ó¥«¡¼¥½¥ë¤Î·«¤êÊÖ¤·¿ô
223b71206888 Initial import
thib
parents:
diff changeset
775 SetOrigParam("#CURSOR.000.SPEED", 1, 1000); // ¥Ö¥ê¥ó¥¯¤¹¤ë®¤µ
223b71206888 Initial import
thib
parents:
diff changeset
776
40
651237260724 * Center button-type selects
thib
parents: 27
diff changeset
777 SetOrigParam("#SELBTN.000.CENTERING", 2, 0, 0);
0
223b71206888 Initial import
thib
parents:
diff changeset
778 SetOrigParam("#SELBTN.000.BASEPOS", 2, 0, 0); // ÁªÂò»è¥¦¥£¥ó¥É¥¦¤Î°ÌÃÖ
223b71206888 Initial import
thib
parents:
diff changeset
779 SetOrigParam("#SELBTN.000.REPPOS", 2, 0, 50); // ÁªÂò»è¥¦¥£¥ó¥É¥¦¤Î¼¡¤Î°ÌÃÖ¡ÊÁêÂСË
223b71206888 Initial import
thib
parents:
diff changeset
780 SetOrigParam("#SELBTN.000.MOJISIZE", 4, 26, 0,0,0); // ʸ»ú¤ÎÂ礭¤µ
223b71206888 Initial import
thib
parents:
diff changeset
781 SetOrigParam("#SELBTN.000.MOJIDEFAULTCOL", 1, 0); // ÈóÁªÂò»þ¤Îʸ»ú¿§
223b71206888 Initial import
thib
parents:
diff changeset
782 SetOrigParam("#SELBTN.000.MOJISELECTCOL", 1, 0); // ÁªÂò»þ¤Îʸ»ú¿§
223b71206888 Initial import
thib
parents:
diff changeset
783
223b71206888 Initial import
thib
parents:
diff changeset
784 SetOrigParam("#COLOR_TABLE.000", 3, 255,255,255);
223b71206888 Initial import
thib
parents:
diff changeset
785 SetOrigParam("#SHAKE.000", 3, 0,0,0);
223b71206888 Initial import
thib
parents:
diff changeset
786
223b71206888 Initial import
thib
parents:
diff changeset
787 SetOrigParam("#SELR.000",16,0,0,640,480,0,0,500,50,0,0,0,0,0,0,255,0);
223b71206888 Initial import
thib
parents:
diff changeset
788 SetOrigParam("#SEL.000", 15,0,0,639,479,0,0, 32, 4,0,0,0,0,0,0,0);
223b71206888 Initial import
thib
parents:
diff changeset
789
223b71206888 Initial import
thib
parents:
diff changeset
790 SetOrigParam("#SCREENSIZE_MOD", 1, 0); /* 0 = 640x480; 1 = 800x600 */
16
92765a5661f7 added "new" label on last savegame and corrected StatSaveFile
thib
parents: 9
diff changeset
791
92765a5661f7 added "new" label on last savegame and corrected StatSaveFile
thib
parents: 9
diff changeset
792 SetOrigParam("#LASTSAVE", 1, 0);
26
f45da03ca631 * Corrected --disable-vorbis in configure.ac
thib
parents: 16
diff changeset
793
f45da03ca631 * Corrected --disable-vorbis in configure.ac
thib
parents: 16
diff changeset
794 SetOrigParam("#VOLMOD", 4, 128, 128, 128, 128);
0
223b71206888 Initial import
thib
parents:
diff changeset
795 }
9
b6d6c0ffb423 Fixed some memory leaks
thib
parents: 0
diff changeset
796 AyuSysConfig::~AyuSysConfig(void) {
b6d6c0ffb423 Fixed some memory leaks
thib
parents: 0
diff changeset
797 delete str_config;
b6d6c0ffb423 Fixed some memory leaks
thib
parents: 0
diff changeset
798 delete int_config;
b6d6c0ffb423 Fixed some memory leaks
thib
parents: 0
diff changeset
799 }
0
223b71206888 Initial import
thib
parents:
diff changeset
800
223b71206888 Initial import
thib
parents:
diff changeset
801 static int SplitVar(const char* str, int* ret_var, int ret_size) {
223b71206888 Initial import
thib
parents:
diff changeset
802 /* , ¤¢¤ë¤¤¤Ï ),:( ¤ò¥»¥Ñ¥ì¡¼¥¿¤È¤·¤Æ¡¢-?[0-9]+ ¤Î
223b71206888 Initial import
thib
parents:
diff changeset
803 ** ¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¿ôÃÍÎó¤òÆɤ߹þ¤à¡£ÀèƬ¤Ë (¡¢ËöÈø¤Ë ) ¤¬ÉÕ¤­¤¦¤ë¡£
223b71206888 Initial import
thib
parents:
diff changeset
804 ** (),-[0-9] °Ê³°¤Îʸ»ú¤¬¤¢¤Ã¤¿¤é¤½¤³¤Ç½ªÎ»
223b71206888 Initial import
thib
parents:
diff changeset
805 ** ÆÀ¤é¤ì¤¿¥Ç¡¼¥¿¿ô¤òÊÖ¤¹
223b71206888 Initial import
thib
parents:
diff changeset
806 */
223b71206888 Initial import
thib
parents:
diff changeset
807 if (*str == '(') str++;
223b71206888 Initial import
thib
parents:
diff changeset
808 int i; for (i=0; i<ret_size; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
809 int c; int is_positive = 1;
223b71206888 Initial import
thib
parents:
diff changeset
810 /* ¥»¥Ñ¥ì¡¼¥¿¤ÎÆɤßÈô¤Ð¤· */
223b71206888 Initial import
thib
parents:
diff changeset
811 c = *str;
223b71206888 Initial import
thib
parents:
diff changeset
812 if (c == ',' || c == ':') {
223b71206888 Initial import
thib
parents:
diff changeset
813 str++;
223b71206888 Initial import
thib
parents:
diff changeset
814 } else if (c == ')' && str[1] == '(') {
223b71206888 Initial import
thib
parents:
diff changeset
815 str += 2;
223b71206888 Initial import
thib
parents:
diff changeset
816 }
223b71206888 Initial import
thib
parents:
diff changeset
817 /* - ¤ò parse */
223b71206888 Initial import
thib
parents:
diff changeset
818 c = *str;
223b71206888 Initial import
thib
parents:
diff changeset
819 if (c == '-' && isdigit(str[1])) {
223b71206888 Initial import
thib
parents:
diff changeset
820 is_positive = -1; str++;
223b71206888 Initial import
thib
parents:
diff changeset
821 } else if (! isdigit(c)) {
223b71206888 Initial import
thib
parents:
diff changeset
822 return i; /* °Û¾ï¤Êʸ»ú¤ò¸«¤Ä¤±¤¿¡§½ªÎ» */
223b71206888 Initial import
thib
parents:
diff changeset
823 }
223b71206888 Initial import
thib
parents:
diff changeset
824 int number = 0;
223b71206888 Initial import
thib
parents:
diff changeset
825 /* ¿ô»úÆɤ߹þ¤ß */
223b71206888 Initial import
thib
parents:
diff changeset
826 while(isdigit( (c=*str) )) {
223b71206888 Initial import
thib
parents:
diff changeset
827 number *= 10;
223b71206888 Initial import
thib
parents:
diff changeset
828 number += c-'0';
223b71206888 Initial import
thib
parents:
diff changeset
829 str++;
223b71206888 Initial import
thib
parents:
diff changeset
830 }
223b71206888 Initial import
thib
parents:
diff changeset
831 ret_var[i] = is_positive * number;
223b71206888 Initial import
thib
parents:
diff changeset
832 }
223b71206888 Initial import
thib
parents:
diff changeset
833 return i;
223b71206888 Initial import
thib
parents:
diff changeset
834 }
223b71206888 Initial import
thib
parents:
diff changeset
835 /* ·è¤á¤é¤ì¤¿¿ô¤Î°ú¿ô¤òÆÀ¤ë¡£-1 ¤Ê¤é¥¨¥é¡¼¤¬À¸¤¸¤¿ */
223b71206888 Initial import
thib
parents:
diff changeset
836 static inline int SplitVar(const char* str, int& var1) {
223b71206888 Initial import
thib
parents:
diff changeset
837 if (SplitVar(str, &var1, 1) != 1) return -1;
223b71206888 Initial import
thib
parents:
diff changeset
838 return 0;
223b71206888 Initial import
thib
parents:
diff changeset
839 }
223b71206888 Initial import
thib
parents:
diff changeset
840 static inline int SplitVar(const char* str, int& var1, int& var2) {
223b71206888 Initial import
thib
parents:
diff changeset
841 int vars[2];
223b71206888 Initial import
thib
parents:
diff changeset
842 if (SplitVar(str, vars, 2) != 2) return -1;
223b71206888 Initial import
thib
parents:
diff changeset
843 var1 = vars[0]; var2 = vars[1];
223b71206888 Initial import
thib
parents:
diff changeset
844 return 0;
223b71206888 Initial import
thib
parents:
diff changeset
845 }
223b71206888 Initial import
thib
parents:
diff changeset
846 static inline int SplitVar(const char* str, int& var1, int& var2, int& var3) {
223b71206888 Initial import
thib
parents:
diff changeset
847 int vars[3];
223b71206888 Initial import
thib
parents:
diff changeset
848 if (SplitVar(str, vars, 3) != 3) return -1;
223b71206888 Initial import
thib
parents:
diff changeset
849 var1 = vars[0]; var2 = vars[1]; var3 = vars[2];
223b71206888 Initial import
thib
parents:
diff changeset
850 return 0;
223b71206888 Initial import
thib
parents:
diff changeset
851 }
223b71206888 Initial import
thib
parents:
diff changeset
852 static inline int SplitVar(const char* str, int& var1, int& var2, int& var3, int& var4) {
223b71206888 Initial import
thib
parents:
diff changeset
853 int vars[4];
223b71206888 Initial import
thib
parents:
diff changeset
854 if (SplitVar(str, vars, 4) != 4) return -1;
223b71206888 Initial import
thib
parents:
diff changeset
855 var1 = vars[0]; var2 = vars[1]; var3 = vars[2]; var4 = vars[3];
223b71206888 Initial import
thib
parents:
diff changeset
856 return 0;
223b71206888 Initial import
thib
parents:
diff changeset
857 }
223b71206888 Initial import
thib
parents:
diff changeset
858
223b71206888 Initial import
thib
parents:
diff changeset
859 bool AyuSysConfig::LoadInitFile(void)
223b71206888 Initial import
thib
parents:
diff changeset
860 {
223b71206888 Initial import
thib
parents:
diff changeset
861 char buf[1024]; int i;
223b71206888 Initial import
thib
parents:
diff changeset
862 char* tokens[MAXTOKEN]; int token_deal; int buf_ptr;
223b71206888 Initial import
thib
parents:
diff changeset
863 int numbers[MAXVARS];
223b71206888 Initial import
thib
parents:
diff changeset
864
223b71206888 Initial import
thib
parents:
diff changeset
865 ARCINFO* info = file_searcher.Find(FILESEARCH::ROOT, "gameexe.ini");
223b71206888 Initial import
thib
parents:
diff changeset
866 if (info == NULL) return false;
223b71206888 Initial import
thib
parents:
diff changeset
867 int size = info->Size();
223b71206888 Initial import
thib
parents:
diff changeset
868 unsigned char* buf_orig = (unsigned char*)info->Read();
223b71206888 Initial import
thib
parents:
diff changeset
869 if (size <= 0 || buf_orig == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
870 delete info; return false;
223b71206888 Initial import
thib
parents:
diff changeset
871 }
223b71206888 Initial import
thib
parents:
diff changeset
872 unsigned char* buf_end = buf_orig + size;
223b71206888 Initial import
thib
parents:
diff changeset
873 int line_count = 0;
223b71206888 Initial import
thib
parents:
diff changeset
874 while(buf_orig < buf_end) {
223b71206888 Initial import
thib
parents:
diff changeset
875 /* buf_orig ¤«¤é°ì¹ÔÆɤ߹þ¤à */
223b71206888 Initial import
thib
parents:
diff changeset
876 /* ¤½¤ÎºÝ¤Ë¡¢
223b71206888 Initial import
thib
parents:
diff changeset
877 ** ¡¦Æ¬¤¬ # °Ê³°¤Ê¤é¼¡¤Î¹Ô¤Þ¤Ç¤È¤Ð¤¹
223b71206888 Initial import
thib
parents:
diff changeset
878 ** ¡¦"" ³°¤Î¥¹¥Ú¡¼¥¹¡¢TAB¤ò½é¤á¤È¤¹¤ëÀ©¸æʸ»ú (0x20 °Ê²¼¤ÎASCII¥³¡¼¥É)¤òºï½ü
223b71206888 Initial import
thib
parents:
diff changeset
879 ** ¡¦= ¤Ç¶èÀڤ롣¶èÀÚ¤ê¤ÏºÇÂç¤Ç10¸Ä¤Ç¡¢tokens ¤ËÂåÆþ¤µ¤ì¤ë
223b71206888 Initial import
thib
parents:
diff changeset
880 ** ¤Ê¤É¤ÎÁàºî¤ò¹Ô¤¦
223b71206888 Initial import
thib
parents:
diff changeset
881 */
223b71206888 Initial import
thib
parents:
diff changeset
882
223b71206888 Initial import
thib
parents:
diff changeset
883 /* # ¥Á¥§¥Ã¥¯ */
223b71206888 Initial import
thib
parents:
diff changeset
884 if (*buf_orig != '#') {
223b71206888 Initial import
thib
parents:
diff changeset
885 /* ¼¡¤Î '\n' ¤Þ¤ÇÆɤßÈô¤Ð¤· */
223b71206888 Initial import
thib
parents:
diff changeset
886 while(buf_orig < buf_end &&
223b71206888 Initial import
thib
parents:
diff changeset
887 *buf_orig != '\n' && *buf_orig != '\r') buf_orig++;
223b71206888 Initial import
thib
parents:
diff changeset
888 if (buf_orig < buf_end-1 && *buf_orig == '\r' && buf_orig[1] == '\n') buf_orig += 2;
223b71206888 Initial import
thib
parents:
diff changeset
889 else if (*buf_orig == '\r' || *buf_orig == '\n') buf_orig++;
223b71206888 Initial import
thib
parents:
diff changeset
890 line_count++;
223b71206888 Initial import
thib
parents:
diff changeset
891 continue;
223b71206888 Initial import
thib
parents:
diff changeset
892 }
223b71206888 Initial import
thib
parents:
diff changeset
893 /* ½é´ü²½ */
223b71206888 Initial import
thib
parents:
diff changeset
894 token_deal = 1; tokens[0] = buf; buf_ptr = 0;
223b71206888 Initial import
thib
parents:
diff changeset
895 int in_quote = 0;
223b71206888 Initial import
thib
parents:
diff changeset
896
223b71206888 Initial import
thib
parents:
diff changeset
897 while(buf_orig < buf_end && buf_ptr < 1023) {
223b71206888 Initial import
thib
parents:
diff changeset
898 if (in_quote) {
223b71206888 Initial import
thib
parents:
diff changeset
899 /* "" ¤ÎÃæ */
223b71206888 Initial import
thib
parents:
diff changeset
900 int c = *buf_orig;
223b71206888 Initial import
thib
parents:
diff changeset
901 if (c == '\n' || c == '\r') {
223b71206888 Initial import
thib
parents:
diff changeset
902 break;
223b71206888 Initial import
thib
parents:
diff changeset
903 } else if (c == '\"') {
223b71206888 Initial import
thib
parents:
diff changeset
904 in_quote = 0;
223b71206888 Initial import
thib
parents:
diff changeset
905 } else {
223b71206888 Initial import
thib
parents:
diff changeset
906 buf[buf_ptr++] = c;
223b71206888 Initial import
thib
parents:
diff changeset
907 }
223b71206888 Initial import
thib
parents:
diff changeset
908 buf_orig++;
223b71206888 Initial import
thib
parents:
diff changeset
909 } else { /* quote ¤µ¤ì¤Æ¤Ê¤¤ */
223b71206888 Initial import
thib
parents:
diff changeset
910 /* À©¸æʸ»ú¤òÆɤßÈô¤Ð¤¹ */
223b71206888 Initial import
thib
parents:
diff changeset
911 while(*buf_orig <= 0x20 && buf_orig < buf_end &&
223b71206888 Initial import
thib
parents:
diff changeset
912 *buf_orig != '\n' && *buf_orig != '\r') buf_orig++;
223b71206888 Initial import
thib
parents:
diff changeset
913 int c = *buf_orig;
223b71206888 Initial import
thib
parents:
diff changeset
914 if (c == '\n' || c == '\r') break;
223b71206888 Initial import
thib
parents:
diff changeset
915 /* = ¤Ê¤é¼¡¤Î token */
223b71206888 Initial import
thib
parents:
diff changeset
916 if (c == '=') {
223b71206888 Initial import
thib
parents:
diff changeset
917 c = 0; tokens[token_deal++] = buf+buf_ptr+1;
223b71206888 Initial import
thib
parents:
diff changeset
918 if (token_deal >= MAXTOKEN) break;
223b71206888 Initial import
thib
parents:
diff changeset
919 } else if (c == '\"') {
223b71206888 Initial import
thib
parents:
diff changeset
920 in_quote = 1; buf_orig++; continue;
223b71206888 Initial import
thib
parents:
diff changeset
921 }
223b71206888 Initial import
thib
parents:
diff changeset
922 buf[buf_ptr++] = c;
223b71206888 Initial import
thib
parents:
diff changeset
923 buf_orig++;
223b71206888 Initial import
thib
parents:
diff changeset
924 }
223b71206888 Initial import
thib
parents:
diff changeset
925 }
223b71206888 Initial import
thib
parents:
diff changeset
926 buf[buf_ptr] = '\0';
223b71206888 Initial import
thib
parents:
diff changeset
927 /* ËöÈø¤Î \r\n ¤ò¾Ãµî */
223b71206888 Initial import
thib
parents:
diff changeset
928 if (buf_orig < buf_end-1 && buf_orig[0] == '\r' && buf_orig[1] == '\n') buf_orig += 2;
223b71206888 Initial import
thib
parents:
diff changeset
929 else if (buf_orig < buf_end && (buf_orig[0] == '\r' || buf_orig[0] == '\n')) buf_orig++;
223b71206888 Initial import
thib
parents:
diff changeset
930 /* ɬÍפʤé parse ÆâÍƤò½ÐÎÏ */
223b71206888 Initial import
thib
parents:
diff changeset
931 dprintf(("line %3d ",line_count));
223b71206888 Initial import
thib
parents:
diff changeset
932 for (i=0; i<token_deal; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
933 dprintf(("%d:\"%s\", ",i,tokens[i]));
223b71206888 Initial import
thib
parents:
diff changeset
934 }
223b71206888 Initial import
thib
parents:
diff changeset
935 dprintf(("\n"));
223b71206888 Initial import
thib
parents:
diff changeset
936 if (in_quote) {
223b71206888 Initial import
thib
parents:
diff changeset
937 fprintf(stderr, "Warning : open quote is found while parsing gameexe.ini, line %d\n",line_count);
223b71206888 Initial import
thib
parents:
diff changeset
938 }
223b71206888 Initial import
thib
parents:
diff changeset
939
223b71206888 Initial import
thib
parents:
diff changeset
940
223b71206888 Initial import
thib
parents:
diff changeset
941 /* ÆÀ¤é¤ì¤¿ÆâÍƤò parse */
223b71206888 Initial import
thib
parents:
diff changeset
942
223b71206888 Initial import
thib
parents:
diff changeset
943 /* #NAME=<ʸ»úÎó> */
223b71206888 Initial import
thib
parents:
diff changeset
944 int type = SearchParam(tokens[0]);
223b71206888 Initial import
thib
parents:
diff changeset
945 if (type == 1) { /* #NAME=<ʸ»úÎó> */
223b71206888 Initial import
thib
parents:
diff changeset
946 if (token_deal != 2) {
223b71206888 Initial import
thib
parents:
diff changeset
947 dprintf(("Parse error, line %d, %s\n",line_count, tokens[0]));
223b71206888 Initial import
thib
parents:
diff changeset
948 goto parse_error;
223b71206888 Initial import
thib
parents:
diff changeset
949 }
223b71206888 Initial import
thib
parents:
diff changeset
950 SetOrigParaStr(tokens[0], tokens[1]);
223b71206888 Initial import
thib
parents:
diff changeset
951 goto parse_end;
223b71206888 Initial import
thib
parents:
diff changeset
952 } else if (type == 2) { /* #NAME=<¿ôÃÍÎó> */
223b71206888 Initial import
thib
parents:
diff changeset
953 if (token_deal != 2) {
223b71206888 Initial import
thib
parents:
diff changeset
954 dprintf(("Parse error, line %d, %s\n",line_count, tokens[0]));
223b71206888 Initial import
thib
parents:
diff changeset
955 goto parse_error;
223b71206888 Initial import
thib
parents:
diff changeset
956 }
223b71206888 Initial import
thib
parents:
diff changeset
957 int number_deal = SplitVar(tokens[1], numbers, MAXVARS);
223b71206888 Initial import
thib
parents:
diff changeset
958 SetOrigParamArray(tokens[0], number_deal, numbers);
223b71206888 Initial import
thib
parents:
diff changeset
959 goto parse_end;
223b71206888 Initial import
thib
parents:
diff changeset
960 }
223b71206888 Initial import
thib
parents:
diff changeset
961 /* °ìÈÌŪ¤ÊÀßÄê°Ê³° : cdrom track ¤Ê¤É */
223b71206888 Initial import
thib
parents:
diff changeset
962 if (strncmp(tokens[0],"#NAME.", 6) == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
963 if (token_deal != 2) goto parse_error;
223b71206888 Initial import
thib
parents:
diff changeset
964 SetOrigParaStr(tokens[0], tokens[1]);
223b71206888 Initial import
thib
parents:
diff changeset
965 goto parse_end;
223b71206888 Initial import
thib
parents:
diff changeset
966 } else if (strncmp(tokens[0],"#DIRC.",6) == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
967 if (token_deal != 3) goto parse_error;
223b71206888 Initial import
thib
parents:
diff changeset
968 /* ¥Õ¥¡¥¤¥ë·Á¼°¤Î»ØÄê */
223b71206888 Initial import
thib
parents:
diff changeset
969 FILESEARCH::FILETYPE type;
223b71206888 Initial import
thib
parents:
diff changeset
970 char* name = tokens[0]+6;
223b71206888 Initial import
thib
parents:
diff changeset
971 if (strcmp(name, "PDT") == 0) type = FILESEARCH::PDT;
223b71206888 Initial import
thib
parents:
diff changeset
972 else if (strcmp(name, "G00") == 0) type = FILESEARCH::PDT;
223b71206888 Initial import
thib
parents:
diff changeset
973 else if (strcmp(name, "GRP") == 0) type = FILESEARCH::PDT;
223b71206888 Initial import
thib
parents:
diff changeset
974 else if (strcmp(name, "TXT") == 0) type = FILESEARCH::SCN;
223b71206888 Initial import
thib
parents:
diff changeset
975 else if (strcmp(name, "ANM") == 0) type = FILESEARCH::ANM;
223b71206888 Initial import
thib
parents:
diff changeset
976 else if (strcmp(name, "ARD") == 0) type = FILESEARCH::ARD;
223b71206888 Initial import
thib
parents:
diff changeset
977 else if (strcmp(name, "CUR") == 0) type = FILESEARCH::CUR;
223b71206888 Initial import
thib
parents:
diff changeset
978 else if (strcmp(name, "WAV") == 0) type = FILESEARCH::WAV;
223b71206888 Initial import
thib
parents:
diff changeset
979 else if (strcmp(name, "KOE") == 0) type = FILESEARCH::KOE;
223b71206888 Initial import
thib
parents:
diff changeset
980 else if (strcmp(name, "GAN") == 0) type = FILESEARCH::GAN;
223b71206888 Initial import
thib
parents:
diff changeset
981 else goto parse_error; /* ¾¤Ë ALL,ROOT,MID,KOE,BGM¡£¤¿¤Ö¤ó¡¢Â¸ºß¤·¤Ê¤¤ */
223b71206888 Initial import
thib
parents:
diff changeset
982 if (tokens[2][0] == 'N') { /* directory */
223b71206888 Initial import
thib
parents:
diff changeset
983 file_searcher.SetFileInformation(type, FILESEARCH::ATYPE_DIR, tokens[1]);
223b71206888 Initial import
thib
parents:
diff changeset
984 dprintf(("set file directory; type %s, directory %s\n",name,tokens[1]));
223b71206888 Initial import
thib
parents:
diff changeset
985 } else if (tokens[2][0] == 'P' && tokens[2][1] == ':') { /* ¥¢¡¼¥«¥¤¥Ö */
223b71206888 Initial import
thib
parents:
diff changeset
986 file_searcher.SetFileInformation(type, FILESEARCH::ATYPE_ARC, tokens[2]+2);
223b71206888 Initial import
thib
parents:
diff changeset
987 dprintf(("set file archive; type %s, file %s\n",name,tokens[2]+2));
223b71206888 Initial import
thib
parents:
diff changeset
988 } else goto parse_error;
223b71206888 Initial import
thib
parents:
diff changeset
989 goto parse_end;
223b71206888 Initial import
thib
parents:
diff changeset
990 }
223b71206888 Initial import
thib
parents:
diff changeset
991 if (strncmp(tokens[0],"#ADRC.",6) == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
992 if (token_deal != 3) goto parse_error;
223b71206888 Initial import
thib
parents:
diff changeset
993 /* ¥Õ¥¡¥¤¥ë·Á¼°¤Î»ØÄê */
223b71206888 Initial import
thib
parents:
diff changeset
994 FILESEARCH::FILETYPE type;
223b71206888 Initial import
thib
parents:
diff changeset
995 char* name = tokens[0]+6;
223b71206888 Initial import
thib
parents:
diff changeset
996 if (strcmp(name, "PDT") == 0) type = FILESEARCH::PDT;
223b71206888 Initial import
thib
parents:
diff changeset
997 else if (strcmp(name, "G00") == 0) type = FILESEARCH::PDT;
223b71206888 Initial import
thib
parents:
diff changeset
998 else if (strcmp(name, "GRP") == 0) type = FILESEARCH::PDT;
223b71206888 Initial import
thib
parents:
diff changeset
999 else if (strcmp(name, "TXT") == 0) type = FILESEARCH::SCN;
223b71206888 Initial import
thib
parents:
diff changeset
1000 else if (strcmp(name, "ANM") == 0) type = FILESEARCH::ANM;
223b71206888 Initial import
thib
parents:
diff changeset
1001 else if (strcmp(name, "ARD") == 0) type = FILESEARCH::ARD;
223b71206888 Initial import
thib
parents:
diff changeset
1002 else if (strcmp(name, "CUR") == 0) type = FILESEARCH::CUR;
223b71206888 Initial import
thib
parents:
diff changeset
1003 else if (strcmp(name, "WAV") == 0) type = FILESEARCH::WAV;
223b71206888 Initial import
thib
parents:
diff changeset
1004 else if (strcmp(name, "KOE") == 0) type = FILESEARCH::KOE;
223b71206888 Initial import
thib
parents:
diff changeset
1005 else if (strcmp(name, "GAN") == 0) type = FILESEARCH::GAN;
223b71206888 Initial import
thib
parents:
diff changeset
1006 else goto parse_error; /* ¾¤Ë ALL,ROOT,MID,KOE,BGM¡£¤¿¤Ö¤ó¡¢Â¸ºß¤·¤Ê¤¤ */
223b71206888 Initial import
thib
parents:
diff changeset
1007 if (tokens[2][0] == 'N') { /* directory */
223b71206888 Initial import
thib
parents:
diff changeset
1008 file_searcher.AppendFileInformation(type, FILESEARCH::ATYPE_DIR, tokens[1]);
223b71206888 Initial import
thib
parents:
diff changeset
1009 dprintf(("set file directory; type %s, directory %s\n",name,tokens[1]));
223b71206888 Initial import
thib
parents:
diff changeset
1010 } else if (tokens[2][0] == 'P' && tokens[2][1] == ':') { /* ¥¢¡¼¥«¥¤¥Ö */
223b71206888 Initial import
thib
parents:
diff changeset
1011 file_searcher.AppendFileInformation(type, FILESEARCH::ATYPE_ARC, tokens[2]+2);
223b71206888 Initial import
thib
parents:
diff changeset
1012 dprintf(("set file archive; type %s, file %s\n",name,tokens[2]+2));
223b71206888 Initial import
thib
parents:
diff changeset
1013 } else if (tokens[2][0] == 'R' && tokens[2][1] == ':') { /* ¤½¤ì»¶¤ë¥¢¡¼¥«¥¤¥Ö */
223b71206888 Initial import
thib
parents:
diff changeset
1014 file_searcher.AppendFileInformation(type, FILESEARCH::ATYPE_ARC, tokens[2]+2);
223b71206888 Initial import
thib
parents:
diff changeset
1015 dprintf(("set file archive; type %s, file %s\n",name,tokens[2]+2));
223b71206888 Initial import
thib
parents:
diff changeset
1016 } else goto parse_error;
223b71206888 Initial import
thib
parents:
diff changeset
1017 goto parse_end;
223b71206888 Initial import
thib
parents:
diff changeset
1018 }
223b71206888 Initial import
thib
parents:
diff changeset
1019 if (strncmp(tokens[0],"#FOLDNAME.",10) == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
1020 if (token_deal != 3) goto parse_error;
223b71206888 Initial import
thib
parents:
diff changeset
1021 /* ¥Õ¥¡¥¤¥ë·Á¼°¤Î»ØÄê */
223b71206888 Initial import
thib
parents:
diff changeset
1022 FILESEARCH::FILETYPE type;
223b71206888 Initial import
thib
parents:
diff changeset
1023 char* name = tokens[0]+10;
223b71206888 Initial import
thib
parents:
diff changeset
1024 if (strcmp(name, "PDT") == 0) type = FILESEARCH::PDT;
223b71206888 Initial import
thib
parents:
diff changeset
1025 else if (strcmp(name, "G00") == 0) type = FILESEARCH::PDT;
223b71206888 Initial import
thib
parents:
diff changeset
1026 else if (strcmp(name, "GRP") == 0) type = FILESEARCH::PDT;
223b71206888 Initial import
thib
parents:
diff changeset
1027 else if (strcmp(name, "TXT") == 0) type = FILESEARCH::SCN;
223b71206888 Initial import
thib
parents:
diff changeset
1028 else if (strcmp(name, "ANM") == 0) type = FILESEARCH::ANM;
223b71206888 Initial import
thib
parents:
diff changeset
1029 else if (strcmp(name, "ARD") == 0) type = FILESEARCH::ARD;
223b71206888 Initial import
thib
parents:
diff changeset
1030 else if (strcmp(name, "CUR") == 0) type = FILESEARCH::CUR;
223b71206888 Initial import
thib
parents:
diff changeset
1031 else if (strcmp(name, "WAV") == 0) type = FILESEARCH::WAV;
223b71206888 Initial import
thib
parents:
diff changeset
1032 else if (strcmp(name, "BGM") == 0) type = FILESEARCH::BGM;
223b71206888 Initial import
thib
parents:
diff changeset
1033 else if (strcmp(name, "GAN") == 0) type = FILESEARCH::GAN;
223b71206888 Initial import
thib
parents:
diff changeset
1034 else goto parse_error; /* ¾¤Ë ALL,ROOT,MID,KOE,BGM¡£¤¿¤Ö¤ó¡¢Â¸ºß¤·¤Ê¤¤ */
223b71206888 Initial import
thib
parents:
diff changeset
1035 if (tokens[2][0] == '0') { /* directory */
223b71206888 Initial import
thib
parents:
diff changeset
1036 file_searcher.AppendFileInformation(type, FILESEARCH::ATYPE_DIR, tokens[1]);
223b71206888 Initial import
thib
parents:
diff changeset
1037 dprintf(("set file directory; type %s, directory %s\n",name,tokens[1]));
223b71206888 Initial import
thib
parents:
diff changeset
1038 } else if (tokens[2][0] == '1' && tokens[2][1] == ':') { /* ¥¢¡¼¥«¥¤¥Ö */
223b71206888 Initial import
thib
parents:
diff changeset
1039 file_searcher.AppendFileInformation(type, FILESEARCH::ATYPE_SCN2k, tokens[2]+2);
223b71206888 Initial import
thib
parents:
diff changeset
1040 dprintf(("set file archive; type %s, file %s\n",name,tokens[2]+2));
223b71206888 Initial import
thib
parents:
diff changeset
1041 } else goto parse_error;
223b71206888 Initial import
thib
parents:
diff changeset
1042 goto parse_end;
223b71206888 Initial import
thib
parents:
diff changeset
1043 }
223b71206888 Initial import
thib
parents:
diff changeset
1044 if (strcmp(tokens[0], "#CDTRACK") == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
1045 if (token_deal != 3) goto parse_error;
223b71206888 Initial import
thib
parents:
diff changeset
1046 track_name.AddCDROM(tokens[2], atoi(tokens[1]));
223b71206888 Initial import
thib
parents:
diff changeset
1047 dprintf(("Set CDTRACK, name %s, track %d\n",tokens[2], atoi(tokens[1])));
223b71206888 Initial import
thib
parents:
diff changeset
1048 goto parse_end;
223b71206888 Initial import
thib
parents:
diff changeset
1049 }
223b71206888 Initial import
thib
parents:
diff changeset
1050 if (strcmp(tokens[0], "#DSTRACK") == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
1051 /* #DSTRACK=00000000-99999000-00782556="filename" ="name" */
223b71206888 Initial import
thib
parents:
diff changeset
1052 /* #DSTRACK=00000000-99999000-00782556="name" */
223b71206888 Initial import
thib
parents:
diff changeset
1053 /* ÂèÆó¥È¡¼¥¯¥ó¤Î£³¤Ä¤á¤Î¥Ñ¥é¥á¡¼¥¿¤òÆÀ¤ë¡Ê·«¤êÊÖ¤·¤Î»þ¤ÎºÆÀ¸³«»Ï°ÌÃÖ¡Ë */
223b71206888 Initial import
thib
parents:
diff changeset
1054 int start_pt = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1055 const char* tk1 = strchr(tokens[1], '-');
223b71206888 Initial import
thib
parents:
diff changeset
1056 const char* tk2 = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1057 if (tk1 && *tk1) tk2 = strchr(tk1+1, '-');
223b71206888 Initial import
thib
parents:
diff changeset
1058 if (tk2 && *tk2) start_pt = atoi(tk2+1);
223b71206888 Initial import
thib
parents:
diff changeset
1059 if (token_deal == 3) {
223b71206888 Initial import
thib
parents:
diff changeset
1060 track_name.AddWave(tokens[2], tokens[2], start_pt);
223b71206888 Initial import
thib
parents:
diff changeset
1061 dprintf(("Set Wave track, name %s\n",tokens[2]));
223b71206888 Initial import
thib
parents:
diff changeset
1062 } else if (token_deal == 4) {
223b71206888 Initial import
thib
parents:
diff changeset
1063 track_name.AddWave(tokens[3], tokens[2], start_pt);
223b71206888 Initial import
thib
parents:
diff changeset
1064 dprintf(("Set Wave track, name %s, file %s\n",tokens[3], tokens[2]));
223b71206888 Initial import
thib
parents:
diff changeset
1065 } else goto parse_error;
223b71206888 Initial import
thib
parents:
diff changeset
1066 goto parse_end;
223b71206888 Initial import
thib
parents:
diff changeset
1067 }
223b71206888 Initial import
thib
parents:
diff changeset
1068 if (strncmp(tokens[0], "#SE.", 4) == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
1069 /* SE.XXX="XXX"=X */
223b71206888 Initial import
thib
parents:
diff changeset
1070 if (token_deal == 2) {
223b71206888 Initial import
thib
parents:
diff changeset
1071 track_name.AddSE(atoi(tokens[0]+4), tokens[1]);
223b71206888 Initial import
thib
parents:
diff changeset
1072 } else if (token_deal == 3) {
223b71206888 Initial import
thib
parents:
diff changeset
1073 if (atoi(tokens[2]) != 0) {
223b71206888 Initial import
thib
parents:
diff changeset
1074 track_name.AddSE(atoi(tokens[0]+4), tokens[1]);
223b71206888 Initial import
thib
parents:
diff changeset
1075 }
223b71206888 Initial import
thib
parents:
diff changeset
1076 }
223b71206888 Initial import
thib
parents:
diff changeset
1077 dprintf(("Set SE %d, name %s\n",atoi(tokens[0]+4), tokens[1]));
223b71206888 Initial import
thib
parents:
diff changeset
1078 goto parse_end;
223b71206888 Initial import
thib
parents:
diff changeset
1079 }
223b71206888 Initial import
thib
parents:
diff changeset
1080 /* ÀßÄê¹àÌܤ¬¸«¤Ä¤«¤é¤Ê¤«¤Ã¤¿ */
223b71206888 Initial import
thib
parents:
diff changeset
1081 dprintf(("Cannot find configuration name: %s\n",tokens[0]));
223b71206888 Initial import
thib
parents:
diff changeset
1082 parse_error:
223b71206888 Initial import
thib
parents:
diff changeset
1083 parse_end:
223b71206888 Initial import
thib
parents:
diff changeset
1084 line_count++;
223b71206888 Initial import
thib
parents:
diff changeset
1085 }
223b71206888 Initial import
thib
parents:
diff changeset
1086 delete info;
223b71206888 Initial import
thib
parents:
diff changeset
1087 /* ¥Ç¥Õ¥©¥ë¥È¤Î¥ª¥×¥·¥ç¥ó¤ò»ØÄꤹ¤ë */
223b71206888 Initial import
thib
parents:
diff changeset
1088 // set_game(GetParaStr("#REGNAME"), *this);
223b71206888 Initial import
thib
parents:
diff changeset
1089 return true;
223b71206888 Initial import
thib
parents:
diff changeset
1090 }
223b71206888 Initial import
thib
parents:
diff changeset
1091
223b71206888 Initial import
thib
parents:
diff changeset
1092 TrackName::TrackName(void) {
223b71206888 Initial import
thib
parents:
diff changeset
1093 deal = 1;
223b71206888 Initial import
thib
parents:
diff changeset
1094 track = new char*[deal];
223b71206888 Initial import
thib
parents:
diff changeset
1095 track_wave = new char*[deal];
223b71206888 Initial import
thib
parents:
diff changeset
1096 track_num = new int[deal];
223b71206888 Initial import
thib
parents:
diff changeset
1097 track_start = new int[deal];
223b71206888 Initial import
thib
parents:
diff changeset
1098 int i; for (i=0; i<deal; i++) track[i] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1099 for (i=0; i<deal; i++) track_wave[i] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1100 se_deal = 10;
223b71206888 Initial import
thib
parents:
diff changeset
1101 se_track = new char*[se_deal];
223b71206888 Initial import
thib
parents:
diff changeset
1102 for (i=0; i<se_deal; i++) se_track[i] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1103 }
223b71206888 Initial import
thib
parents:
diff changeset
1104
223b71206888 Initial import
thib
parents:
diff changeset
1105 TrackName::~TrackName() {
223b71206888 Initial import
thib
parents:
diff changeset
1106 int i; for (i=0; i<deal; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
1107 if (track[i] != 0) delete[] track[i];
223b71206888 Initial import
thib
parents:
diff changeset
1108 if (track_wave[i] != 0) delete[] track_wave[i];
223b71206888 Initial import
thib
parents:
diff changeset
1109 }
223b71206888 Initial import
thib
parents:
diff changeset
1110 for (i=0; i<se_deal; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
1111 if (se_track[i]) delete[] se_track[i];
223b71206888 Initial import
thib
parents:
diff changeset
1112 }
223b71206888 Initial import
thib
parents:
diff changeset
1113 delete[] track;
223b71206888 Initial import
thib
parents:
diff changeset
1114 delete[] track_wave;
223b71206888 Initial import
thib
parents:
diff changeset
1115 delete[] track_num;
223b71206888 Initial import
thib
parents:
diff changeset
1116 delete[] track_start;
223b71206888 Initial import
thib
parents:
diff changeset
1117 delete[] se_track;
223b71206888 Initial import
thib
parents:
diff changeset
1118 }
223b71206888 Initial import
thib
parents:
diff changeset
1119 void TrackName::Expand(void) {
223b71206888 Initial import
thib
parents:
diff changeset
1120 int new_deal = deal * 2;
223b71206888 Initial import
thib
parents:
diff changeset
1121 int* new_track_num = new int[new_deal];
223b71206888 Initial import
thib
parents:
diff changeset
1122 int* new_track_start = new int[new_deal];
223b71206888 Initial import
thib
parents:
diff changeset
1123 char** new_track = new char*[new_deal];
223b71206888 Initial import
thib
parents:
diff changeset
1124 char** new_track_wave = new char*[new_deal];
223b71206888 Initial import
thib
parents:
diff changeset
1125 int i; for (i=0; i<deal; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
1126 new_track_num[i] = track_num[i];
223b71206888 Initial import
thib
parents:
diff changeset
1127 new_track_start[i] = track_start[i];
223b71206888 Initial import
thib
parents:
diff changeset
1128 new_track[i] = track[i];
223b71206888 Initial import
thib
parents:
diff changeset
1129 new_track_wave[i] = track_wave[i];
223b71206888 Initial import
thib
parents:
diff changeset
1130 }
223b71206888 Initial import
thib
parents:
diff changeset
1131 for (; i<new_deal; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
1132 new_track_num[i] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1133 new_track_start[i] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1134 new_track[i] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1135 new_track_wave[i] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1136 }
223b71206888 Initial import
thib
parents:
diff changeset
1137 deal = new_deal;
223b71206888 Initial import
thib
parents:
diff changeset
1138 delete[] track; track = new_track;
223b71206888 Initial import
thib
parents:
diff changeset
1139 delete[] track_num; track_num= new_track_num;
223b71206888 Initial import
thib
parents:
diff changeset
1140 delete[] track_start; track_start= new_track_start;
223b71206888 Initial import
thib
parents:
diff changeset
1141 delete[] track_wave; track_wave = new_track_wave;
223b71206888 Initial import
thib
parents:
diff changeset
1142 }
223b71206888 Initial import
thib
parents:
diff changeset
1143 void TrackName::ExpandSE(int n) {
223b71206888 Initial import
thib
parents:
diff changeset
1144 if (n < 0) return;
223b71206888 Initial import
thib
parents:
diff changeset
1145 n += 10;
223b71206888 Initial import
thib
parents:
diff changeset
1146 if (se_deal >= n) return;
223b71206888 Initial import
thib
parents:
diff changeset
1147 char** new_se = new char*[n];
223b71206888 Initial import
thib
parents:
diff changeset
1148 int i; for (i=0; i<se_deal; i++) new_se[i] = se_track[i];
223b71206888 Initial import
thib
parents:
diff changeset
1149 for (; i<n; i++) new_se[i] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1150 delete[] se_track;
223b71206888 Initial import
thib
parents:
diff changeset
1151 se_deal = n; se_track = new_se;
223b71206888 Initial import
thib
parents:
diff changeset
1152 }
223b71206888 Initial import
thib
parents:
diff changeset
1153 void TrackName::AddCDROM(char* name, int tk) {
223b71206888 Initial import
thib
parents:
diff changeset
1154 if (CDTrack(name) != -1) return;
223b71206888 Initial import
thib
parents:
diff changeset
1155 int i; for (i=0; i<deal; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
1156 if (track[i] == 0) break;
223b71206888 Initial import
thib
parents:
diff changeset
1157 }
223b71206888 Initial import
thib
parents:
diff changeset
1158 int num = i;
223b71206888 Initial import
thib
parents:
diff changeset
1159 if (i == deal) Expand();
223b71206888 Initial import
thib
parents:
diff changeset
1160 track[num] = new char[strlen(name)+1];
223b71206888 Initial import
thib
parents:
diff changeset
1161 for (i=0; name[i] != 0; i++) track[num][i] = tolower(name[i]);
223b71206888 Initial import
thib
parents:
diff changeset
1162 track[num][i] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1163 track_num[num] = tk;
223b71206888 Initial import
thib
parents:
diff changeset
1164 }
223b71206888 Initial import
thib
parents:
diff changeset
1165 void TrackName::AddWave(char* name, char* file, int pt) {
223b71206888 Initial import
thib
parents:
diff changeset
1166 if (CDTrack(name) != -1) return;
223b71206888 Initial import
thib
parents:
diff changeset
1167 int i; for (i=0; i<deal; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
1168 if (track[i] == 0) break;
223b71206888 Initial import
thib
parents:
diff changeset
1169 }
223b71206888 Initial import
thib
parents:
diff changeset
1170 int num = i;
223b71206888 Initial import
thib
parents:
diff changeset
1171 if (i == deal) Expand();
223b71206888 Initial import
thib
parents:
diff changeset
1172 track_num[num] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1173 track_start[num] = pt;
223b71206888 Initial import
thib
parents:
diff changeset
1174 track[num] = new char[strlen(name)+1];
223b71206888 Initial import
thib
parents:
diff changeset
1175 for (i=0; name[i] != 0; i++) track[num][i] = tolower(name[i]);
223b71206888 Initial import
thib
parents:
diff changeset
1176 track[num][i] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1177 track_wave[num] = new char[strlen(file)+1]; strcpy(track_wave[num], file);
223b71206888 Initial import
thib
parents:
diff changeset
1178 }
223b71206888 Initial import
thib
parents:
diff changeset
1179 int TrackName::CDTrack(char* name) {
223b71206888 Initial import
thib
parents:
diff changeset
1180 char buf[1024];
223b71206888 Initial import
thib
parents:
diff changeset
1181 int i;
223b71206888 Initial import
thib
parents:
diff changeset
1182 for (i=0; name[i]!=0; i++) buf[i]=tolower(name[i]);
223b71206888 Initial import
thib
parents:
diff changeset
1183 buf[i]=0;
223b71206888 Initial import
thib
parents:
diff changeset
1184 for (i=0; i<deal; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
1185 if (track[i] == 0) return -1;
223b71206888 Initial import
thib
parents:
diff changeset
1186 if (strcmp(track[i], buf) == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
1187 return track_num[i];
223b71206888 Initial import
thib
parents:
diff changeset
1188 }
223b71206888 Initial import
thib
parents:
diff changeset
1189 }
223b71206888 Initial import
thib
parents:
diff changeset
1190 return -1;
223b71206888 Initial import
thib
parents:
diff changeset
1191 }
223b71206888 Initial import
thib
parents:
diff changeset
1192 int TrackName::TrackStart(char* name) {
223b71206888 Initial import
thib
parents:
diff changeset
1193 char buf[1024];
223b71206888 Initial import
thib
parents:
diff changeset
1194 int i;
223b71206888 Initial import
thib
parents:
diff changeset
1195 for (i=0; name[i]!=0; i++) buf[i]=tolower(name[i]);
223b71206888 Initial import
thib
parents:
diff changeset
1196 buf[i]=0;
223b71206888 Initial import
thib
parents:
diff changeset
1197 for (i=0; i<deal; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
1198 if (track[i] == 0) return -1;
223b71206888 Initial import
thib
parents:
diff changeset
1199 if (strcmp(track[i], buf) == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
1200 return track_start[i];
223b71206888 Initial import
thib
parents:
diff changeset
1201 }
223b71206888 Initial import
thib
parents:
diff changeset
1202 }
223b71206888 Initial import
thib
parents:
diff changeset
1203 return 0;
223b71206888 Initial import
thib
parents:
diff changeset
1204 }
223b71206888 Initial import
thib
parents:
diff changeset
1205 const char* TrackName::WaveTrack(char* name) {
223b71206888 Initial import
thib
parents:
diff changeset
1206 char buf[1024];
223b71206888 Initial import
thib
parents:
diff changeset
1207 int i;
223b71206888 Initial import
thib
parents:
diff changeset
1208 for (i=0; name[i]!=0; i++) buf[i]=tolower(name[i]);
223b71206888 Initial import
thib
parents:
diff changeset
1209 buf[i]=0;
223b71206888 Initial import
thib
parents:
diff changeset
1210 for (i=0; i<deal; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
1211 if (track[i] == 0) return 0;
223b71206888 Initial import
thib
parents:
diff changeset
1212 if (strcmp(track[i], buf) == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
1213 return track_wave[i];
223b71206888 Initial import
thib
parents:
diff changeset
1214 }
223b71206888 Initial import
thib
parents:
diff changeset
1215 }
223b71206888 Initial import
thib
parents:
diff changeset
1216 return 0;
223b71206888 Initial import
thib
parents:
diff changeset
1217 }
223b71206888 Initial import
thib
parents:
diff changeset
1218 const char* TrackName::SETrack(int n) {
223b71206888 Initial import
thib
parents:
diff changeset
1219 if (n < 0 || n >= se_deal) return 0;
223b71206888 Initial import
thib
parents:
diff changeset
1220 return se_track[n];
223b71206888 Initial import
thib
parents:
diff changeset
1221 }
223b71206888 Initial import
thib
parents:
diff changeset
1222 void TrackName::AddSE(int n, char* file) {
223b71206888 Initial import
thib
parents:
diff changeset
1223 if (se_deal <= n) ExpandSE(n);
223b71206888 Initial import
thib
parents:
diff changeset
1224 if (se_track[n]) delete[] se_track[n];
223b71206888 Initial import
thib
parents:
diff changeset
1225 se_track[n] = new char[strlen(file)+1];
223b71206888 Initial import
thib
parents:
diff changeset
1226 strcpy(se_track[n], file);
223b71206888 Initial import
thib
parents:
diff changeset
1227 }
223b71206888 Initial import
thib
parents:
diff changeset
1228