RSPXBlue.h 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2016 RWS Inc, All Rights Reserved
  4. //
  5. // This program is free software; you can redistribute it and/or modify
  6. // it under the terms of version 2 of the GNU General Public License as published by
  7. // the Free Software Foundation
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License along
  15. // with this program; if not, write to the Free Software Foundation, Inc.,
  16. // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. //
  18. // RSPiXBlue.h : header file
  19. //
  20. #ifndef RSPIXBLUE_H
  21. #define RSPIXBLUE_H
  22. ///////////////////////////////////////////////////////////////////////////////
  23. // Macros.
  24. ///////////////////////////////////////////////////////////////////////////////
  25. #define DllExport __declspec( dllexport )
  26. #define DllImport __declspec( dllimport )
  27. #ifdef _WINDLL
  28. #define DLL2EXE DllExport
  29. #define EXE2DLL DllImport
  30. #else
  31. #define DLL2EXE DllImport
  32. #define EXE2DLL DllExport
  33. #endif // _WINDLL
  34. ///////////////////////////////////////////////////////////////////////////////
  35. // Blue Includes.
  36. ///////////////////////////////////////////////////////////////////////////////
  37. #include "common/system.h"
  38. #include "common/bluewin.h"
  39. #include "common/bcritic.h"
  40. #include "common/bdialog.h"
  41. #include "common/bdisplay.h"
  42. #include "common/bjoy.h"
  43. #include "common/bkey.h"
  44. #include "common/bmain.h"
  45. #include "common/bmouse.h"
  46. #include "common/bpalette.h"
  47. #include "common/wpalette.h"
  48. #include "common/bparms.h"
  49. #include "common/bsound.h"
  50. #include "common/btime.h"
  51. ///////////////////////////////////////////////////////////////////////////////
  52. // Green Includes.
  53. ///////////////////////////////////////////////////////////////////////////////
  54. #include "image/image.h"
  55. /////////////////////////////////////////////////////////////////////////////
  56. // CRSPiXBlue window
  57. class EXE2DLL CRSPiXBlue : public CStatic
  58. {
  59. // Construction
  60. public:
  61. CWnd m_wndRSPiX;
  62. CWnd m_wndPal;
  63. CImage* m_pim;
  64. void Redraw(void);
  65. CRSPiXBlue();
  66. // Attributes
  67. public:
  68. // Operations
  69. public:
  70. ////////////////////////////////////////////////////////////////////////////
  71. // Extensions/Interfaces.
  72. ////////////////////////////////////////////////////////////////////////////
  73. // Set the buffer Blue uses to draw and redraw the display.
  74. void SetDisplayImage(CImage* pim, short sFlip = FALSE);
  75. // Set the palette Blue uses to draw and redraw the display.
  76. void SetDisplayPalette(CPal* ppal);
  77. ////////////////////////////////////////////////////////////////////////////
  78. // Indirection to Blue calls in the proverbial EXE.
  79. // NOTE: These are not documented as the WinBlue version could change w/o
  80. // this file being updated. Please refer to the b*.h or b*.cpp file for
  81. // details.
  82. ////////////////////////////////////////////////////////////////////////////
  83. // BCRITIC.H
  84. short Blu_RemoveCritical(CRITICALL cc)
  85. { return ::Blu_RemoveCritical(cc); }
  86. short Blu_AddCritical(CRITICALL cc, ULONG ulUser)
  87. { return ::Blu_AddCritical(cc, ulUser); }
  88. // BDEBUG.H
  89. #undef TRACE // We will use MFC's TRACE
  90. #define TRACE ::AfxTrace("%s(%d) :", __FILE__, __LINE__),::AfxTrace
  91. #undef STRACE
  92. #define STRACE ::AfxTrace
  93. // BDIALOG.H
  94. short Blu_MsgBox(USHORT usFlags, char *pszTitle, char *pszFrmt, ...)
  95. {
  96. char szOutput[16384];
  97. va_list varp;
  98. // Get pointer to the arguments.
  99. va_start(varp, pszFrmt);
  100. // Compose string.
  101. vsprintf(szOutput, pszFrmt, varp);
  102. // Done with var arguments.
  103. va_end(varp);
  104. return ::Blu_MsgBox(usFlags, pszTitle, szOutput);
  105. }
  106. short Blu_OpenBox(char* pszBoxTitle, char *pszFileName, short sStrSize)
  107. { return ::Blu_OpenBox(pszBoxTitle, pszFileName, sStrSize); }
  108. short Blu_MultiOpenBox( char* pszBoxTitle,
  109. char* pszFileNameMemory,
  110. long lNumBytes,
  111. char **ppszFileNames,
  112. short sMaxPtrs,
  113. short* psNumFiles
  114. )
  115. {
  116. return ::Blu_MultiOpenBox( pszBoxTitle, pszFileNameMemory,
  117. lNumBytes, ppszFileNames,
  118. sMaxPtrs, psNumFiles);
  119. }
  120. // BDISPLAY.H
  121. short Blu_CreateDisplay(long lWidth, long lHeight, short sColorDepth)
  122. { return ::Blu_CreateDisplay(lWidth, lHeight, sColorDepth); }
  123. void Blu_SetRedrawBuf( void* pvBuf,
  124. long lBufW, long lBufH,
  125. long sx, long sy,
  126. long dx, long dy,
  127. long lBltW, long lBltH,
  128. short sColorDepth,
  129. short sVertFlip = FALSE)
  130. {
  131. ::Blu_SetRedrawBuf( pvBuf, lBufW, lBufH, sx, sy, dx, dy,
  132. lBltW, lBltH, sColorDepth, sVertFlip);
  133. }
  134. void Blu_SetDisplayBuf( void* pvBuf, long lWidth, long lHeight,
  135. short sColorDepth, short sVertFlip = FALSE)
  136. { ::Blu_SetDisplayBuf(pvBuf, lWidth, lHeight, sColorDepth, sVertFlip); }
  137. U16* Blu_GetPaletteTranslation(void)
  138. { return ::Blu_GetPaletteTranslation(); }
  139. short Blu_UpdateDisplay(long sx, long sy,
  140. long dx, long dy,
  141. long w, long h)
  142. { return ::Blu_UpdateDisplay(sx, sy, dx, dy, w, h); }
  143. short Blu_SetWindowControls(short sControls)
  144. { return ::Blu_SetWindowControls(sControls); }
  145. long Blu_GetDisplayInfo(USHORT usInfo)
  146. { return ::Blu_GetDisplayInfo(usInfo); }
  147. short Blu_SetWindowTitle(char *pszTitleNameText)
  148. { return ::Blu_SetWindowTitle(pszTitleNameText); }
  149. short Blu_ValidateRect(long lX, long lY, long lW, long lH)
  150. { return ::Blu_ValidateRect(lX, lY, lW, lH); }
  151. // BJOY.H
  152. short Blu_UpdateJoy(short sJoy)
  153. { return ::Blu_UpdateJoy(sJoy); }
  154. void Blu_GetJoyPos(short sJoy, long *px, long *py, long *pz)
  155. { ::Blu_GetJoyPos(sJoy, px, py, pz); }
  156. void Blu_GetJoyPrevPos(short sJoy, long *px, long *py, long *pz)
  157. { ::Blu_GetJoyPrevPos(sJoy, px, py, pz); }
  158. USHORT Blu_GetJoyState(short sJoy)
  159. { return ::Blu_GetJoyState(sJoy); }
  160. void Blu_GetJoyState(short sJoy, PJOYSTATE pjs)
  161. { ::Blu_GetJoyState(sJoy, pjs); }
  162. USHORT Blu_GetJoyPrevState(short sJoy)
  163. { return ::Blu_GetJoyPrevState(sJoy); }
  164. void Blu_GetJoyPrevState(short sJoy, PJOYSTATE pjs)
  165. { ::Blu_GetJoyPrevState(sJoy, pjs); }
  166. // BKEY.H
  167. short Blu_GetKeyboard(PKEYBOARD pkb)
  168. { return ::Blu_GetKeyboard(pkb); }
  169. // BMAIN.H
  170. void Blu_System(void)
  171. { ::Blu_System(); }
  172. void Blu_DispatchEvents(short sDispatch)
  173. { ::Blu_DispatchEvents(sDispatch); }
  174. // BMOUSE.H
  175. short Blu_GetMousePos(long* px, long* py)
  176. { return ::Blu_GetMousePos(px, py); }
  177. short Blu_SetMousePos(long x, long y)
  178. { return ::Blu_SetMousePos(x, y); }
  179. short Blu_GetMouseButton(short sButton)
  180. { return ::Blu_GetMouseButton(sButton); }
  181. // BPALETTE.H
  182. short Blu_SetPalette(PRGBT8 prgbt8, short sIndex, short sNumEntries)
  183. { return ::Blu_SetPalette(prgbt8, sIndex, sNumEntries); }
  184. short Blu_SetPalette(PRGBQ8 prgbq8, short sIndex, short sNumEntries)
  185. { return ::Blu_SetPalette(prgbq8, sIndex, sNumEntries); }
  186. short Blu_SetPalette(PRGBT5 prgbt5, short sIndex, short sNumEntries)
  187. { return ::Blu_SetPalette(prgbt5, sIndex, sNumEntries); }
  188. short Blu_SetPaletteUsage(short sFull)
  189. { return ::Blu_SetPaletteUsage(sFull); }
  190. void Blu_SetPaletteWindowVisibility(short sVisible)
  191. { ::Blu_SetPaletteWindowVisibility(sVisible); }
  192. // WPALETTE.H
  193. short Blu_SetPalette(RGBQUAD* prgbq, short sIndex, short sNumEntries)
  194. { return ::Blu_SetPalette(prgbq, sIndex, sNumEntries); }
  195. RGBQUAD* Blu_GetPalette(void)
  196. { return ::Blu_GetPalette(); }
  197. HWND Blu_GetPaletteWindow(void)
  198. { return ::Blu_GetPaletteWindow(); }
  199. // BPARMS.H
  200. short Blu_GetNumParms(void)
  201. { return ::Blu_GetNumParms(); }
  202. char* Blu_GetParm(short sNum)
  203. { return ::Blu_GetParm(sNum); }
  204. // BSOUND.H
  205. long Blu_GetSoundOutWindowSize(void)
  206. { return ::Blu_GetSoundOutWindowSize(); }
  207. void Blu_SetSoundOutWindowSize(long lWindowSize)
  208. { ::Blu_SetSoundOutWindowSize(lWindowSize); }
  209. long Blu_GetSoundOutPaneSize(void)
  210. { return ::Blu_GetSoundOutPaneSize(); }
  211. void Blu_SetSoundOutPaneSize(long lPaneSize)
  212. { ::Blu_SetSoundOutPaneSize(lPaneSize); }
  213. short Blu_OpenSoundOut( ULONG ulSampleRate,
  214. USHORT usBitsPerSample,
  215. USHORT usNumChannels)
  216. {
  217. return ::Blu_OpenSoundOut( ulSampleRate,
  218. usBitsPerSample,
  219. usNumChannels);
  220. }
  221. short Blu_CloseSoundOut(void)
  222. { return ::Blu_CloseSoundOut(); }
  223. short Blu_StartSoundOut(BLU_SND_CALLBACK callback,
  224. ULONG ulUser)
  225. { return ::Blu_StartSoundOut(callback, ulUser); }
  226. short Blu_IsSoundOutOpen(void)
  227. { return ::Blu_IsSoundOutOpen(); }
  228. short Blu_ResetSoundOut(void)
  229. { return ::Blu_ResetSoundOut(); }
  230. short Blu_PauseSoundOut(void)
  231. { return ::Blu_PauseSoundOut(); }
  232. short Blu_ResumeSoundOut(void)
  233. { return ::Blu_ResumeSoundOut(); }
  234. long Blu_GetSoundOutPos(void)
  235. { return ::Blu_GetSoundOutPos(); }
  236. long Blu_GetSoundOutTime(void)
  237. { return ::Blu_GetSoundOutTime(); }
  238. // BTIME.H
  239. long Blu_GetTime(void)
  240. { return ::Blu_GetTime(); }
  241. // SYSINFO
  242. SYSINFO* GetSysInfo(void)
  243. { return &gsi; }
  244. // Additional non-blue.
  245. // Returns a CWnd* to the RSPiX window.
  246. CWnd* GetBlueWindow();
  247. // Returns a CWnd* to the palette window.
  248. CWnd* GetPaletteWindow();
  249. ////////////////////////////////////////////////////////////////////////////
  250. // Overrides
  251. ////////////////////////////////////////////////////////////////////////////
  252. // ClassWizard generated virtual function overrides
  253. //{{AFX_VIRTUAL(CRSPiXBlue)
  254. protected:
  255. virtual void PreSubclassWindow();
  256. virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  257. //}}AFX_VIRTUAL
  258. // Implementation
  259. public:
  260. virtual ~CRSPiXBlue();
  261. // Generated message map functions
  262. protected:
  263. //{{AFX_MSG(CRSPiXBlue)
  264. afx_msg void OnDestroy();
  265. afx_msg void OnSetFocus(CWnd* pOldWnd);
  266. //}}AFX_MSG
  267. DECLARE_MESSAGE_MAP()
  268. };
  269. /////////////////////////////////////////////////////////////////////////////
  270. #endif // RSPIXBLUE_H