Previous 15994 Revisions Next

r1529 Friday 18th January, 2008 at 10:27:42 UTC by Dirk Best
Removed some files deleted in the 0.122u6 update
[src/emu]uitext.c uitext.h
[src/mame/audio]astinvad.c berzerk.c
[src/mame/includes]astinvad.h tickee.h
[src/mame/video]astinvad.c tickee.c

src/mame/audio/astinvad.c
r1528r1529
1/***********************************
2 updated: 1997-04-09 08:46 TT
3 updated  20-3-1998 LT Added colour changes on base explosion
4 updated  02-6-1998 HJB copied from 8080bw and removed unneeded code
5 *
6 * Author      : Tormod Tjaberg
7 * Created     : 1997-04-09
8 * Description : Sound routines for the 'astinvad' games
9 *
10 * The samples were taken from Michael Strutt's (mstrutt@pixie.co.za)
11 * excellent space invader emulator and converted to signed samples so
12 * they would work under SEAL. The port info was also gleaned from
13 * his emulator. These sounds should also work on all the invader games.
14 *
15 */
16
17#include "driver.h"
18#include "sound/samples.h"
19#include "includes/astinvad.h"
20
21static const char *const astinvad_sample_names[] =
22{
23   "*invaders",
24   "0.wav",
25   "1.wav",
26   "2.wav",
27   "3.wav",
28   "4.wav",
29   "5.wav",
30   "6.wav",
31   "7.wav",
32   "8.wav",
33   0
34};
35
36/* sample sound IDs - must match sample file name table above */
37enum
38{
39   SND_UFO = 0,
40   SND_SHOT,
41   SND_BASEHIT,
42   SND_INVADERHIT,
43   SND_FLEET1,
44   SND_FLEET2,
45   SND_FLEET3,
46   SND_FLEET4,
47   SND_UFOHIT
48};
49
50
51const struct Samplesinterface astinvad_samples_interface =
52{
53   6,   /* channels */
54   astinvad_sample_names
55};
56
57
58WRITE8_HANDLER( astinvad_sound1_w )
59{
60   static int state;
61
62   int bitsGoneHi = data & ~state;
63
64   sound_global_enable(data & 0x20);
65
66   if (!(data & 1))
67   {
68      sample_stop(0);
69   }
70
71   if (bitsGoneHi & 0x01) sample_start(0, SND_UFO, 1);
72   if (bitsGoneHi & 0x02) sample_start(1, SND_SHOT, 0);
73   if (bitsGoneHi & 0x04) sample_start(2, SND_BASEHIT, 0);
74   if (bitsGoneHi & 0x08) sample_start(3, SND_INVADERHIT, 0);
75
76   astinvad_set_screen_red(data & 0x04);
77
78   state = data;
79}
80
81
82WRITE8_HANDLER( astinvad_sound2_w )
83{
84   static int state;
85
86   int bitsGoneHi = data & ~state;
87
88   if (bitsGoneHi & 0x01) sample_start(5, SND_FLEET1, 0);
89   if (bitsGoneHi & 0x02) sample_start(5, SND_FLEET2, 0);
90   if (bitsGoneHi & 0x04) sample_start(5, SND_FLEET3, 0);
91   if (bitsGoneHi & 0x08) sample_start(5, SND_FLEET4, 0);
92   if (bitsGoneHi & 0x10) sample_start(4, SND_UFOHIT, 0);
93
94   flip_screen_set(readinputport(3) & data & 0x20);
95
96   state = data;
97}
98
99
100WRITE8_HANDLER( spaceint_sound1_w )
101{
102   static int state;
103
104   int bitsGoneHi = data & ~state;
105
106   if (!(data & 0x08))
107   {
108      sample_stop(0);
109   }
110
111   if (bitsGoneHi & 0x01) sample_start(1, SND_SHOT, 0);
112   if (bitsGoneHi & 0x02) sample_start(2, SND_BASEHIT, 0);
113   if (bitsGoneHi & 0x04) sample_start(4, SND_UFOHIT, 0);
114   if (bitsGoneHi & 0x08) sample_start(0, SND_UFO, 1);
115
116   if (bitsGoneHi & 0x10) sample_start(5, SND_FLEET1, 0);
117   if (bitsGoneHi & 0x20) sample_start(5, SND_FLEET2, 0);
118   if (bitsGoneHi & 0x40) sample_start(5, SND_FLEET3, 0);
119   if (bitsGoneHi & 0x80) sample_start(5, SND_FLEET4, 0);
120
121   state = data;
122}
123
124
125WRITE8_HANDLER( spaceint_sound2_w )
126{
127   static int state;
128
129   int bitsGoneHi = data & ~state;
130
131   sound_global_enable(data & 0x02);
132
133   if (bitsGoneHi & 0x04) sample_start(3, SND_INVADERHIT, 0);
134
135   flip_screen_set(readinputport(3) & data & 0x80);
136
137   state = data;
138}
src/mame/audio/berzerk.c
r1528r1529
1/*
2 * Berzerk/Frenzy Soundhardware Driver
3 * Copyright Alex Judd 1997/98
4 * V1.1 for Mame 0.31 13March98
5 *
6 */
7
8#include "driver.h"
9#include "berzerk.h"
10#include "exidy.h"
11#include "sound/s14001a.h"
12
13
14
15#define BERZERK_AUDIO_DEBUG      (0)
16
17
18static const struct S14001A_interface berzerk_s14001a_interface =
19{
20   REGION_SOUND1   /* voice data region */
21};
22
23
24static const struct CustomSound_interface custom_interface =
25{
26   berzerk_sh_start
27};
28
29
30MACHINE_DRIVER_START( berzerk_audio )
31   MDRV_SPEAKER_STANDARD_MONO("mono")
32
33   MDRV_SOUND_ADD(S14001A, BERZERK_S14001A_CLOCK)   /* CPU clock divided by 16 divided by a programmable TTL setup */
34   MDRV_SOUND_CONFIG(berzerk_s14001a_interface)
35   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
36
37   MDRV_SOUND_ADD(CUSTOM, 0)
38   MDRV_SOUND_CONFIG(custom_interface)
39   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
40MACHINE_DRIVER_END
41
42
43
44#if BERZERK_AUDIO_DEBUG
45static void berzerk_audio_debug(UINT8 data)
46{
47   mame_printf_debug("not busy, triggering S14001A core with %x\n", data);
48   mame_printf_debug("S14001a word play command: ");
49
50   switch (data)
51   {
52      case 0: mame_printf_debug("help\n"); break;
53      case 1: mame_printf_debug("kill\n"); break;
54      case 2: mame_printf_debug("attack\n"); break;
55      case 3: mame_printf_debug("charge\n"); break;
56      case 4: mame_printf_debug("got\n"); break;
57      case 5: mame_printf_debug("shoot\n"); break;
58      case 6: mame_printf_debug("get\n"); break;
59      case 7: mame_printf_debug("is\n"); break;
60      case 8: mame_printf_debug("alert\n"); break;
61      case 9: mame_printf_debug("detected\n"); break;
62      case 10: mame_printf_debug("the\n"); break;
63      case 11: mame_printf_debug("in\n"); break;
64      case 12: mame_printf_debug("it\n"); break;
65      case 13: mame_printf_debug("there\n"); break;
66      case 14: mame_printf_debug("where\n"); break;
67      case 15: mame_printf_debug("humanoid\n"); break;
68      case 16: mame_printf_debug("coins\n"); break;
69      case 17: mame_printf_debug("pocket\n"); break;
70      case 18: mame_printf_debug("intruder\n"); break;
71      case 19: mame_printf_debug("no\n"); break;
72      case 20: mame_printf_debug("escape\n"); break;
73      case 21: mame_printf_debug("destroy\n"); break;
74      case 22: mame_printf_debug("must\n"); break;
75      case 23: mame_printf_debug("not\n"); break;
76      case 24: mame_printf_debug("chicken\n"); break;
77      case 25: mame_printf_debug("fight\n"); break;
78      case 26: mame_printf_debug("like\n"); break;
79      case 27: mame_printf_debug("a\n"); break;
80      case 28: mame_printf_debug("robot\n"); break;
81      default: mame_printf_debug("ERROR: data %2x; you should NOT see this!\n", data); break;
82   }
83}
84#endif
85
86
87WRITE8_HANDLER( berzerk_audio_w )
88{
89   switch (offset)
90   {
91   /* offsets 0-3, 5 and 7 write to the 6840 */
92   case 0:
93   case 1:
94   case 2:
95   case 3:
96   case 5:
97   case 7:
98      exidy_sh6840_w(offset, data);
99      break;
100
101   /* offset 6 writes to the sfxcontrol latch */
102   case 6:
103      exidy_sfxctrl_w(data >> 6, data);
104      break;
105
106   /* offset 4 writes to the S14001A */
107   case 4:
108      if ((data & 0xc0) == 0x40) /* VSU-1000 control write */
109      {
110         /* volume and frequency control goes here */
111         /* mame_printf_debug("TODO: VSU-1000 Control write (ignored for now)\n");*/
112        S14001A_set_volume(((data&0x38)>>3)+1);
113        S14001A_set_rate((16-(data&0x07))*16); /* second LS161 has load triggered by its own TC(when it equals 16) long before the first ls161 will TC and fire again, so effectively it only divides by 15 and not 16. If the clock, as opposed to the E enable, had been tied to the first LS161's TC instead, it would divide by 16 as expected */
114      }
115      else if ((data & 0xc0) != 0x00)
116      {
117         /* vsu-1000 ignores these writes entirely */
118         mame_printf_debug("bogus write ignored\n");
119      }
120      else
121      {
122         /* select word input */
123         if (S14001A_bsy_0_r()) /* skip if busy... */
124         {
125            mame_printf_debug("S14001A busy, ignoring write\n");
126            break;
127         }
128
129         /* write to the register */
130         S14001A_reg_0_w(data & 0x3f);
131         S14001A_rst_0_w(1);
132         S14001A_rst_0_w(0);
133
134#if BERZERK_AUDIO_DEBUG
135         berzerk_audio_debug(data);
136#endif
137      }
138      break;
139   }
140}
141
142
143READ8_HANDLER( berzerk_audio_r )
144{
145   return ((offset == 4) && !S14001A_bsy_0_r()) ? 0x40 : 0x00;
146}
src/mame/includes/astinvad.h
r1528r1529
1#include "sound/samples.h"
2
3/*----------- defined in video/astinvad.c -----------*/
4
5VIDEO_UPDATE( astinvad );
6VIDEO_UPDATE( spcking2 );
7VIDEO_UPDATE( spaceint );
8
9VIDEO_START( spaceint );
10
11WRITE8_HANDLER( spaceint_videoram_w );
12WRITE8_HANDLER( spaceint_color_w);
13
14void astinvad_set_screen_red(int data);
15
16
17/*----------- defined in audio/astinvad.c -----------*/
18
19extern const struct Samplesinterface astinvad_samples_interface;
20
21WRITE8_HANDLER( astinvad_sound1_w );
22WRITE8_HANDLER( astinvad_sound2_w );
23WRITE8_HANDLER( spaceint_sound1_w );
24WRITE8_HANDLER( spaceint_sound2_w );
25
src/mame/includes/tickee.h
r1528r1529
1/*************************************************************************
2
3    Raster Elite Tickee Tickats hardware
4
5**************************************************************************/
6
7/*----------- defined in drivers/tickee.c -----------*/
8
9extern UINT16 *tickee_control;
10
11
12/*----------- defined in video/tickee.c -----------*/
13
14extern UINT16 *tickee_vram;
15
16VIDEO_START( tickee );
17
18void tickee_scanline_update(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params);
src/mame/video/astinvad.c
r1528r1529
1/***************************************************************************
2
3    Video emulation for Astro Invader, Space Intruder et al
4
5***************************************************************************/
6
7#include "driver.h"
8#include "includes/astinvad.h"
9
10
11static UINT8 spaceint_color;
12static UINT8 screen_red;
13
14
15void astinvad_set_screen_red(int data)
16{
17   screen_red = data;
18}
19
20
21WRITE8_HANDLER( spaceint_color_w )
22{
23   spaceint_color = data & 0x0f;
24}
25
26
27WRITE8_HANDLER( spaceint_videoram_w )
28{
29   videoram[offset] = data;
30   colorram[offset] = spaceint_color;
31}
32
33
34VIDEO_START( spaceint )
35{
36   colorram = auto_malloc(videoram_size);
37}
38
39
40
41static void plot_byte(mame_bitmap *bitmap, UINT8 y, UINT8 x, UINT8 data, UINT8 color)
42{
43   int i;
44
45   pen_t fore_pen = MAKE_RGB(pal1bit(color >> 0), pal1bit(color >> 2), pal1bit(color >> 1));
46
47   for (i = 0; i < 8; i++)
48   {
49      pen_t pen = (data & 0x01) ? fore_pen : RGB_BLACK;
50
51      if (flip_screen)
52         *BITMAP_ADDR32(bitmap, 255 - y, 255 - x) = pen;
53      else
54         *BITMAP_ADDR32(bitmap, y, x) = pen;
55
56      x = x + 1;
57      data = data >> 1;
58   }
59}
60
61
62VIDEO_UPDATE( astinvad )
63{
64   if (screen_red)
65   {
66      fillbitmap(bitmap, MAKE_RGB(pal1bit(1), pal1bit(0), pal1bit(0)), cliprect);
67   }
68   else
69   {
70      offs_t offs;
71
72      for (offs = 0; offs < videoram_size; offs++)
73      {
74         UINT8 color;
75         UINT8 data = videoram[offs];
76
77         UINT8 y = offs >> 5;
78         UINT8 x = offs << 3;
79
80         offs_t n = ((offs >> 3) & ~0x1f) | (offs & 0x1f);
81
82         if (flip_screen)
83            color = (memory_region(REGION_PROMS)[n] >> 4) & 0x07;
84         else
85            color = (memory_region(REGION_PROMS)[(~n + 0x80) & 0x3ff]) & 0x07;
86
87         plot_byte(bitmap, y, x, data, color);
88      }
89   }
90
91   return 0;
92}
93
94
95VIDEO_UPDATE( spcking2 )
96{
97   if (screen_red)
98   {
99      fillbitmap(bitmap, MAKE_RGB(pal1bit(1), pal1bit(0), pal1bit(0)), cliprect);
100   }
101   else
102   {
103      offs_t offs;
104
105      for (offs = 0; offs < videoram_size; offs++)
106      {
107         UINT8 color;
108         UINT8 data = videoram[offs];
109
110         UINT8 y = offs >> 5;
111         UINT8 x = offs << 3;
112
113         offs_t n = ((offs >> 3) & ~0x1f) | (offs & 0x1f);
114
115         if (flip_screen)
116            color = (memory_region(REGION_PROMS)[n] >> 4) & 0x07;
117         else
118            color = (memory_region(REGION_PROMS)[n ^ 0x03ff]) & 0x07;
119
120         plot_byte(bitmap, y, x, data, color);
121      }
122   }
123
124   return 0;
125}
126
127
128VIDEO_UPDATE( spaceint )
129{
130   offs_t offs;
131
132   for (offs = 0; offs < videoram_size; offs++)
133   {
134      UINT8 data = videoram[offs];
135      UINT8 color = colorram[offs];
136
137      UINT8 y = ~offs;
138      UINT8 x = offs >> 8 << 3;
139
140      /* this is almost certainly wrong */
141      offs_t n = ((offs >> 5) & 0xf0) | color;
142      color = memory_region(REGION_PROMS)[n] & 0x07;
143
144      plot_byte(bitmap, y, x, data, color);
145   }
146
147   return 0;
148}
src/mame/video/tickee.c
r1528r1529
1/***************************************************************************
2
3    Raster Elite Tickee Tickats hardware
4
5***************************************************************************/
6
7#include "driver.h"
8#include "cpu/tms34010/tms34010.h"
9#include "tickee.h"
10
11
12UINT16 *tickee_vram;
13
14
15/* local variables */
16static emu_timer *setup_gun_timer;
17
18
19
20/*************************************
21 *
22 *  Compute X/Y coordinates
23 *
24 *************************************/
25
26INLINE void get_crosshair_xy(int player, int *x, int *y)
27{
28   *x = (((readinputport(4 + player * 2) & 0xff) * (Machine->screen[0].visarea.max_x - Machine->screen[0].visarea.min_x)) >> 8) + Machine->screen[0].visarea.min_x;
29   *y = (((readinputport(5 + player * 2) & 0xff) * (Machine->screen[0].visarea.max_y - Machine->screen[0].visarea.min_y)) >> 8) + Machine->screen[0].visarea.min_y;
30}
31
32
33
34/*************************************
35 *
36 *  Light gun interrupts
37 *
38 *************************************/
39
40static TIMER_CALLBACK( trigger_gun_interrupt )
41{
42   /* fire the IRQ at the correct moment */
43   cpunum_set_input_line(0, param, ASSERT_LINE);
44}
45
46
47static TIMER_CALLBACK( clear_gun_interrupt )
48{
49   /* clear the IRQ on the next scanline? */
50   cpunum_set_input_line(0, param, CLEAR_LINE);
51}
52
53
54static TIMER_CALLBACK( setup_gun_interrupts )
55{
56   int beamx, beamy;
57
58   /* set a timer to do this again next frame */
59   timer_adjust(setup_gun_timer, video_screen_get_time_until_pos(0, 0, 0), 0, attotime_zero);
60
61   /* only do work if the palette is flashed */
62   if (!tickee_control[2])
63      return;
64
65   /* generate interrupts for player 1's gun */
66   get_crosshair_xy(0, &beamx, &beamy);
67   timer_set(video_screen_get_time_until_pos(0, beamy,     beamx + 50), NULL, 0, trigger_gun_interrupt);
68   timer_set(video_screen_get_time_until_pos(0, beamy + 1, beamx + 50), NULL, 0, clear_gun_interrupt);
69
70   /* generate interrupts for player 2's gun */
71   get_crosshair_xy(1, &beamx, &beamy);
72   timer_set(video_screen_get_time_until_pos(0, beamy,     beamx + 50), NULL, 1, trigger_gun_interrupt);
73   timer_set(video_screen_get_time_until_pos(0, beamy + 1, beamx + 50), NULL, 1, clear_gun_interrupt);
74}
75
76
77
78/*************************************
79 *
80 *  Video startup
81 *
82 *************************************/
83
84VIDEO_START( tickee )
85{
86   /* start a timer going on the first scanline of every frame */
87   setup_gun_timer = timer_alloc(setup_gun_interrupts, NULL);
88   timer_adjust(setup_gun_timer, video_screen_get_time_until_pos(0, 0, 0), 0, attotime_zero);
89}
90
91
92
93/*************************************
94 *
95 *  Video update
96 *
97 *************************************/
98
99void tickee_scanline_update(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params)
100{
101   UINT16 *src = &tickee_vram[(params->rowaddr << 8) & 0x3ff00];
102   UINT16 *dest = BITMAP_ADDR16(bitmap, scanline, 0);
103   int coladdr = params->coladdr << 1;
104   int x;
105
106   /* blank palette: fill with pen 255 */
107   if (tickee_control[2])
108   {
109      for (x = params->heblnk; x < params->hsblnk; x++)
110         dest[x] = 0xff;
111      return;
112   }
113
114   /* copy the non-blanked portions of this scanline */
115   for (x = params->heblnk; x < params->hsblnk; x += 2)
116   {
117      UINT16 pixels = src[coladdr++ & 0xff];
118      dest[x + 0] = pixels & 0xff;
119      dest[x + 1] = pixels >> 8;
120   }
121}
src/emu/uitext.c
r1528r1529
1/*********************************************************************
2
3    uitext.c
4
5    Functions used to retrieve text used by MAME, to aid in
6    translation.
7
8    Copyright Nicola Salmoria and the MAME Team.
9    Visit http://mamedev.org for licensing and usage restrictions.
10
11*********************************************************************/
12
13#include "driver.h"
14#include "uitext.h"
15
16#ifdef MESS
17extern const char *mess_default_text[];
18#endif /* MESS */
19
20
21static lang_struct lang;
22
23/* All entries in this table must match the enum ordering in "uitext.h" */
24static const char *const mame_default_text[] =
25{
26   APPNAME,
27   /* copyright stuff */
28   "Usage of emulators in conjunction with ROMs you don't own is forbidden by copyright law.",
29   "IF YOU ARE NOT LEGALLY ENTITLED TO PLAY \"%s\" ON THIS EMULATOR, PRESS ESC.",
30   "Otherwise, type OK or move the joystick left then right to continue",
31
32   /* misc stuff */
33   "Return to Main Menu",
34   "Return to Prior Menu",
35   "Press Any Key",
36   "On",
37   "Off",
38   "NA",
39   "OK",
40   "INVALID",
41   "(none)",
42   "CPU",
43   "Address",
44   "Value",
45   "Sound",
46   "sound",
47   "stereo",
48   "Vector Game",
49   "Screen Resolution",
50   "Text",
51   "Volume",
52   "Relative",
53   "ALL CHANNELS",
54   "Brightness",
55   "Contrast",
56   "Gamma",
57   "Vector Flicker",
58   "Overclock",
59   "ALL CPUS",
60   HISTORYNAME " not available",
61
62   /* special characters */
63   "\xc2\xab",
64   "\xc2\xbb",
65   "(more)",
66   "(more)",
67   "",
68   "",
69
70   /* known problems */
71   "There are known problems with this " GAMENOUN,
72   "The colors aren't 100% accurate.",
73   "The colors are completely wrong.",
74   "The video emulation isn't 100% accurate.",
75   "The sound emulation isn't 100% accurate.",
76   "The game lacks sound.",
77   "Screen flipping in cocktail mode is not supported.",
78   "THIS " CAPGAMENOUN " DOESN'T WORK. You won't be able to make it work correctly.  Don't bother.",
79   "The game has protection which isn't fully emulated.",
80   "There are working clones of this game. They are:",
81   "One or more ROMs/CHDs for this game are incorrect. The " GAMENOUN " may not run correctly.",
82   "Type OK or move the joystick left then right to continue",
83
84   /* main menu */
85   "Input (general)",
86   "Dip Switches",
87   "Analog Controls",
88   "Calibrate Joysticks",
89   "Bookkeeping Info",
90
91   "Input (this " CAPSTARTGAMENOUN")",
92   CAPSTARTGAMENOUN " Information",
93   CAPSTARTGAMENOUN " History",
94   "Reset " CAPSTARTGAMENOUN,
95   "Select New " CAPSTARTGAMENOUN,
96   "Return to " CAPSTARTGAMENOUN,
97   "Exit",
98
99   "Cheat",
100   "Memory Card",
101
102   /* input */
103   "Digital Speed",
104   "Autocenter Speed",
105   "Reverse",
106   "Sensitivity",
107
108   /* input groups */
109   "User Interface",
110   "Player 1 Controls",
111   "Player 2 Controls",
112   "Player 3 Controls",
113   "Player 4 Controls",
114   "Player 5 Controls",
115   "Player 6 Controls",
116   "Player 7 Controls",
117   "Player 8 Controls",
118   "Other Controls",
119   "Return to Groups",
120
121   /* stats */
122   "Uptime",
123   "Tickets dispensed",
124   "Coin",
125   "(locked)",
126
127   /* memory card */
128   "Card Number:",
129   "Load Selected Card",
130   "Eject Current Card",
131   "Create New Card",
132   "Error loading memory card",
133   "Memory card loaded",
134   "Memory card ejected",
135   "Memory card created",
136   "Error creating memory card",
137   "(Card may already exist)",
138
139   /* cheats */
140   "Enable/Disable a Cheat",
141   "Add/Edit a Cheat",
142   "Start a New Cheat Search",
143   "Continue Search",
144   "View Last Results",
145   "Restore Previous Results",
146   "Configure Watchpoints",
147   "General Help",
148   "Options",
149   "Reload Database",
150   "Watchpoint",
151   "Disabled",
152   "Cheats",
153   "Watchpoints",
154   "More Info",
155   "More Info for",
156   "Name",
157   "Description",
158   "Activation Key",
159   "Code",
160   "Max",
161   "Set",
162   "Cheat conflict found: disabling",
163   "Help not available yet",
164
165   /* watchpoints */
166   "Number of bytes",
167   "Display Type",
168   "Label Type",
169   "Label",
170   "X Position",
171   "Y Position",
172   "Watch",
173
174   "Hex",
175   "Decimal",
176   "Binary",
177
178   /* searching */
179   "Lives (or another value)",
180   "Timers (+/- some value)",
181   "Energy (greater or less)",
182   "Status (bits or flags)",
183   "Slow But Sure (changed or not)",
184   "Default Search Speed",
185   "Fast",
186   "Medium",
187   "Slow",
188   "Very Slow",
189   "All Memory",
190   "Select Memory Areas",
191   "Matches found",
192   "Search not initialized",
193   "No previous values saved",
194   "Previous values already restored",
195   "Restoration successful",
196   "Select a value",
197   "All values saved",
198   "One match found - added to list",
199
200   /* refresh rate */
201   "Refresh rate",
202   "Decoding Graphics",
203
204   "Video Options",
205   "Screen #",
206   "Rotate Clockwise",
207   "Rotate Counter-clockwise",
208   "Flip X",
209   "Flip Y",
210
211   "Driver Configuration",
212
213   NULL
214};
215
216
217
218static const char *const *const default_text[] =
219{
220   mame_default_text,
221#ifdef MESS
222   mess_default_text,
223#endif /* MESS */
224   NULL
225};
226
227
228
229static const char **trans_text;
230
231
232int uistring_init (mame_file *langfile)
233{
234   /*
235        TODO: This routine needs to do several things:
236            - load an external font if needed
237            - determine the number of characters in the font
238            - deal with multibyte languages
239
240    */
241
242   int i, j, str;
243   char curline[255];
244   char section[255] = "\0";
245   char *ptr;
246   int string_count;
247
248   /* count the total amount of strings */
249   string_count = 0;
250   for (i = 0; default_text[i]; i++)
251   {
252      for (j = 0; default_text[i][j]; j++)
253         string_count++;
254   }
255
256   /* allocate the translated text array, and set defaults */
257   trans_text = auto_malloc(sizeof(const char *) * string_count);
258
259   /* copy in references to all of the strings */
260   str = 0;
261   for (i = 0; default_text[i]; i++)
262   {
263      for (j = 0; default_text[i][j]; j++)
264         trans_text[str++] = default_text[i][j];
265   }
266
267   memset(&lang, 0, sizeof(lang));
268
269   /* if no language file, exit */
270   if (!langfile)
271      return 0;
272
273   while (mame_fgets (curline, sizeof(curline) / sizeof(curline[0]), langfile) != NULL)
274   {
275      /* Ignore commented and blank lines */
276      if (curline[0] == ';') continue;
277      if (curline[0] == '\n') continue;
278      if (curline[0] == '\r') continue;
279
280      if (curline[0] == '[')
281      {
282         ptr = strtok (&curline[1], "]");
283         /* Found a section, indicate as such */
284         strcpy (section, ptr);
285
286         /* Skip to the next line */
287         continue;
288      }
289
290      /* Parse the LangInfo section */
291      if (strcmp (section, "LangInfo") == 0)
292      {
293         ptr = strtok (curline, "=");
294         if (strcmp (ptr, "Version") == 0)
295         {
296            ptr = strtok (NULL, "\n\r");
297            sscanf (ptr, "%d", &lang.version);
298         }
299         else if (strcmp (ptr, "Language") == 0)
300         {
301            ptr = strtok (NULL, "\n\r");
302            strcpy (lang.langname, ptr);
303         }
304         else if (strcmp (ptr, "Author") == 0)
305         {
306            ptr = strtok (NULL, "\n\r");
307            strcpy (lang.author, ptr);
308         }
309         else if (strcmp (ptr, "Font") == 0)
310         {
311            ptr = strtok (NULL, "\n\r");
312            strcpy (lang.fontname, ptr);
313         }
314      }
315
316      /* Parse the Strings section */
317      if (strcmp (section, "Strings") == 0)
318      {
319         /* Get all text up to the first line ending */
320         ptr = strtok (curline, "\n\r");
321
322         /* Find a matching default string */
323         str = 0;
324         for (i = 0; default_text[i]; i++)
325         {
326            for (j = 0; default_text[i][j]; j++)
327            {
328               if (strcmp (curline, default_text[i][j]) == 0)
329            {
330               char transline[255];
331
332               /* Found a match, read next line as the translation */
333               mame_fgets (transline, 255, langfile);
334
335               /* Get all text up to the first line ending */
336               ptr = strtok (transline, "\n\r");
337
338               /* Allocate storage and copy the string */
339                  trans_text[str] = auto_strdup(transline);
340               }
341               str++;
342            }
343         }
344      }
345   }
346
347   /* indicate success */
348   return 0;
349}
350
351
352
353const char * ui_getstring (int string_num)
354{
355      return trans_text[string_num];
356}
src/emu/uitext.h
r1528r1529
1/***************************************************************************
2
3    uitext.h
4
5    Functions used to retrieve text used by MAME, to aid in
6    translation.
7
8    Copyright Nicola Salmoria and the MAME Team.
9    Visit http://mamedev.org for licensing and usage restrictions.
10
11***************************************************************************/
12
13#pragma once
14
15#ifndef __uitext_H__
16#define __uitext_H__
17
18#include "mamecore.h"
19
20/* Important: this must match the default_text list in uitext.c! */
21enum
22{
23   UI_mame = 0,
24
25   /* copyright stuff */
26   UI_copyright1,
27   UI_copyright2,
28   UI_copyright3,
29
30   /* misc menu stuff */
31   UI_returntomain,
32   UI_returntoprior,
33   UI_anykey,
34   UI_on,
35   UI_off,
36   UI_NA,
37   UI_OK,
38   UI_INVALID,
39   UI_none,
40   UI_cpu,
41   UI_address,
42   UI_value,
43   UI_sound,
44   UI_sound_lc, /* lower-case version */
45   UI_stereo,
46   UI_vectorgame,
47   UI_screenres,
48   uitext,
49   UI_volume,
50   UI_relative,
51   UI_allchannels,
52   UI_brightness,
53   UI_contrast,
54   UI_gamma,
55   UI_vectorflicker,
56   UI_overclock,
57   UI_allcpus,
58   UI_historymissing,
59
60   /* special characters */
61   UI_leftarrow,
62   UI_rightarrow,
63   UI_uparrow,
64   UI_downarrow,
65   UI_lefthilight,
66   UI_righthilight,
67
68   /* warnings */
69   UI_knownproblems,
70   UI_imperfectcolors,
71   UI_wrongcolors,
72   UI_imperfectgraphics,
73   UI_imperfectsound,
74   UI_nosound,
75   UI_nococktail,
76   UI_brokengame,
77   UI_brokenprotection,
78   UI_workingclones,
79   UI_incorrectroms,
80   UI_typeok,
81
82   /* main menu */
83   UI_inputgeneral,
84   UI_dipswitches,
85   UI_analogcontrols,
86   UI_calibrate,
87   UI_bookkeeping,
88   UI_inputspecific,
89   UI_gameinfo,
90   UI_history,
91   UI_resetgame,
92   UI_selectgame,
93   UI_returntogame,
94   UI_exit,
95   UI_cheat,
96   UI_memorycard,
97
98   /* input stuff */
99   UI_keyjoyspeed,
100   UI_centerspeed,
101   UI_reverse,
102   UI_sensitivity,
103
104   /* input groups */
105   UI_uigroup,
106   UI_p1group,
107   UI_p2group,
108   UI_p3group,
109   UI_p4group,
110   UI_p5group,
111   UI_p6group,
112   UI_p7group,
113   UI_p8group,
114   UI_othergroup,
115   UI_returntogroup,
116
117   /* stats */
118   UI_totaltime,
119   UI_tickets,
120   UI_coin,
121   UI_locked,
122
123   /* memory card */
124   UI_selectcard,
125   UI_loadcard,
126   UI_ejectcard,
127   UI_createcard,
128   UI_loadfailed,
129   UI_loadok,
130   UI_cardejected,
131   UI_cardcreated,
132   UI_cardcreatedfailed,
133   UI_cardcreatedfailed2,
134
135   /* cheat stuff */
136   UI_enablecheat,
137   UI_addeditcheat,
138   UI_startcheat,
139   UI_continuesearch,
140   UI_viewresults,
141   UI_restoreresults,
142   UI_memorywatch,
143   UI_generalhelp,
144   UI_options,
145   UI_reloaddatabase,
146   UI_watchpoint,
147   UI_disabled,
148   UI_cheats,
149   UI_watchpoints,
150   UI_moreinfo,
151   UI_moreinfoheader,
152   UI_cheatname,
153   UI_cheatdescription,
154   UI_cheatactivationkey,
155   UI_code,
156   UI_max,
157   UI_set,
158   UI_conflict_found,
159   UI_no_help_available,
160
161   /* watchpoint stuff */
162   UI_watchlength,
163   UI_watchdisplaytype,
164   UI_watchlabeltype,
165   UI_watchlabel,
166   UI_watchx,
167   UI_watchy,
168   UI_watch,
169
170   UI_hex,
171   UI_decimal,
172   UI_binary,
173
174   /* search stuff */
175   UI_search_lives,
176   UI_search_timers,
177   UI_search_energy,
178   UI_search_status,
179   UI_search_slow,
180   UI_search_speed,
181   UI_search_speed_fast,
182   UI_search_speed_medium,
183   UI_search_speed_slow,
184   UI_search_speed_veryslow,
185   UI_search_speed_allmemory,
186   UI_search_select_memory_areas,
187   UI_search_matches_found,
188   UI_search_noinit,
189   UI_search_nosave,
190   UI_search_done,
191   UI_search_OK,
192   UI_search_select_value,
193   UI_search_all_values_saved,
194   UI_search_one_match_found_added,
195
196   /* refresh rate */
197   UI_refresh_rate,
198   UI_decoding_gfx,
199
200   UI_video,
201   UI_screen,
202   UI_rotate_clockwise,
203   UI_rotate_counterclockwise,
204   UI_flip_x,
205   UI_flip_y,
206
207   UI_configuration,
208
209   UI_last_mame_entry
210};
211
212#ifdef MESS
213#include "muitext.h"
214#endif
215
216struct _lang_struct
217{
218   int version;
219   int multibyte;         /* UNUSED: 1 if this is a multibyte font/language */
220   UINT8 *fontdata;      /* pointer to the raw font data to be decoded */
221   UINT16 fontglyphs;      /* total number of glyps in the external font - 1 */
222   char langname[255];
223   char fontname[255];
224   char author[255];
225};
226typedef struct _lang_struct lang_struct;
227
228int uistring_init (mame_file *language_file);
229
230const char * ui_getstring (int string_num);
231
232#endif /* __uitext_H__ */
233

Previous 15994 Revisions Next


© 1998-2018 The MESS Team