1 /*  Copyright 2003-2005 Guillaume Duhamel
2     Copyright 2004-2006 Theo Berkau
3     Copyright 2006      Anders Montonen
4 
5     This file is part of Yabause.
6 
7     Yabause is free software; you can redistribute it and/or modify
8     it under the terms of the GNU General Public License as published by
9     the Free Software Foundation; either version 2 of the License, or
10     (at your option) any later version.
11 
12     Yabause is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.
16 
17     You should have received a copy of the GNU General Public License
18     along with Yabause; if not, write to the Free Software
19     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
20 */
21 
22 #ifndef YABAUSE_H
23 #define YABAUSE_H
24 
25 #include "core.h"
26 #include "sh2core.h"
27 
28 typedef struct
29 {
30    int percoretype;
31    int sh1coretype;
32    int sh2coretype;
33    int vidcoretype;
34    int sndcoretype;
35    int m68kcoretype;
36    int cdcoretype;
37    int carttype;
38    u8 regionid;
39    const char *biospath;
40    const char *cdpath;
41    const char *ssfpath;
42    const char *buppath;
43    const char *mpegpath;
44    const char *cartpath;
45    const char *modemip;
46    const char *modemport;
47    const char *sh1rompath;
48    int videoformattype;
49    int frameskip;
50    int clocksync;  // 1 = sync internal clock to emulation, 0 = realtime clock
51    u32 basetime;   // Initial time in clocksync mode (0 = start w/ system time)
52    int usethreads;
53    int numthreads;
54    int osdcoretype;
55    int skip_load;//skip loading in YabauseInit so tests can be run without a bios
56    int play_ssf;
57    int use_new_scsp;
58    int use_cd_block_lle;
59    int use_sh2_dma_timing;
60    int use_scu_dma_timing;
61    int sh2_cache_enabled;
62    int use_scsp_dsp_dynarec;
63    int use_scu_dsp_jit;
64 } yabauseinit_struct;
65 
66 #define CLKTYPE_26MHZ           0
67 #define CLKTYPE_28MHZ           1
68 
69 #define VIDEOFORMATTYPE_NTSC    0
70 #define VIDEOFORMATTYPE_PAL     1
71 
72 #ifndef NO_CLI
73 void print_usage(const char *program_name);
74 #endif
75 
76 void YabauseChangeTiming(int freqtype);
77 int YabauseInit(yabauseinit_struct *init);
78 void YabFlushBackups(void);
79 void YabauseDeInit(void);
80 void YabauseSetDecilineMode(int on);
81 void YabauseResetNoLoad(void);
82 void YabauseReset(void);
83 void YabauseResetButton(void);
84 int YabauseExec(void);
85 void YabauseStartSlave(void);
86 void YabauseStopSlave(void);
87 u64 YabauseGetTicks(void);
88 void YabauseSetVideoFormat(int type);
89 void YabauseSpeedySetup(void);
90 int YabauseQuickLoadGame(void);
91 
92 #define YABSYS_TIMING_BITS  20
93 #define YABSYS_TIMING_MASK  ((1 << YABSYS_TIMING_BITS) - 1)
94 
95 typedef struct
96 {
97    int DecilineMode;
98    int DecilineCount;
99    int LineCount;
100    int VBlankLineCount;
101    int MaxLineCount;
102    u32 DecilineStop;  // Fixed point
103    u32 SH2CycleFrac;  // Fixed point
104    u32 DecilineUsec;  // Fixed point
105    u32 UsecFrac;      // Fixed point
106    int CurSH2FreqType;
107    int IsPal;
108    u8 UseThreads;
109    int NumThreads;
110    u8 IsSSH2Running;
111    u64 OneFrameTime;
112    u64 tickfreq;
113    int emulatebios;
114    int usequickload;
115    int playing_ssf;
116    int use_cd_block_lle;
117    int use_sh2_dma_timing;
118    int use_scu_dma_timing;
119    int sh2_cache_enabled;
120    int use_scsp_dsp_jit;
121    int use_scu_dsp_jit;
122 } yabsys_struct;
123 
124 extern yabsys_struct yabsys;
125 
126 int YabauseEmulate(void);
127 
128 #endif
129