Develop and Download Open Source Software

Browse CVS Repository

Contents of /mame32jp/mame32jp/src/ui_text.c

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.6 - (show annotations) (download) (as text)
Tue May 7 00:17:30 2002 UTC (21 years, 11 months ago) by zero
Branch: MAIN
CVS Tags: ver_0_60_1, ver0_60_2, ver0_60_3, ver0_60_4, ver0_60_5, HEAD
Changes since 1.5: +0 -5 lines
File MIME type: text/x-csrc
*** empty log message ***

1 /*********************************************************************
2
3 ui_text.c
4
5 Functions used to retrieve text used by MAME, to aid in
6 translation.
7
8 *********************************************************************/
9
10 #include "driver.h"
11 #include "ui_text.h"
12
13 #ifndef JAPANESE
14 struct lang_struct lang;
15 #endif
16
17 char *trans_text[UI_last_entry + 1];
18
19 /* All entries in this table must match the enum ordering in "ui_text.h" */
20 #ifdef JAPANESE
21 const char *default_text[] =
22 {
23 #ifndef MESS
24 #ifdef MAME32JP
25 "MAME32jp",
26 #else
27 "MAME",
28 #endif
29 #else
30 "MESS",
31 #endif
32
33 /* copyright stuff */
34 "所有していないROMをエミュレータで使用することは、著作権法によって禁じられています。",
35 "\"%s\" を合法的に遊ぶ権利がなければESCを押してください。",
36 "OKと入力すると続けます。",
37
38 /* misc stuff */
39 "メインメニューに戻る",
40 "一つ前のメニューに戻る",
41 "何かキーを押してください",
42 #ifdef MAME32JP
43 "決定キー/ボタンを押してください",
44 #endif
45 "ON",
46 "OFF",
47 "なし",
48 "OK",
49 "無効",
50 "(なし)",
51 "CPU",
52 "アドレス",
53 "値",
54 "音源",
55 "サウンド用",
56 "ステレオ",
57 "ベクタゲーム",
58 "画面解像度",
59 "テキスト",
60 "音量",
61 "相対",
62 "全チャネル",
63 "明るさ",
64 "ガンマ値",
65 "ベクタフリッカー",
66 "ベクタ明度",
67 "オーバークロック",
68 "全CPU",
69 #ifndef MESS
70 "ヒストリーが見つかりません",
71 #else
72 "システム情報が見つかりません",
73 #endif
74 #ifdef MAME32JP
75 "コマンドリストが見つかりません",
76 #endif
77
78 /* special characters */
79 "\x11",
80 "\x10",
81 "\x18",
82 "\x19",
83 "\x1a",
84 "\x1b",
85
86 /* known problems */
87 #ifndef MESS
88 "このゲームには以下の問題があります:",
89 #else
90 "このシステムには以下の問題があります:",
91 #endif
92 "色の再現が不完全です。",
93 "色が完全に間違っています。",
94 "ビデオエミュレーションが不完全です。",
95 "サウンドエミュレーションが不完全です。",
96 "サウンドが再生されません。",
97 "カクテルモードの画面反転に対応していません。",
98 #ifndef MESS
99 "※このゲームは全く動作しません※",
100 #else
101 "※このシステムは全く動作しません※",
102 #endif
103 "このゲームはプロテクトのためエミュレーションが不完全です。",
104 "このゲームには以下の動作可能なクローンが存在します:",
105 "OKと入力すると続けます",
106 #ifdef MESS
107 "このシステムはコンピュータです: ",
108 "キーボードエミュレーションが不完全です。",
109 #endif
110
111 /* main menu */
112 "入力設定 (標準)",
113 "ディップスイッチ",
114 "アナログコントロール",
115 "ジョイスティックの調整",
116 "インカム情報",
117 #ifndef MESS
118 "入力設定 (このゲーム)",
119 "ゲーム情報",
120 "ゲームの歴史",
121 #ifdef MAME32JP
122 "連射設定",
123 "ジョイスティックの変更",
124 "コマンド一覧/操作説明",
125 #endif
126 "ゲームをリセットする",
127 "ゲームに戻る",
128 #else
129 "入力設定 (このマシン)",
130 "マシン情報",
131 "マシンの使い方と歴史",
132 "マシンをリセットする",
133 "マシンに戻る",
134 "イメージ情報",
135 "ファイルマネージャ",
136 "テープコントロール",
137 #endif
138 "チート (ゲームの改造)",
139 "メモリカード",
140
141 /* input */
142 "Key/Joy 速度",
143 "反転",
144 "感度",
145
146 /* stats */
147 "チケット発券数",
148 "コイン",
149 "(固定)",
150
151 /* memory card */
152 "メモリカードの読みこみ",
153 "メモリカードの取り出し",
154 "メモリカードの作成",
155 "メモリカードマネージャ呼び出し (リセット)",
156 "メモリカードの読みこみ失敗!",
157 "読みこみ完了!",
158 "メモリカードを取り出しました!",
159 "メモリカードを作成しました!",
160 "メモリカードの作成失敗!",
161 "(すでに作成済み?)",
162 "内部エラーです!!",
163
164 /* cheats */
165 "チートを有効/無効にする",
166 "チートを追加/編集する",
167 "新規チートのサーチ開始",
168 "サーチを継続する",
169 "最後の結果を表示する",
170 "前回の結果に戻す",
171 "ウォッチポイントの設定",
172 "全般のヘルプ",
173 "オプション",
174 "データベース再読み込み",
175 "ウォッチポイント",
176 "無効",
177 "チート",
178 "ウォッチポイント",
179 "補足説明",
180 "補足説明:",
181 "名前",
182 "説明",
183 "有効化キー",
184 "コード",
185 "最大",
186 "セット",
187 "重複するチートが見つかりました: 無効にします",
188 "ヘルプはまだありません",
189
190 /* watchpoints */
191 "バイト数",
192 "表示形式",
193 "ラベルタイプ",
194 "ラベル",
195 "X座標",
196 "Y座標",
197 "ウォッチ",
198
199 "16進",
200 "10進",
201 "2進",
202
203 /* searching */
204 "ライフ (決まった値)",
205 "タイマー (+/- の値)",
206 "エネルギー (値の大小)",
207 "状態 (ビットかフラグ)",
208 "遅いけど確実 (変化したかしないか)",
209 "標準のサーチ速度",
210 "速い",
211 "普通",
212 "遅い",
213 "とても遅い",
214 "全てのメモリ",
215 "メモリ領域を選択",
216 "一致する値が見つかりました",
217 "サーチが初期化されていません",
218 "前回の値が保存されていません",
219 "前回の値は既に復帰済みです",
220 "値の復帰に成功しました",
221 "値の選択",
222 "すべての値を保存しました",
223 "一致する値が見つかりました - リストに追加します",
224
225 #ifdef MAME32JP
226 " オフ",
227 "常時オン",
228 "切り替え",
229 "連射間隔",
230
231 "プレイヤー1",
232 "プレイヤー2",
233 "プレイヤー3",
234 "プレイヤー4",
235 "未接続",
236 #endif
237
238 NULL
239 };
240 #else
241 const char * default_text[] =
242 {
243 #ifndef MESS
244 #ifdef MAME32JP
245 "MAME32jp",
246 #else
247 "MAME",
248 #endif
249 #else
250 "MESS",
251 #endif
252
253 /* copyright stuff */
254 "Usage of emulators in conjunction with ROMs you don't own is forbidden by copyright law.",
255 "IF YOU ARE NOT LEGALLY ENTITLED TO PLAY \"%s\" ON THIS EMULATOR, PRESS ESC.",
256 "Otherwise, type OK to continue",
257
258 /* misc stuff */
259 "Return to Main Menu",
260 "Return to Prior Menu",
261 "Press Any Key",
262 #ifdef MAME32JP
263 "Press Select Key/Button",
264 #endif
265 "On",
266 "Off",
267 "NA",
268 "OK",
269 "INVALID",
270 "(none)",
271 "CPU",
272 "Address",
273 "Value",
274 "Sound",
275 "sound",
276 "stereo",
277 "Vector Game",
278 "Screen Resolution",
279 "Text",
280 "Volume",
281 "Relative",
282 "ALL CHANNELS",
283 "Brightness",
284 "Gamma",
285 "Vector Flicker",
286 "Vector Intensity",
287 "Overclock",
288 "ALL CPUS",
289 #ifndef MESS
290 "History not available",
291 #else
292 "System Info not available",
293 #endif
294 #ifdef MAME32JP
295 "Command List not available",
296 #endif
297
298 /* special characters */
299 "\x11",
300 "\x10",
301 "\x18",
302 "\x19",
303 "\x1a",
304 "\x1b",
305
306 /* known problems */
307 #ifndef MESS
308 "There are known problems with this game:",
309 #else
310 "There are known problems with this system",
311 #endif
312 "The colors aren't 100% accurate.",
313 "The colors are completely wrong.",
314 "The video emulation isn't 100% accurate.",
315 "The sound emulation isn't 100% accurate.",
316 "The game lacks sound.",
317 "Screen flipping in cocktail mode is not supported.",
318 #ifndef MESS
319 "THIS GAME DOESN'T WORK PROPERLY",
320 #else
321 "THIS SYSTEM DOESN'T WORK PROPERLY",
322 #endif
323 "The game has protection which isn't fully emulated.",
324 "There are working clones of this game. They are:",
325 "Type OK to continue",
326 #ifdef MESS
327 "The emulated system is a computer: ",
328 "The keyboard emulation may not be 100% accurate.",
329 #endif
330
331 /* main menu */
332 "Input (general)",
333 "Dip Switches",
334 "Analog Controls",
335 "Calibrate Joysticks",
336 "Bookkeeping Info",
337 #ifndef MESS
338 "Input (this game)",
339 "Game Information",
340 "Game History",
341 #ifdef MAME32JP
342 "Autofire Setting",
343 "Change Joysticks",
344 "Show Command List",
345 #endif
346 "Reset Game",
347 "Return to Game",
348 #else
349 "Input (this machine)",
350 "Machine Information",
351 "Machine Usage & History",
352 "Reset Machine",
353 "Return to Machine",
354 "Image Information",
355 "File Manager",
356 "Tape Control",
357 #endif
358 "Cheat",
359 "Memory Card",
360
361 /* input */
362 "Key/Joy Speed",
363 "Reverse",
364 "Sensitivity",
365
366 /* stats */
367 "Tickets dispensed",
368 "Coin",
369 "(locked)",
370
371 /* memory card */
372 "Load Memory Card",
373 "Eject Memory Card",
374 "Create Memory Card",
375 "Call Memory Card Manager (RESET)",
376 "Failed To Load Memory Card!",
377 "Load OK!",
378 "Memory Card Ejected!",
379 "Memory Card Created OK!",
380 "Failed To Create Memory Card!",
381 "(It already exists ?)",
382 "DAMN!! Internal Error!",
383
384 /* cheats */
385 "Enable/Disable a Cheat",
386 "Add/Edit a Cheat",
387 "Start a New Cheat Search",
388 "Continue Search",
389 "View Last Results",
390 "Restore Previous Results",
391 "Configure Watchpoints",
392 "General Help",
393 "Options",
394 "Reload Database",
395 "Watchpoint",
396 "Disabled",
397 "Cheats",
398 "Watchpoints",
399 "More Info",
400 "More Info for",
401 "Name",
402 "Description",
403 "Activation Key",
404 "Code",
405 "Max",
406 "Set",
407 "Cheat conflict found: disabling",
408 "Help not available yet",
409
410 /* watchpoints */
411 "Number of bytes",
412 "Display Type",
413 "Label Type",
414 "Label",
415 "X Position",
416 "Y Position",
417 "Watch",
418
419 "Hex",
420 "Decimal",
421 "Binary",
422
423 /* searching */
424 "Lives (or another value)",
425 "Timers (+/- some value)",
426 "Energy (greater or less)",
427 "Status (bits or flags)",
428 "Slow But Sure (changed or not)",
429 "Default Search Speed",
430 "Fast",
431 "Medium",
432 "Slow",
433 "Very Slow",
434 "All Memory",
435 "Select Memory Areas",
436 "Matches found",
437 "Search not initialized",
438 "No previous values saved",
439 "Previous values already restored",
440 "Restoration successful",
441 "Select a value",
442 "All values saved",
443 "One match found - added to list",
444
445 #ifdef MAME32JP
446 " OFF",
447 " ON",
448 "TOGGLE",
449 "Autofire Delay",
450
451 "Player 1",
452 "Player 2",
453 "Player 3",
454 "Player 4",
455 "Not attached",
456 #endif
457
458 NULL
459 };
460 #endif
461
462 #ifndef JAPANESE
463 int uistring_init (void *langfile)
464 {
465 /*
466 TODO: This routine needs to do several things:
467 - load an external font if needed
468 - determine the number of characters in the font
469 - deal with multibyte languages
470
471 */
472
473 int i;
474 char curline[255];
475 char section[255] = "\0";
476 char *ptr;
477
478 /* Clear out any default strings */
479 for (i = 0; i <= UI_last_entry; i ++)
480 {
481 trans_text[i] = NULL;
482 }
483
484 memset(&lang, 0, sizeof(lang));
485
486 if (!langfile) return 0;
487
488 while (osd_fgets (curline, 255, langfile) != NULL)
489 {
490 /* Ignore commented and blank lines */
491 if (curline[0] == ';') continue;
492 if (curline[0] == '\n') continue;
493
494 if (curline[0] == '[')
495 {
496 ptr = strtok (&curline[1], "]");
497 /* Found a section, indicate as such */
498 strcpy (section, ptr);
499
500 /* Skip to the next line */
501 continue;
502 }
503
504 /* Parse the LangInfo section */
505 if (strcmp (section, "LangInfo") == 0)
506 {
507 ptr = strtok (curline, "=");
508 if (strcmp (ptr, "Version") == 0)
509 {
510 ptr = strtok (NULL, "\n");
511 sscanf (ptr, "%d", &lang.version);
512 }
513 else if (strcmp (ptr, "Language") == 0)
514 {
515 ptr = strtok (NULL, "\n");
516 strcpy (lang.langname, ptr);
517 }
518 else if (strcmp (ptr, "Author") == 0)
519 {
520 ptr = strtok (NULL, "\n");
521 strcpy (lang.author, ptr);
522 }
523 else if (strcmp (ptr, "Font") == 0)
524 {
525 ptr = strtok (NULL, "\n");
526 strcpy (lang.fontname, ptr);
527 }
528 }
529
530 /* Parse the Strings section */
531 if (strcmp (section, "Strings") == 0)
532 {
533 /* Get all text up to the first line ending */
534 ptr = strtok (curline, "\n");
535
536 /* Find a matching default string */
537 for (i = 0; i < UI_last_entry; i ++)
538 {
539 if (strcmp (curline, default_text[i]) == 0)
540 {
541 char transline[255];
542
543 /* Found a match, read next line as the translation */
544 osd_fgets (transline, 255, langfile);
545
546 /* Get all text up to the first line ending */
547 ptr = strtok (transline, "\n");
548
549 /* Allocate storage and copy the string */
550 trans_text[i] = malloc (strlen(transline)+1);
551 strcpy (trans_text[i], transline);
552
553 /* Done searching */
554 break;
555 }
556 }
557 }
558 }
559
560 /* indicate success */
561 return 0;
562 }
563
564 void uistring_shutdown (void)
565 {
566 int i;
567
568 /* Deallocate storage for the strings */
569 for (i = 0; i <= UI_last_entry; i ++)
570 {
571 if (trans_text[i])
572 {
573 free (trans_text[i]);
574 trans_text[i] = NULL;
575 }
576 }
577 }
578
579 const char * ui_getstring (int string_num)
580 {
581 /* Try to use the language file strings first */
582 if (trans_text[string_num] != NULL)
583 return trans_text[string_num];
584 else
585 /* That failed, use the default strings */
586 return default_text[string_num];
587 }
588 #else
589 const char *ui_getstring(int string_num)
590 {
591 return default_text[string_num];
592 }
593 #endif

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26