diff options
| author | SND\edgbla_cp <SND\edgbla_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2013-02-14 22:44:17 +0000 |
|---|---|---|
| committer | SND\edgbla_cp <SND\edgbla_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2013-02-14 22:44:17 +0000 |
| commit | f1d5f92e6bfbff24667a766610f7171bcf6d7116 (patch) | |
| tree | fb4a2ccf4cd310d62e82873377ef5558924af081 | |
| parent | ba0c9b98bf69b8e54e7117b21f2282d3b79c2988 (diff) | |
| download | pcsxr-f1d5f92e6bfbff24667a766610f7171bcf6d7116.tar.gz | |
...
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@82903 e17a0e51-4ae3-4d35-97c3-1a29b211df97
| -rwxr-xr-x | gui/Plugin.c | 9 | ||||
| -rwxr-xr-x | libpcsxcore/plugins.c | 4 | ||||
| -rwxr-xr-x | libpcsxcore/sio.c | 4 | ||||
| -rwxr-xr-x | libpcsxcore/sio.h | 2 | ||||
| -rwxr-xr-x | plugins/bladesio1/sio1.c | 132 | ||||
| -rwxr-xr-x | win32/gui/plugin.c | 21 |
6 files changed, 141 insertions, 31 deletions
diff --git a/gui/Plugin.c b/gui/Plugin.c index 62e8feb3..daf232c8 100755 --- a/gui/Plugin.c +++ b/gui/Plugin.c @@ -334,6 +334,11 @@ int _OpenPlugins() { if (ret < 0) { SysMessage(_("Error opening Controller 2 plugin!")); return -1; } PAD2_registerVibration(GPU_visualVibration); PAD2_registerCursor(GPU_cursor); +#ifdef ENABLE_SIO1API + ret = SIO1_open(&gpuDisp); + if (ret < 0) { SysMessage(_("Error opening SIO1 plugin!")); return -1; } + SIO1_registerCallback(SIO1irq); +#endif if (Config.UseNet && !NetOpened) { netInfo info; @@ -422,6 +427,10 @@ void ClosePlugins() { if (ret < 0) { SysMessage(_("Error closing Controller 2 plugin!")); return; } ret = GPU_close(); if (ret < 0) { SysMessage(_("Error closing GPU plugin!")); return; } +#ifdef ENABLE_SIO1API + ret = SIO1_close(); + if (ret < 0) { SysMessage(_("Error closing SIO1 plugin!")); return; } +#endif if (Config.UseNet) { NET_pause(); diff --git a/libpcsxcore/plugins.c b/libpcsxcore/plugins.c index 6ade3ce7..c0cfc199 100755 --- a/libpcsxcore/plugins.c +++ b/libpcsxcore/plugins.c @@ -656,10 +656,6 @@ unsigned short CALLBACK SIO1__readBaud16(void) { return 0; } unsigned long CALLBACK SIO1__readBaud32(void) { return 0; } void CALLBACK SIO1__registerCallback(void (CALLBACK *callback)(void)) {}; -void CALLBACK SIO1irq(void) { - psxHu32ref(0x1070) |= SWAPu32(0x100); -} - #define LoadSio1Sym1(dest, name) \ LoadSym(SIO1_##dest, SIO1##dest, name, TRUE); diff --git a/libpcsxcore/sio.c b/libpcsxcore/sio.c index df9479a3..83d4fae6 100755 --- a/libpcsxcore/sio.c +++ b/libpcsxcore/sio.c @@ -1326,3 +1326,7 @@ void SaveDongle( char *str ) fclose( f ); } } + +void CALLBACK SIO1irq(void) { + psxHu32ref(0x1070) |= SWAPu32(0x100); +} diff --git a/libpcsxcore/sio.h b/libpcsxcore/sio.h index 2514162b..f22218b3 100755 --- a/libpcsxcore/sio.h +++ b/libpcsxcore/sio.h @@ -70,6 +70,8 @@ typedef struct { void GetMcdBlockInfo(int mcd, int block, McdBlock *info); +void CALLBACK SIO1irq(void); + #ifdef __cplusplus } #endif diff --git a/plugins/bladesio1/sio1.c b/plugins/bladesio1/sio1.c index cef7d6cc..cba060d1 100755 --- a/plugins/bladesio1/sio1.c +++ b/plugins/bladesio1/sio1.c @@ -22,6 +22,7 @@ #include <string.h> #include <stdint.h> +#include "psxcommon.h" #include "psemu_plugin_defs.h" #include "settings.h" @@ -35,17 +36,84 @@ static const unsigned char version = 1; static const unsigned char revision = 1; static const unsigned char build = 1; +static void (CALLBACK *irqCallback)() = 0; + Settings settings; +/* sio status flags. + */ +enum +{ + SR_TXRDY = 0x0001, + SR_RXRDY = 0x0002, + SR_TXU = 0x0004, + SR_PERROR = 0x0008, + SR_OE = 0x0010, + SR_FE = 0x0020, + SR_0040 = 0x0040, // ? + SR_DSR = 0x0080, + SR_CTS = 0x0100, + SR_IRQ = 0x0200 +}; + +/* sio mode flags. + */ +enum +{ + MR_BR_1 = 0x0001, + MR_BR_16 = 0x0002, + MR_BR_64 = 0x0003, + MR_CHLEN_5 = 0x0000, + MR_CHLEN_6 = 0x0004, + MR_CHLEN_7 = 0x0008, + MR_CHLEN_8 = 0x000C, + MR_PEN = 0x0010, + MR_P_EVEN = 0x0020, + MR_SB_00 = 0x0000, + MR_SB_01 = 0x0040, + MR_SB_10 = 0x0080, + MR_SB_11 = 0x00C0 +}; + +/* sio control flags. + */ +enum +{ + CR_TXEN = 0x0001, + CR_DTR = 0x0002, + CR_RXEN = 0x0004, + CR_0008 = 0x0008, // ? + CR_ERRRST = 0x0010, + CR_RTS = 0x0020, + CR_RST = 0x0040, + CR_0080 = 0x0080, // HM? + CR_BUFSZ_1 = 0x0000, + CR_BUFSZ_2 = 0x0100, + CR_BUFSZ_4 = 0x0200, + CR_BUFSZ_8 = 0x0300, + CR_TXIEN = 0x0400, + CR_RXIEN = 0x0800, + CR_DSRIEN = 0x1000, + CR_2000 = 0x2000 // CTSIEN? +}; + +static u8 dataReg[8]; +static u16 statReg; +static u16 modeReg; +static u16 ctrlReg; +static u16 baudReg; + /******************************************************************************/ long CALLBACK SIO1init() { + printf("SIO1init()\n"); return 0; } long CALLBACK SIO1shutdown() { + printf("SIO1shutdown()\n"); return 0; } @@ -53,13 +121,22 @@ long CALLBACK SIO1shutdown() long CALLBACK SIO1open( unsigned long *gpuDisp ) { + printf("SIO1open()\n"); + settingsRead(); + + memset(dataReg, 0x00, sizeof(dataReg)); + statReg = SR_TXRDY | SR_TXU | SR_DSR | SR_CTS; + modeReg = 0x0000; + ctrlReg = 0x0000; + baudReg = 0x0000; return 0; } long CALLBACK SIO1close() { + printf("SIO1close()\n"); return 0; } @@ -67,10 +144,12 @@ long CALLBACK SIO1close() void CALLBACK SIO1pause() { + printf("SIO1pause()\n"); } void CALLBACK SIO1resume() { + printf("SIO1resume()\n"); } /******************************************************************************/ @@ -82,6 +161,9 @@ long CALLBACK SIO1keypressed( int val ) /******************************************************************************/ +/* Write. + */ + void CALLBACK SIO1writeData8(unsigned char val) { printf("SIO1writeData8(%.2x)\n", val); @@ -110,33 +192,42 @@ void CALLBACK SIO1writeStat32(unsigned long val) void CALLBACK SIO1writeMode16(unsigned short val) { printf("SIO1writeMode16(%.4x)\n", val); + modeReg = val; } void CALLBACK SIO1writeMode32(unsigned long val) { printf("SIO1writeMode32(%.8x)\n", val); + modeReg = val; } void CALLBACK SIO1writeCtrl16(unsigned short val) { printf("SIO1writeCtrl16(%.4x)\n", val); + ctrlReg = val; } void CALLBACK SIO1writeCtrl32(unsigned long val) { printf("SIO1writeCtrl32(%.8x)\n", val); + ctrlReg = val; } void CALLBACK SIO1writeBaud16(unsigned short val) { printf("SIO1writeBaud16(%.4x)\n", val); + baudReg = val; } void CALLBACK SIO1writeBaud32(unsigned long val) { printf("SIO1writeBaud32(%.8x)\n", val); + baudReg = val; } +/* Read. + */ + unsigned char CALLBACK SIO1readData8() { printf("SIO1readData8()\n"); @@ -157,67 +248,60 @@ unsigned long CALLBACK SIO1readData32() unsigned short CALLBACK SIO1readStat16() { - printf("SIO1readStat16()\n"); - return 0; + printf("SIO1readStat16() : %.4x\n", statReg); + return statReg; } unsigned long CALLBACK SIO1readStat32() { - printf("SIO1readStat32()\n"); - return 0; + printf("SIO1readStat32() : %.4x\n", statReg); + return statReg; } unsigned short CALLBACK SIO1readMode16() { - printf("SIO1readMode16()\n"); - return 0; + printf("SIO1readMode16() : %.4x\n", modeReg); + return modeReg; } unsigned long CALLBACK SIO1readMode32() { - printf("SIO1readMode32()\n"); - return 0; + printf("SIO1readMode32() : %.4x\n", modeReg); + return modeReg; } unsigned short CALLBACK SIO1readCtrl16() { - printf("SIO1readCtrl16()\n"); - return 0; + printf("SIO1readCtrl16() : %.4x\n", ctrlReg); + return ctrlReg; } unsigned long CALLBACK SIO1readCtrl32() { - printf("SIO1readCtrl32()\n"); - return 0; + printf("SIO1readCtrl32() : %.4x\n", ctrlReg); + return ctrlReg; } unsigned short CALLBACK SIO1readBaud16() { - printf("SIO1readBaud16()\n"); - return 0; + printf("SIO1readBaud16() : %.4x\n", baudReg); + return baudReg; } unsigned long CALLBACK SIO1readBaud32() { - printf("SIO1readBaud32()\n"); - return 0; + printf("SIO1readBaud32() : %.4x\n", baudReg); + return baudReg; } - /******************************************************************************/ void CALLBACK SIO1registerCallback(void (CALLBACK *callback)()) { + irqCallback = callback; } /******************************************************************************/ -/* -long CALLBACK SIO1queryPlayer() -{ - return settings.player; -} -*/ -/******************************************************************************/ unsigned long CALLBACK PSEgetLibType() { diff --git a/win32/gui/plugin.c b/win32/gui/plugin.c index d4d8c284..e5b9ad77 100755 --- a/win32/gui/plugin.c +++ b/win32/gui/plugin.c @@ -170,8 +170,6 @@ void PADhandleKey(int key) { } } -void CALLBACK SPUirq(void); - char charsTable[4] = { "|/-\\" }; BOOL CALLBACK ConnectDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { @@ -292,7 +290,12 @@ int _OpenPlugins(HWND hWnd) { if (ret < 0) { SysMessage (_("Error Opening PAD2 Plugin (%d)"), ret); return -1; } PAD2_registerVibration(GPU_visualVibration); PAD2_registerCursor(GPU_cursor); - +#ifdef ENABLE_SIO1API + ret = SIO1_open(); + if (ret < 0) { SysMessage (_("Error Opening SIO1 plugin (%d)"), ret); return -1; } + SIO1_registerCallback(SIO1irq); +#endif + SetCurrentDirectory(PcsxrDir); ShowCursor(FALSE); return 0; @@ -324,6 +327,10 @@ void ClosePlugins() { if (ret < 0) { SysMessage (_("Error Closing GPU Plugin")); return; } ret = SPU_close(); if (ret < 0) { SysMessage (_("Error Closing SPU Plugin")); return; } +#ifdef ENABLE_SIO1API + ret = SIO1_close(); + if (ret < 0) { SysMessage (_("Error Closing SIO1 plugin")); return; } +#endif if (Config.UseNet) { NET_pause(); @@ -338,6 +345,9 @@ void ResetPlugins() { SPU_shutdown(); PAD1_shutdown(); PAD2_shutdown(); +#ifdef ENABLE_SIO1API + SIO1_shutdown(); +#endif if (Config.UseNet) NET_shutdown(); ret = CDR_init(); @@ -350,6 +360,11 @@ void ResetPlugins() { if (ret != 0) { SysMessage (_("PAD1init error: %d"), ret); return; } ret = PAD2_init(2); if (ret != 0) { SysMessage (_("PAD2init error: %d"), ret); return; } +#ifdef ENABLE_SIO1API + ret = SIO1_init(); + if (ret != 0) { SysMessage (_("SIO1init error: %d"), ret); return; } +#endif + if (Config.UseNet) { ret = NET_init(); if (ret < 0) { SysMessage (_("NETinit error: %d"), ret); return; } |
