Win32 port can now also be compiled with MinGW. Some cleanup.
This commit is contained in:
235
zsnes/src/win/afxres.h
Normal file
235
zsnes/src/win/afxres.h
Normal file
@@ -0,0 +1,235 @@
|
||||
#ifndef __AFXRES_H__
|
||||
#define __AFXRES_H__
|
||||
|
||||
#include "winresrc.h" // extract from windows header
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// MFC resource types (see Technical note TN024 for implementation details)
|
||||
|
||||
#ifndef RC_INVOKED
|
||||
#define RT_DLGINIT MAKEINTRESOURCE(240)
|
||||
#define RT_TOOLBAR MAKEINTRESOURCE(241)
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// General style bits etc
|
||||
|
||||
// ControlBar styles
|
||||
#define CBRS_ALIGN_LEFT 0x1000L
|
||||
#define CBRS_ALIGN_TOP 0x2000L
|
||||
#define CBRS_ALIGN_RIGHT 0x4000L
|
||||
#define CBRS_ALIGN_BOTTOM 0x8000L
|
||||
#define CBRS_ALIGN_ANY 0xF000L
|
||||
|
||||
#define CBRS_BORDER_LEFT 0x0100L
|
||||
#define CBRS_BORDER_TOP 0x0200L
|
||||
#define CBRS_BORDER_RIGHT 0x0400L
|
||||
#define CBRS_BORDER_BOTTOM 0x0800L
|
||||
#define CBRS_BORDER_ANY 0x0F00L
|
||||
|
||||
#define CBRS_TOOLTIPS 0x0010L
|
||||
#define CBRS_FLYBY 0x0020L
|
||||
#define CBRS_FLOAT_MULTI 0x0040L
|
||||
#define CBRS_BORDER_3D 0x0080L
|
||||
#define CBRS_HIDE_INPLACE 0x0008L
|
||||
#define CBRS_SIZE_DYNAMIC 0x0004L
|
||||
#define CBRS_SIZE_FIXED 0x0002L
|
||||
#define CBRS_FLOATING 0x0001L
|
||||
|
||||
#define CBRS_GRIPPER 0x00400000L
|
||||
|
||||
#define CBRS_ORIENT_HORZ (CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM)
|
||||
#define CBRS_ORIENT_VERT (CBRS_ALIGN_LEFT|CBRS_ALIGN_RIGHT)
|
||||
#define CBRS_ORIENT_ANY (CBRS_ORIENT_HORZ|CBRS_ORIENT_VERT)
|
||||
|
||||
#define CBRS_ALL 0x0040FFFFL
|
||||
|
||||
// the CBRS_ style is made up of an alignment style and a draw border style
|
||||
// the alignment styles are mutually exclusive
|
||||
// the draw border styles may be combined
|
||||
#define CBRS_NOALIGN 0x00000000L
|
||||
#define CBRS_LEFT (CBRS_ALIGN_LEFT|CBRS_BORDER_RIGHT)
|
||||
#define CBRS_TOP (CBRS_ALIGN_TOP|CBRS_BORDER_BOTTOM)
|
||||
#define CBRS_RIGHT (CBRS_ALIGN_RIGHT|CBRS_BORDER_LEFT)
|
||||
#define CBRS_BOTTOM (CBRS_ALIGN_BOTTOM|CBRS_BORDER_TOP)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Standard window components
|
||||
|
||||
// Mode indicators in status bar - these are routed like commands
|
||||
#define ID_INDICATOR_EXT 0xE700 // extended selection indicator
|
||||
#define ID_INDICATOR_CAPS 0xE701 // cap lock indicator
|
||||
#define ID_INDICATOR_NUM 0xE702 // num lock indicator
|
||||
#define ID_INDICATOR_SCRL 0xE703 // scroll lock indicator
|
||||
#define ID_INDICATOR_OVR 0xE704 // overtype mode indicator
|
||||
#define ID_INDICATOR_REC 0xE705 // record mode indicator
|
||||
#define ID_INDICATOR_KANA 0xE706 // kana lock indicator
|
||||
|
||||
#define ID_SEPARATOR 0 // special separator value
|
||||
|
||||
#ifndef RC_INVOKED // code only
|
||||
// Standard control bars (IDW = window ID)
|
||||
#define AFX_IDW_CONTROLBAR_FIRST 0xE800
|
||||
#define AFX_IDW_CONTROLBAR_LAST 0xE8FF
|
||||
|
||||
#define AFX_IDW_TOOLBAR 0xE800 // main Toolbar for window
|
||||
#define AFX_IDW_STATUS_BAR 0xE801 // Status bar window
|
||||
#define AFX_IDW_PREVIEW_BAR 0xE802 // PrintPreview Dialog Bar
|
||||
#define AFX_IDW_RESIZE_BAR 0xE803 // OLE in-place resize bar
|
||||
#define AFX_IDW_REBAR 0xE804 // COMCTL32 "rebar" Bar
|
||||
#define AFX_IDW_DIALOGBAR 0xE805 // CDialogBar
|
||||
|
||||
// Note: If your application supports docking toolbars, you should
|
||||
// not use the following IDs for your own toolbars. The IDs chosen
|
||||
// are at the top of the first 32 such that the bars will be hidden
|
||||
// while in print preview mode, and are not likely to conflict with
|
||||
// IDs your application may have used succesfully in the past.
|
||||
|
||||
#define AFX_IDW_DOCKBAR_TOP 0xE81B
|
||||
#define AFX_IDW_DOCKBAR_LEFT 0xE81C
|
||||
#define AFX_IDW_DOCKBAR_RIGHT 0xE81D
|
||||
#define AFX_IDW_DOCKBAR_BOTTOM 0xE81E
|
||||
#define AFX_IDW_DOCKBAR_FLOAT 0xE81F
|
||||
|
||||
// Macro for mapping standard control bars to bitmask (limit of 32)
|
||||
#define AFX_CONTROLBAR_MASK(nIDC) (1L << (nIDC - AFX_IDW_CONTROLBAR_FIRST))
|
||||
|
||||
// parts of Main Frame
|
||||
#define AFX_IDW_PANE_FIRST 0xE900 // first pane (256 max)
|
||||
#define AFX_IDW_PANE_LAST 0xE9ff
|
||||
#define AFX_IDW_HSCROLL_FIRST 0xEA00 // first Horz scrollbar (16 max)
|
||||
#define AFX_IDW_VSCROLL_FIRST 0xEA10 // first Vert scrollbar (16 max)
|
||||
|
||||
#define AFX_IDW_SIZE_BOX 0xEA20 // size box for splitters
|
||||
#define AFX_IDW_PANE_SAVE 0xEA21 // to shift AFX_IDW_PANE_FIRST
|
||||
#endif //!RC_INVOKED
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
|
||||
// common style for form views
|
||||
#define AFX_WS_DEFAULT_VIEW (WS_CHILD | WS_VISIBLE | WS_BORDER)
|
||||
|
||||
#endif //!APSTUDIO_INVOKED
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Standard app configurable strings
|
||||
|
||||
// for application title (defaults to EXE name or name in constructor)
|
||||
#define AFX_IDS_APP_TITLE 0xE000
|
||||
// idle message bar line
|
||||
#define AFX_IDS_IDLEMESSAGE 0xE001
|
||||
// message bar line when in shift-F1 help mode
|
||||
#define AFX_IDS_HELPMODEMESSAGE 0xE002
|
||||
// document title when editing OLE embedding
|
||||
#define AFX_IDS_APP_TITLE_EMBEDDING 0xE003
|
||||
// company name
|
||||
#define AFX_IDS_COMPANY_NAME 0xE004
|
||||
// object name when server is inplace
|
||||
#define AFX_IDS_OBJ_TITLE_INPLACE 0xE005
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Standard Commands
|
||||
|
||||
// File commands
|
||||
#define ID_FILE_NEW 0xE100
|
||||
#define ID_FILE_OPEN 0xE101
|
||||
#define ID_FILE_CLOSE 0xE102
|
||||
#define ID_FILE_SAVE 0xE103
|
||||
#define ID_FILE_SAVE_AS 0xE104
|
||||
#define ID_FILE_PAGE_SETUP 0xE105
|
||||
#define ID_FILE_PRINT_SETUP 0xE106
|
||||
#define ID_FILE_PRINT 0xE107
|
||||
#define ID_FILE_PRINT_DIRECT 0xE108
|
||||
#define ID_FILE_PRINT_PREVIEW 0xE109
|
||||
#define ID_FILE_UPDATE 0xE10A
|
||||
#define ID_FILE_SAVE_COPY_AS 0xE10B
|
||||
#define ID_FILE_SEND_MAIL 0xE10C
|
||||
#define ID_FILE_NEW_FRAME 0xE10D
|
||||
|
||||
#define ID_FILE_MRU_FIRST 0xE110
|
||||
#define ID_FILE_MRU_FILE1 0xE110 // range - 16 max
|
||||
#define ID_FILE_MRU_FILE2 0xE111
|
||||
#define ID_FILE_MRU_FILE3 0xE112
|
||||
#define ID_FILE_MRU_FILE4 0xE113
|
||||
#define ID_FILE_MRU_FILE5 0xE114
|
||||
#define ID_FILE_MRU_FILE6 0xE115
|
||||
#define ID_FILE_MRU_FILE7 0xE116
|
||||
#define ID_FILE_MRU_FILE8 0xE117
|
||||
#define ID_FILE_MRU_FILE9 0xE118
|
||||
#define ID_FILE_MRU_FILE10 0xE119
|
||||
#define ID_FILE_MRU_FILE11 0xE11A
|
||||
#define ID_FILE_MRU_FILE12 0xE11B
|
||||
#define ID_FILE_MRU_FILE13 0xE11C
|
||||
#define ID_FILE_MRU_FILE14 0xE11D
|
||||
#define ID_FILE_MRU_FILE15 0xE11E
|
||||
#define ID_FILE_MRU_FILE16 0xE11F
|
||||
#define ID_FILE_MRU_LAST 0xE11F
|
||||
|
||||
// Edit commands
|
||||
#define ID_EDIT_CLEAR 0xE120
|
||||
#define ID_EDIT_CLEAR_ALL 0xE121
|
||||
#define ID_EDIT_COPY 0xE122
|
||||
#define ID_EDIT_CUT 0xE123
|
||||
#define ID_EDIT_FIND 0xE124
|
||||
#define ID_EDIT_PASTE 0xE125
|
||||
#define ID_EDIT_PASTE_LINK 0xE126
|
||||
#define ID_EDIT_PASTE_SPECIAL 0xE127
|
||||
#define ID_EDIT_REPEAT 0xE128
|
||||
#define ID_EDIT_REPLACE 0xE129
|
||||
#define ID_EDIT_SELECT_ALL 0xE12A
|
||||
#define ID_EDIT_UNDO 0xE12B
|
||||
#define ID_EDIT_REDO 0xE12C
|
||||
|
||||
// Window commands
|
||||
#define ID_WINDOW_NEW 0xE130
|
||||
#define ID_WINDOW_ARRANGE 0xE131
|
||||
#define ID_WINDOW_CASCADE 0xE132
|
||||
#define ID_WINDOW_TILE_HORZ 0xE133
|
||||
#define ID_WINDOW_TILE_VERT 0xE134
|
||||
#define ID_WINDOW_SPLIT 0xE135
|
||||
#ifndef RC_INVOKED // code only
|
||||
#define AFX_IDM_WINDOW_FIRST 0xE130
|
||||
#define AFX_IDM_WINDOW_LAST 0xE13F
|
||||
#define AFX_IDM_FIRST_MDICHILD 0xFF00 // window list starts here
|
||||
#endif //!RC_INVOKED
|
||||
|
||||
// Help and App commands
|
||||
#define ID_APP_ABOUT 0xE140
|
||||
#define ID_APP_EXIT 0xE141
|
||||
#define ID_HELP_INDEX 0xE142
|
||||
#define ID_HELP_FINDER 0xE143
|
||||
#define ID_HELP_USING 0xE144
|
||||
#define ID_CONTEXT_HELP 0xE145 // shift-F1
|
||||
// special commands for processing help
|
||||
#define ID_HELP 0xE146 // first attempt for F1
|
||||
#define ID_DEFAULT_HELP 0xE147 // last attempt
|
||||
|
||||
// Misc
|
||||
#define ID_NEXT_PANE 0xE150
|
||||
#define ID_PREV_PANE 0xE151
|
||||
|
||||
// Format
|
||||
#define ID_FORMAT_FONT 0xE160
|
||||
|
||||
// OLE commands
|
||||
#define ID_OLE_INSERT_NEW 0xE200
|
||||
#define ID_OLE_EDIT_LINKS 0xE201
|
||||
#define ID_OLE_EDIT_CONVERT 0xE202
|
||||
#define ID_OLE_EDIT_CHANGE_ICON 0xE203
|
||||
#define ID_OLE_EDIT_PROPERTIES 0xE204
|
||||
#define ID_OLE_VERB_FIRST 0xE210 // range - 16 max
|
||||
#ifndef RC_INVOKED // code only
|
||||
#define ID_OLE_VERB_LAST 0xE21F
|
||||
#endif //!RC_INVOKED
|
||||
|
||||
#define IDC_STATIC (-1)
|
||||
#ifndef SS_BITMAP
|
||||
#define SS_BITMAP 14
|
||||
#endif
|
||||
|
||||
#ifndef IDCLOSE
|
||||
#define IDCLOSE 8
|
||||
#endif
|
||||
|
||||
#endif //__AFXRES_H__
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1532,10 +1532,6 @@ NEWSYM StartSound
|
||||
|
||||
|
||||
NEWSYM SoundProcess ; This function is called ~60 times/s at full speed
|
||||
pushad
|
||||
; cmp byte[OSPort],1 ; Do not call in the dos port
|
||||
; ja .notdos
|
||||
;.notdos
|
||||
cmp byte[soundon],0
|
||||
je .nosound
|
||||
cmp byte[DSPDisable],1
|
||||
@@ -1550,7 +1546,6 @@ NEWSYM SoundProcess ; This function is called ~60 times/s at full speed
|
||||
; DSPBuffer should contain the processed buffer in the specified size
|
||||
; You will have to convert/clip it to 16-bit for actual sound process
|
||||
.nosound
|
||||
popad
|
||||
ret
|
||||
|
||||
NEWSYM delay
|
||||
|
||||
@@ -22,7 +22,7 @@ extern "C" {
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <ddraw.h>
|
||||
#include <initguid.h>
|
||||
//#include <initguid.h>
|
||||
#include <mmsystem.h>
|
||||
#include <time.h>
|
||||
}
|
||||
@@ -32,6 +32,62 @@ extern "C" {
|
||||
#include <winuser.h>
|
||||
#include "resource.h"
|
||||
|
||||
|
||||
/*
|
||||
December 17 2004 -Nach
|
||||
|
||||
I added some macros for inline assembly to keep compatibility between GCC and MSVC
|
||||
|
||||
ASM_BEGIN is to start an assembly section
|
||||
ASM_END is to end it
|
||||
|
||||
ASM_COMMAND is for any simple command without a , in it example: dec eax
|
||||
ASM_COMMAND2 is when a command has a , for example: add ebx, 5
|
||||
ASM_COMMAND3 is when the parameter after the , is a variable example: mov eax, my_variable
|
||||
|
||||
ASM_CALL is for calling another function inside assembly section
|
||||
|
||||
asm_call() can be treated like any C function, use it to call an assembly function
|
||||
from any normal C code.
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__ //MinGW
|
||||
|
||||
//Simple start and end structure, set as volatile so perhaps we can use -O1+ later
|
||||
#define ASM_BEGIN asm volatile (
|
||||
#define ASM_END );
|
||||
//All commands need quotes and a newline and tab. C vars are _ prefixed
|
||||
#define ASM_COMMAND(line) #line"\n\t"
|
||||
#define ASM_COMMAND2(line, part2) #line", "#part2"\n\t"
|
||||
#define ASM_COMMAND3(line, var) #line", _"#var"\n\t"
|
||||
//Just for the prefix
|
||||
#define ASM_CALL(func) ASM_COMMAND(call _ ## func)
|
||||
//A function call is a simple register backup, call, restore
|
||||
#define asm_call(func) ASM_BEGIN \
|
||||
ASM_COMMAND(pushad) \
|
||||
ASM_CALL(func) \
|
||||
ASM_COMMAND(popad) \
|
||||
ASM_END
|
||||
|
||||
#else //MSVC
|
||||
|
||||
#define ASM_BEGIN _asm {
|
||||
#define ASM_END };
|
||||
|
||||
//MSVC is all straight foward about these
|
||||
#define ASM_COMMAND(line) line
|
||||
#define ASM_COMMAND2(line, part2) line, part2
|
||||
#define ASM_COMMAND3(line, var) ASM_COMMAND2(line, var)
|
||||
//Next is not really special either
|
||||
#define ASM_CALL(func) ASM_COMMAND(call func)
|
||||
//Using this weird style because of MSVCs bad parsing
|
||||
#define asm_call(func) _asm pushad \
|
||||
_asm call func \
|
||||
_asm popad
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
DWORD WindowWidth = 256;
|
||||
DWORD WindowHeight = 224;
|
||||
|
||||
@@ -138,10 +194,11 @@ DWORD SurfaceY=0;
|
||||
HANDLE hLock, hThread;
|
||||
DWORD dwThreadId, dwThreadParam, semaphore_run;
|
||||
|
||||
extern "C" int SemaphoreMax = 5;
|
||||
|
||||
extern "C" void InitSemaphore();
|
||||
extern "C" void ShutdownSemaphore();
|
||||
extern "C" {
|
||||
int SemaphoreMax = 5;
|
||||
void InitSemaphore();
|
||||
void ShutdownSemaphore();
|
||||
}
|
||||
|
||||
static char dinput8_dll[] = {"dinput8.dll\0"};
|
||||
static char dinput8_imp[] = {"DirectInput8Create\0"};
|
||||
@@ -234,12 +291,19 @@ extern "C" void ImportDirectX()
|
||||
}
|
||||
}
|
||||
|
||||
#define UPDATE_TICKS_GAME 1000.855001760297741789468390082/60 // milliseconds per world update
|
||||
#define UPDATE_TICKS_GAMEPAL 1000/50 // milliseconds per world update
|
||||
#define UPDATE_TICKS_GUI 1000/36 // milliseconds per world update
|
||||
#define UPDATE_TICKS_UDP 1000/60 // milliseconds per world update
|
||||
//Nach: I'm not sure why we have such a number for NTSC, but MinGW
|
||||
//is using floating point arithmetic with it and going really slow.
|
||||
//So for MinGW I set it to the same idea as PAL
|
||||
#ifdef __GNUC__
|
||||
#define UPDATE_TICKS_GAME (1000/60)
|
||||
#else
|
||||
#define UPDATE_TICKS_GAME (1000.855001760297741789468390082/60) // milliseconds per world update
|
||||
#endif
|
||||
#define UPDATE_TICKS_GAMEPAL (1000/50) // milliseconds per world update
|
||||
#define UPDATE_TICKS_GUI (1000/36) // milliseconds per world update
|
||||
#define UPDATE_TICKS_UDP (1000/60) // milliseconds per world update
|
||||
|
||||
_int64 start, end, freq, update_ticks_pc, start2, end2, update_ticks_pc2;
|
||||
__int64 start, end, freq, update_ticks_pc, start2, end2, update_ticks_pc2;
|
||||
|
||||
void ReleaseDirectDraw();
|
||||
void ReleaseDirectSound();
|
||||
@@ -251,7 +315,7 @@ extern "C"
|
||||
{
|
||||
void drawscreenwin(void);
|
||||
DWORD LastUsedPos=0;
|
||||
DWORD CurMode=-1;
|
||||
DWORD CurMode=~0;
|
||||
void initDirectDraw()
|
||||
{
|
||||
InitDirectDraw();
|
||||
@@ -324,7 +388,7 @@ void DrawScreen()
|
||||
|
||||
DWORD InputEn=0;
|
||||
|
||||
InputAcquire(void)
|
||||
BOOL InputAcquire(void)
|
||||
{
|
||||
if (JoystickInput[0]) JoystickInput[0]->Acquire();
|
||||
if (JoystickInput[1]) JoystickInput[1]->Acquire();
|
||||
@@ -392,7 +456,7 @@ extern "C" BYTE MouseWheel;
|
||||
|
||||
BOOL InputRead(void)
|
||||
{
|
||||
static PrevZ=0;
|
||||
static int PrevZ=0;
|
||||
MouseMoveX=0;
|
||||
MouseMoveY=0;
|
||||
if (MouseInput&&InputEn==1)
|
||||
@@ -459,13 +523,8 @@ void ExitFunction()
|
||||
{
|
||||
if (GUIOn2 == 0)
|
||||
{
|
||||
_asm
|
||||
{
|
||||
pushad
|
||||
call SaveSramData
|
||||
call GUISaveVars
|
||||
popad
|
||||
}
|
||||
asm_call(SaveSramData);
|
||||
asm_call(GUISaveVars);
|
||||
}
|
||||
IsActivated = 0;
|
||||
ReleaseDirectInput();
|
||||
@@ -483,10 +542,7 @@ LRESULT CALLBACK Main_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
bool accept;
|
||||
int vkeyval;
|
||||
|
||||
//MK: unused 2003/08/31
|
||||
// short zDelta;
|
||||
|
||||
switch (uMsg)
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_KEYDOWN: // sent when user presses a key
|
||||
if (!((CurKeyPos+1==CurKeyReadPos) || ((CurKeyPos+1==16)
|
||||
@@ -664,7 +720,7 @@ int RegisterWinClass(void)
|
||||
BYTE PrevStereoSound;
|
||||
DWORD PrevSoundQuality;
|
||||
|
||||
InitSound()
|
||||
BOOL InitSound()
|
||||
{
|
||||
WAVEFORMATEX wfx;
|
||||
DSBCAPS dsbcaps;
|
||||
@@ -788,7 +844,7 @@ InitSound()
|
||||
}
|
||||
}
|
||||
|
||||
ReInitSound()
|
||||
BOOL ReInitSound()
|
||||
{
|
||||
WAVEFORMATEX wfx;
|
||||
DSBCAPS dsbcaps;
|
||||
@@ -1330,8 +1386,8 @@ DWORD FirstFull=1;
|
||||
DWORD DMode=0;
|
||||
DWORD SMode=0;
|
||||
DWORD DSMode=0;
|
||||
DWORD prevHQMode=-1;
|
||||
DWORD prevScanlines=-1;
|
||||
DWORD prevHQMode=~0;
|
||||
DWORD prevScanlines=~0;
|
||||
WORD Refresh = 0;
|
||||
extern "C" BYTE GUIWFVID[];
|
||||
extern "C" BYTE GUIDSIZE[];
|
||||
@@ -1766,12 +1822,8 @@ char WinName[]={"ZSNESW\0"};
|
||||
|
||||
void initwinvideo(void)
|
||||
{
|
||||
//MK: unused 2003/08/31
|
||||
//RECT zwindowrect;
|
||||
WINDOWPLACEMENT wndpl;
|
||||
RECT rc1;
|
||||
//MK: unused 2003/08/31
|
||||
//RECT swrect;
|
||||
DWORD newmode=0;
|
||||
DWORD HQMode=0;
|
||||
|
||||
@@ -2017,12 +2069,7 @@ void initwinvideo(void)
|
||||
if (Force60hz) Refresh = 60;
|
||||
InitDirectDraw();
|
||||
clearwin();
|
||||
_asm
|
||||
{
|
||||
pushad
|
||||
call Clear2xSaIBuffer
|
||||
popad
|
||||
}
|
||||
asm_call(Clear2xSaIBuffer);
|
||||
clear_display();
|
||||
return;
|
||||
}
|
||||
@@ -2034,12 +2081,7 @@ void initwinvideo(void)
|
||||
ReleaseDirectDraw();
|
||||
InitDirectDraw();
|
||||
clearwin();
|
||||
_asm
|
||||
{
|
||||
pushad
|
||||
call Clear2xSaIBuffer
|
||||
popad
|
||||
}
|
||||
asm_call(Clear2xSaIBuffer);
|
||||
clear_display();
|
||||
return;
|
||||
}
|
||||
@@ -2052,8 +2094,8 @@ extern int DSPBuffer;
|
||||
int * DSPBuffer1;
|
||||
DWORD ScreenPtr;
|
||||
DWORD ScreenPtr2;
|
||||
extern GUI36hzcall(void);
|
||||
extern Game60hzcall(void);
|
||||
extern void GUI36hzcall(void);
|
||||
extern void Game60hzcall(void);
|
||||
extern int packettimeleft[256];
|
||||
extern int PacketCounter;
|
||||
extern int CounterA;
|
||||
@@ -2101,156 +2143,164 @@ void CheckTimers(void)
|
||||
|
||||
extern unsigned char MMXSupport;
|
||||
|
||||
extern "C" {
|
||||
volatile int SPCSize;
|
||||
volatile int buffer_ptr;
|
||||
}
|
||||
|
||||
void UpdateVFrame(void)
|
||||
{
|
||||
int DataNeeded;
|
||||
int SPCSize=256;
|
||||
int DataNeeded;
|
||||
SPCSize=256;
|
||||
|
||||
if (StereoSound==1)SPCSize=256;
|
||||
if (StereoSound==1) SPCSize=256;
|
||||
|
||||
while (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
while (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
WinUpdateDevices();
|
||||
CheckTimers();
|
||||
WinUpdateDevices();
|
||||
CheckTimers();
|
||||
|
||||
if (SoundEnabled == 0) return;
|
||||
if (SoundEnabled == 0) return;
|
||||
|
||||
if(!UsePrimaryBuffer) lpSoundBuffer->GetCurrentPosition(&CurrentPos,&WritePos);
|
||||
else lpPrimaryBuffer->GetCurrentPosition(&CurrentPos,&WritePos);
|
||||
if(!UsePrimaryBuffer) lpSoundBuffer->GetCurrentPosition(&CurrentPos,&WritePos);
|
||||
else lpPrimaryBuffer->GetCurrentPosition(&CurrentPos,&WritePos);
|
||||
|
||||
if (LastUsedPos <= CurrentPos)
|
||||
{
|
||||
DataNeeded=CurrentPos-LastUsedPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
DataNeeded=SoundBufferSize - LastUsedPos + CurrentPos;
|
||||
}
|
||||
if (LastUsedPos <= CurrentPos)
|
||||
{
|
||||
DataNeeded=CurrentPos-LastUsedPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
DataNeeded=SoundBufferSize - LastUsedPos + CurrentPos;
|
||||
}
|
||||
|
||||
DataNeeded/=(SPCSize*2);
|
||||
DataNeeded*=(SPCSize*2);
|
||||
DataNeeded/=(SPCSize*2);
|
||||
DataNeeded*=(SPCSize*2);
|
||||
|
||||
while (DataNeeded>0)
|
||||
{
|
||||
_asm
|
||||
while (DataNeeded>0)
|
||||
{
|
||||
asm_call(SoundProcess);
|
||||
|
||||
DSPBuffer1=(int *)&DSPBuffer;
|
||||
|
||||
buffer_ptr = (int)&Buffer[0];
|
||||
|
||||
if (T36HZEnabled == 1)
|
||||
{
|
||||
if (MMXSupport == 1)
|
||||
{
|
||||
pushad
|
||||
call SoundProcess
|
||||
popad
|
||||
ASM_BEGIN
|
||||
ASM_COMMAND3(mov edi,buffer_ptr)
|
||||
ASM_COMMAND3(mov ecx,SPCSize)
|
||||
ASM_COMMAND2(shr ecx,2)
|
||||
ASM_COMMAND2(pxor mm0,mm0)
|
||||
ASM_COMMAND(_blank_top_fpu:)
|
||||
ASM_COMMAND2(movq [edi],mm0)
|
||||
ASM_COMMAND2(add edi,8)
|
||||
ASM_COMMAND(dec ecx)
|
||||
ASM_COMMAND(jne _blank_top_fpu)
|
||||
ASM_COMMAND(emms)
|
||||
ASM_END
|
||||
}
|
||||
|
||||
DSPBuffer1=(int *)&DSPBuffer;
|
||||
|
||||
int buffer_ptr = (int)&Buffer[0];
|
||||
|
||||
if (T36HZEnabled == 1)
|
||||
if (MMXSupport == 1)
|
||||
_asm
|
||||
{
|
||||
mov edi,buffer_ptr
|
||||
mov ecx,SPCSize
|
||||
shr ecx,2
|
||||
pxor mm0,mm0
|
||||
_blank_top_fpu:
|
||||
movq [edi],mm0
|
||||
add edi,8
|
||||
dec ecx
|
||||
jne _blank_top_fpu
|
||||
emms
|
||||
}
|
||||
else
|
||||
_asm
|
||||
{
|
||||
mov edi,buffer_ptr
|
||||
mov ecx,SPCSize
|
||||
shr ecx,1
|
||||
xor eax,eax
|
||||
_blank_top:
|
||||
mov [edi],eax
|
||||
add edi,4
|
||||
dec ecx
|
||||
jne _blank_top
|
||||
}
|
||||
else
|
||||
if (MMXSupport == 1)
|
||||
_asm
|
||||
{
|
||||
mov esi,DSPBuffer1
|
||||
mov edi,buffer_ptr
|
||||
mov ecx,SPCSize
|
||||
shr ecx,2
|
||||
_top_mmx:
|
||||
movq mm0,[esi]
|
||||
packssdw mm0,[esi+8]
|
||||
movq [edi],mm0
|
||||
add esi,16
|
||||
add edi,8
|
||||
dec ecx
|
||||
jne _top_mmx
|
||||
emms
|
||||
}
|
||||
else
|
||||
for(i=0;i<SPCSize;i++)
|
||||
{
|
||||
Buffer[i]=DSPBuffer1[i];
|
||||
if (DSPBuffer1[i]>32767)Buffer[i]=32767;
|
||||
if (DSPBuffer1[i]<-32767)Buffer[i]=-32767;
|
||||
}
|
||||
|
||||
if(!UsePrimaryBuffer)
|
||||
{
|
||||
if (DS_OK!=lpSoundBuffer->Lock(LastUsedPos,
|
||||
SPCSize*2, &lpvPtr1,
|
||||
&dwBytes1, &lpvPtr2,
|
||||
&dwBytes2, 0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DS_OK!=lpPrimaryBuffer->Lock(LastUsedPos,
|
||||
SPCSize*2, &lpvPtr1,
|
||||
&dwBytes1, &lpvPtr2,
|
||||
&dwBytes2, 0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Sound=(short *)lpvPtr1;
|
||||
|
||||
CopyMemory(lpvPtr1, &Buffer[0], dwBytes1);
|
||||
|
||||
if (NULL != lpvPtr2)
|
||||
{
|
||||
CopyMemory(lpvPtr2, &Buffer[0]+dwBytes1, dwBytes2);
|
||||
}
|
||||
ASM_BEGIN
|
||||
ASM_COMMAND3(mov edi,buffer_ptr)
|
||||
ASM_COMMAND3(mov ecx,SPCSize)
|
||||
ASM_COMMAND2(shr ecx,1)
|
||||
ASM_COMMAND2(xor eax,eax)
|
||||
ASM_COMMAND(_blank_top:)
|
||||
ASM_COMMAND2(mov [edi],eax)
|
||||
ASM_COMMAND2(add edi,4)
|
||||
ASM_COMMAND(dec ecx)
|
||||
ASM_COMMAND(jne _blank_top)
|
||||
ASM_END
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MMXSupport == 1)
|
||||
{
|
||||
ASM_BEGIN
|
||||
ASM_COMMAND3(mov esi,DSPBuffer1)
|
||||
ASM_COMMAND3(mov edi,buffer_ptr)
|
||||
ASM_COMMAND3(mov ecx,SPCSize)
|
||||
ASM_COMMAND2(shr ecx,2)
|
||||
ASM_COMMAND(_top_mmx:)
|
||||
ASM_COMMAND2(movq mm0,[esi])
|
||||
ASM_COMMAND2(packssdw mm0,[esi+8])
|
||||
ASM_COMMAND2(movq [edi],mm0)
|
||||
ASM_COMMAND2(add esi,16)
|
||||
ASM_COMMAND2(add edi,8)
|
||||
ASM_COMMAND(dec ecx)
|
||||
ASM_COMMAND(jne _top_mmx)
|
||||
ASM_COMMAND(emms)
|
||||
ASM_END
|
||||
}
|
||||
else
|
||||
{
|
||||
for(i=0;i<SPCSize;i++)
|
||||
{
|
||||
Buffer[i]=DSPBuffer1[i];
|
||||
if (DSPBuffer1[i]>32767)Buffer[i]=32767;
|
||||
if (DSPBuffer1[i]<-32767)Buffer[i]=-32767;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!UsePrimaryBuffer)
|
||||
{
|
||||
if (DS_OK != lpSoundBuffer->Unlock(lpvPtr1, dwBytes1, lpvPtr2, dwBytes2))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DS_OK != lpPrimaryBuffer->Unlock(lpvPtr1, dwBytes1, lpvPtr2, dwBytes2))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(!UsePrimaryBuffer)
|
||||
{
|
||||
if (DS_OK!=lpSoundBuffer->Lock(LastUsedPos,
|
||||
SPCSize*2, &lpvPtr1,
|
||||
&dwBytes1, &lpvPtr2,
|
||||
&dwBytes2, 0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DS_OK!=lpPrimaryBuffer->Lock(LastUsedPos,
|
||||
SPCSize*2, &lpvPtr1,
|
||||
&dwBytes1, &lpvPtr2,
|
||||
&dwBytes2, 0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LastUsedPos+=SPCSize*2;
|
||||
if (LastUsedPos==SoundBufferSize) LastUsedPos=0;
|
||||
DataNeeded-=(SPCSize*2);
|
||||
}
|
||||
Sound=(short *)lpvPtr1;
|
||||
|
||||
CopyMemory(lpvPtr1, &Buffer[0], dwBytes1);
|
||||
|
||||
if (NULL != lpvPtr2)
|
||||
{
|
||||
CopyMemory(lpvPtr2, &Buffer[0]+dwBytes1, dwBytes2);
|
||||
}
|
||||
|
||||
if(!UsePrimaryBuffer)
|
||||
{
|
||||
if (DS_OK != lpSoundBuffer->Unlock(lpvPtr1, dwBytes1, lpvPtr2, dwBytes2))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DS_OK != lpPrimaryBuffer->Unlock(lpvPtr1, dwBytes1, lpvPtr2, dwBytes2))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LastUsedPos+=SPCSize*2;
|
||||
if (LastUsedPos==SoundBufferSize) LastUsedPos=0;
|
||||
DataNeeded-=(SPCSize*2);
|
||||
}
|
||||
}
|
||||
|
||||
extern unsigned char curblank;
|
||||
@@ -2345,10 +2395,10 @@ extern void DrawWin256x224x16();
|
||||
extern void DrawWin256x224x32();
|
||||
extern void DrawWin320x240x16();
|
||||
|
||||
extern _int64 copymaskRB = 0x001FF800001FF800;
|
||||
extern _int64 copymaskG = 0x0000FC000000FC00;
|
||||
extern _int64 copymagic = 0x0008010000080100;
|
||||
extern _int64 coef = 0x0066009a0066009a;
|
||||
volatile __int64 copymaskRB = 0x001FF800001FF800LL;
|
||||
volatile __int64 copymaskG = 0x0000FC000000FC00LL;
|
||||
volatile __int64 copymagic = 0x0008010000080100LL;
|
||||
volatile __int64 coef = 0x0066009a0066009aLL;
|
||||
|
||||
//extern BYTE MotionBlur;
|
||||
extern WORD totlines;
|
||||
@@ -2561,12 +2611,7 @@ void drawscreenwin(void)
|
||||
AddEndBytes=pitch-1024;
|
||||
NumBytesPerLine=pitch;
|
||||
WinVidMemStart=&SurfBuf[0];
|
||||
_asm
|
||||
{
|
||||
pushad
|
||||
call copy640x480x16bwin
|
||||
popad
|
||||
}
|
||||
asm_call(copy640x480x16bwin);
|
||||
break;
|
||||
default:
|
||||
UnlockSurface();
|
||||
@@ -2587,12 +2632,7 @@ void drawscreenwin(void)
|
||||
AddEndBytes=pitch-1024;
|
||||
NumBytesPerLine=pitch;
|
||||
WinVidMemStart=&SurfBuf[(240-resolutn)*pitch+64*2];
|
||||
_asm
|
||||
{
|
||||
pushad
|
||||
call copy640x480x16bwin
|
||||
popad
|
||||
}
|
||||
asm_call(copy640x480x16bwin);
|
||||
break;
|
||||
default:
|
||||
UnlockSurface();
|
||||
@@ -2672,12 +2712,7 @@ void WinUpdateDevices()
|
||||
if (keys2[0x38] != 0 && keys2[0x3E] != 0) exit(0);
|
||||
if (keys2[0xB8] != 0 && keys2[0x1C] != 0 || keys2[0x38] != 0 && keys2[0x1C] != 0)
|
||||
{
|
||||
_asm
|
||||
{
|
||||
pushad
|
||||
call SwitchFullScreen
|
||||
popad
|
||||
}
|
||||
asm_call(SwitchFullScreen);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user