forked from xjsxjs197/WiiSXRX_2022
-
Notifications
You must be signed in to change notification settings - Fork 2
/
sio.h
103 lines (87 loc) · 3.23 KB
/
sio.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/***************************************************************************
* Copyright (C) 2007 Ryan Schultz, PCSX-df Team, PCSX team *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307 USA. *
***************************************************************************/
#ifndef _SIO_H_
#define _SIO_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "psxcommon.h"
#include "r3000a.h"
#include "psxmem.h"
#include "plugins.h"
#include "psemu_plugin_defs.h"
#include "Gamecube/fileBrowser/fileBrowser.h"
#define MCD_SIZE (1024 * 8 * 16)
// Status Flags
#define TX_RDY 0x0001
#define RX_RDY 0x0002
#define TX_EMPTY 0x0004
#define PARITY_ERR 0x0008
#define RX_OVERRUN 0x0010
#define FRAMING_ERR 0x0020
#define SYNC_DETECT 0x0040
#define DSR 0x0080
#define CTS 0x0100
#define IRQ 0x0200
// Control Flags
#define TX_PERM 0x0001
#define DTR 0x0002
#define RX_PERM 0x0004
#define BREAK 0x0008
#define RESET_ERR 0x0010
#define RTS 0x0020
#define SIO_RESET 0x0040
extern unsigned short StatReg;
extern unsigned short ModeReg;
extern unsigned short CtrlReg;
extern unsigned short BaudReg;
extern char McdDisable[2];
#ifdef HW_RVL
#include "Gamecube/MEM2.h"
extern char *Mcd1Data;
extern char *Mcd2Data;
#else
extern char Mcd1Data[MCD_SIZE], Mcd2Data[MCD_SIZE];
#endif
extern unsigned char sioRead8();
extern void sioWrite8(unsigned char value);
extern void sioWriteCtrl16(unsigned short value);
extern void sioInterrupt();
extern int sioFreeze(gzFile f, int Mode);
extern int LoadMcd(int mcd, fileBrowser_file *savepath);
extern int LoadMcds(fileBrowser_file *mcd1, fileBrowser_file *mcd2);
extern int SaveMcdByNum(int mcd);
extern int SaveMcd(int mcd, fileBrowser_file *savepath);
extern int SaveMcds(fileBrowser_file *mcd1, fileBrowser_file *mcd2);
extern bool CreateMcd(int slot, fileBrowser_file *mcd);
extern void ConvertMcd(char *mcd, char *data);
typedef struct {
char Title[48 + 1]; // Title in ASCII
char sTitle[48 * 2 + 1]; // Title in Shift-JIS
char ID[12 + 1];
char Name[16 + 1];
int IconCount;
short Icon[16*16*3];
unsigned char Flags;
} McdBlock;
extern void GetMcdBlockInfo(int mcd, int block, McdBlock *info);
#ifdef __cplusplus
}
#endif
#endif