annotate system/system_config.cc @ 52:15a18fbe6f21

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