Subversion Repositories pentevo

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
716 lvd 1
#include "std.h"
2
 
3
#include "emul.h"
4
#include "vars.h"
5
#include "gs.h"
6
#include "gsz80.h"
7
#include "vs1001.h"
8
 
9
#ifdef MOD_GS
10
 
11
unsigned gs_vfx[0x41];  // logarithmic + mixed with conf.sound.gs
12
TGsLed gsleds[8];
13
 
14
void make_gs_volume(unsigned level)
15
{
16
   for (int i = 0; i <= 0x40; i++) {
17
      //const double ln_0x40 = 4.15888308336;
18
      //gs_vfx[i] = (unsigned)(conf.sound.gs*log((double)(i*level/0x3F+1))/ln_0x40);
19
      gs_vfx[i] = conf.sound.gs_vol*i*level/(0x40*0x40);
20
   }
21
}
22
 
23
#if defined(MOD_GSZ80) || defined(MOD_GSBASS)
24
//#include "snd_bass.cpp"
25
#endif
26
 
27
#ifdef MOD_GSZ80
28
//#include "gsz80.cpp"
29
#endif
30
 
31
#ifdef MOD_GSBASS
32
//#include "gshlbass.cpp"
33
//#include "gshle.cpp"
34
#endif
35
 
36
unsigned char in_gs(unsigned char port)
37
{
38
 
39
#ifdef MOD_GSZ80
40
   if (conf.gs_type == 1) return z80gs::in_gs(port);
41
#endif
42
 
43
#ifdef MOD_GSBASS
44
   if (conf.gs_type == 2) return gs.in(port);
45
#endif
46
 
47
   return 0xFF;
48
}
49
 
50
void out_gs(unsigned char port, unsigned char byte)
51
{
52
#ifdef MOD_GSZ80
53
   if (conf.gs_type == 1) { z80gs::out_gs(port, byte); return; }
54
#endif
55
 
56
#ifdef MOD_GSBASS
57
   if (conf.gs_type == 2) { gs.out(port, byte); return; }
58
#endif
59
}
60
 
61
void reset_gs_sound()
62
{
63
#ifdef MOD_GSZ80
64
   z80gs::sound.set_timings(z80gs::GSCPUFQ, conf.sound.fq);
65
#endif
66
 
67
#ifdef MOD_GSBASS
68
   gs.reset_sound();
69
#endif
70
}
71
 
72
void reset_gs()
73
{
74
#ifdef MOD_GSZ80
75
   if (conf.gs_type == 1) { z80gs::reset(); return; }
76
#endif
77
 
78
#ifdef MOD_GSBASS
79
   if (conf.gs_type == 2) { gs.reset(); return; }
80
#endif
81
}
82
 
83
void apply_gs()
84
{
85
#ifdef MOD_GSZ80
86
   if (conf.gs_type == 1) z80gs::apply_gs();
87
#endif
88
 
89
#ifdef MOD_GSBASS
90
   if (conf.gs_type == 2) gs.applyconfig();
91
#endif
92
}
93
 
94
void init_gs()
95
{
96
#ifdef MOD_GS
97
   if (conf.gs_type != 0)
98
       BASS::Load();
99
#endif
100
 
101
#ifdef MOD_GSZ80
102
   make_gs_volume(); // for GS-Z80
103
#endif
104
 
105
   reset_gs();
106
}
107
 
108
void done_gs()
109
{
110
#ifdef MOD_GS
111
   Vs1001.ShutDown();
112
   if (conf.gs_type != 0)
113
       BASS::Unload();
114
#endif
115
}
116
 
117
void init_gs_frame()
118
{
119
#ifdef MOD_GSZ80
120
   if (conf.gs_type==1) z80gs::init_gs_frame();
121
#endif
122
}
123
 
124
void flush_gs_frame()
125
{
126
#ifdef MOD_GSZ80
127
   if (conf.gs_type==1) { z80gs::flush_gs_frame(); return; }
128
#endif
129
 
130
#ifdef MOD_GSBASS
131
   if (conf.gs_type==2) { gs.flush_gs_frame(); return; }
132
#endif
133
}
134
 
135
#endif  // MOD_GS