You can subscribe to this list here.
2004 |
Jan
(17) |
Feb
(38) |
Mar
(24) |
Apr
(18) |
May
(75) |
Jun
(2) |
Jul
|
Aug
|
Sep
(21) |
Oct
(3) |
Nov
(19) |
Dec
(5) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(15) |
Jul
(2) |
Aug
|
Sep
(5) |
Oct
|
Nov
|
Dec
|
2006 |
Jan
(8) |
Feb
|
Mar
|
Apr
(6) |
May
(73) |
Jun
(57) |
Jul
(12) |
Aug
(68) |
Sep
(6) |
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
1
|
2
|
3
|
4
|
5
|
6
(14) |
7
(2) |
8
(19) |
9
|
10
|
11
|
12
(7) |
13
|
14
|
15
|
16
(1) |
17
|
18
|
19
|
20
(2) |
21
(3) |
22
|
23
|
24
(6) |
25
|
26
|
27
|
28
|
29
(3) |
30
|
|
From: Spacy <sp...@us...> - 2006-06-06 22:32:24
|
Update of /cvsroot/vba/VisualBoyAdvance/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv4893/src Modified Files: remote.cpp Log Message: Index: remote.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/remote.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** remote.cpp 6 Jun 2006 21:04:20 -0000 1.9 --- remote.cpp 6 Jun 2006 22:32:19 -0000 1.10 *************** *** 238,242 **** *p++ = '$'; ! for(int i = 0 ;i < count; i++) { csum += packet[i]; *p++ = packet[i]; --- 238,242 ---- *p++ = '$'; ! for(size_t i = 0 ;i < count; i++) { csum += packet[i]; *p++ = packet[i]; |
From: Spacy <sp...@us...> - 2006-06-06 22:32:23
|
Update of /cvsroot/vba/VisualBoyAdvance/src/win32 In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv4893/src/win32 Modified Files: display.cpp Log Message: Index: display.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/display.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** display.cpp 6 Jun 2006 21:27:01 -0000 1.1 --- display.cpp 6 Jun 2006 22:32:19 -0000 1.2 *************** *** 82,85 **** --- 82,95 ---- { case 16: + register unsigned int lineSize = width<<1; + register unsigned char *src = ((unsigned char*)source) + lineSize + 4; + register unsigned char *dst = (unsigned char*)destination; + do { + MoveMemory( dst, src, lineSize ); + src+=lineSize; + dst+=lineSize; + src += 2; + dst += (destinationPitch - lineSize); + } while ( --height); break; case 32: |
From: Spacy <sp...@us...> - 2006-06-06 22:10:59
|
Update of /cvsroot/vba/VisualBoyAdvance/win32/dependencies/sdl/Debug In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv27678/win32/dependencies/sdl/Debug Removed Files: SDL.dll SDL.lib SDLmain.lib Log Message: moved --- SDL.lib DELETED --- --- SDLmain.lib DELETED --- --- SDL.dll DELETED --- |
From: Spacy <sp...@us...> - 2006-06-06 22:10:03
|
Update of /cvsroot/vba/VisualBoyAdvance/win32/dependencies/sdl/Release In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv27185/win32/dependencies/sdl/Release Removed Files: SDL.dll SDL.lib SDLmain.lib Log Message: moved --- SDL.lib DELETED --- --- SDLmain.lib DELETED --- --- SDL.dll DELETED --- |
From: Spacy <sp...@us...> - 2006-06-06 21:27:14
|
Update of /cvsroot/vba/VisualBoyAdvance/src/win32 In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv8123/src/win32 Added Files: display.cpp Log Message: copyImage: shared between Direct3D & DIrectDraw --- NEW FILE: display.cpp --- // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // Copyright (C) 1999-2003 Forgotten // Copyright (C) 2004 Forgotten and the VBA development 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, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" #include "Display.h" void copyImage( void *source, void *destination, unsigned int width, unsigned int height, unsigned int destinationPitch, unsigned int colorDepth ) { #ifdef ASM // Copy the image at [source] to the locked Direct3D texture __asm { mov eax, width ; Initialize mov ebx, height ; mov edi, destination ; mov edx, destinationPitch ; cmp colorDepth, 16 ; Check colorDepth==16bit jnz gbaOtherColor ; sub edx, eax ; sub edx, eax ; mov esi, source ; lea esi,[esi+2*eax+4] ; shr eax, 1 ; gbaLoop16bit: mov ecx, eax ; rep movsd ; add esi, 4 ; add edi, edx ; dec ebx ; jnz gbaLoop16bit ; jmp gbaLoopEnd ; gbaOtherColor: cmp colorDepth, 32 ; Check colorDepth==32bit jnz gbaOtherColor2 ; lea esi, [eax*4] ; sub edx, esi ; mov esi, source ; lea esi, [esi+4*eax+4] ; gbaLoop32bit: mov ecx, eax ; rep movsd ; ECX times: Move DWORD at [ESI] to [EDI] | ESI++ EDI++ add esi, 4 ; add edi, edx ; dec ebx ; jnz gbaLoop32bit ; jmp gbaLoopEnd ; gbaOtherColor2: lea eax, [eax+2*eax] ; Works like colorDepth==24bit sub edx, eax ; gbaLoop24bit: mov ecx, eax ; shr ecx, 2 ; rep movsd ; add edi, edx ; dec ebx ; jnz gbaLoop24bit ; gbaLoopEnd: } #else // #ifdef ASM // optimized C version switch(colorDepth) { case 16: break; case 32: register unsigned int lineSize = width<<2; register unsigned char *src = ((unsigned char*)source) + lineSize + 4; register unsigned char *dst = (unsigned char*)destination; do { MoveMemory( dst, src, lineSize ); src+=lineSize; dst+=lineSize; src += 4; dst += (destinationPitch - lineSize); } while ( --height); break; } // very compatible C version //unsigned int nBytesPerPixel = colorDepth>>3; //unsigned int i, x, y, srcPitch = (width+1) * nBytesPerPixel; //unsigned char * src = ((unsigned char*)source)+srcPitch; //unsigned char * dst = (unsigned char*)destination; //for (y=0;y<height;y++) //Width //for (x=0;x<width;x++) //Height //for (i=0;i<nBytesPerPixel;i++) //Byte# Of Pixel //*(dst+i+(x*nBytesPerPixel)+(y*destinationPitch)) = *(src+i+(x*nBytesPerPixel)+(y*srcPitch)); #endif // #ifdef ASM } |
Update of /cvsroot/vba/VisualBoyAdvance/src/win32 In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv29806/src/win32 Modified Files: AcceleratorManager.cpp Direct3D.cpp DirectDraw.cpp DirectInput.cpp Display.h GBCheatsDlg.cpp GBCheatsDlg.h GBMapView.cpp Input.h Joypad.cpp Joypad.h Logging.cpp MainWndFile.cpp MainWndOptions.cpp MainWndTools.cpp MapView.cpp ModeConfirm.cpp ModeConfirm.h ResizeDlg.cpp TileView.cpp VBA.h VideoMode.cpp skin.cpp vba.rc Log Message: make compilable for Windows x64 Index: Display.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/Display.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Display.h 13 May 2004 15:06:49 -0000 1.2 --- Display.h 6 Jun 2006 21:04:21 -0000 1.3 *************** *** 18,21 **** --- 18,23 ---- // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + #pragma once + enum DISPLAY_TYPE { GDI = 0, *************** *** 43,44 **** --- 45,48 ---- virtual int selectFullScreenMode(GUID **) = 0; }; + + void copyImage( void *source, void *destination, unsigned int width, unsigned int height, unsigned int destinationPitch, unsigned int colorDepth ); Index: Input.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/Input.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Input.h 13 May 2004 15:06:50 -0000 1.2 --- Input.h 6 Jun 2006 21:04:21 -0000 1.3 *************** *** 44,48 **** virtual bool readDevices() = 0; virtual u32 readDevice(int which) = 0; ! virtual CString getKeyName(int key) = 0; virtual void checkKeys() = 0; virtual void checkMotionKeys() = 0; --- 44,48 ---- virtual bool readDevices() = 0; virtual u32 readDevice(int which) = 0; ! virtual CString getKeyName(LONG_PTR key) = 0; virtual void checkKeys() = 0; virtual void checkMotionKeys() = 0; Index: MainWndTools.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/MainWndTools.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MainWndTools.cpp 13 May 2004 15:06:50 -0000 1.3 --- MainWndTools.cpp 6 Jun 2006 21:04:21 -0000 1.4 *************** *** 52,56 **** extern bool debugger; extern int emulating; ! extern int remoteSocket; extern void remoteCleanUp(); --- 52,56 ---- extern bool debugger; extern int emulating; ! extern SOCKET remoteSocket; extern void remoteCleanUp(); Index: Joypad.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/Joypad.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Joypad.h 27 May 2006 14:47:33 -0000 1.3 --- Joypad.h 6 Jun 2006 21:04:21 -0000 1.4 *************** *** 61,65 **** public: void assignKeys(); ! void assignKey(int id, int key); JoypadConfig(int w, CWnd* pParent = NULL); // standard constructor --- 61,65 ---- public: void assignKeys(); ! void assignKey(int id, LONG_PTR key); JoypadConfig(int w, CWnd* pParent = NULL); // standard constructor *************** *** 100,104 **** afx_msg void OnOk(); afx_msg void OnDestroy(); ! afx_msg void OnTimer(UINT nIDEvent); afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); virtual BOOL OnInitDialog(); --- 100,104 ---- afx_msg void OnOk(); afx_msg void OnDestroy(); ! afx_msg void OnTimer(UINT_PTR nIDEvent); afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); virtual BOOL OnInitDialog(); *************** *** 114,118 **** public: void assignKeys(); ! void assignKey(int id, int key); MotionConfig(CWnd* pParent = NULL); // standard constructor --- 114,118 ---- public: void assignKeys(); ! void assignKey(int id, LONG_PTR key); MotionConfig(CWnd* pParent = NULL); // standard constructor *************** *** 143,147 **** virtual BOOL OnInitDialog(); afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); ! afx_msg void OnTimer(UINT nIDEvent); DECLARE_MESSAGE_MAP() private: --- 143,147 ---- virtual BOOL OnInitDialog(); afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); ! afx_msg void OnTimer(UINT_PTR nIDEvent); DECLARE_MESSAGE_MAP() private: Index: Direct3D.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/Direct3D.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Direct3D.cpp 13 May 2006 16:32:16 -0000 1.8 --- Direct3D.cpp 6 Jun 2006 21:04:21 -0000 1.9 *************** *** 36,39 **** --- 36,41 ---- #include "resource.h" + #include "Display.h" + #ifdef _DEBUG #define new DEBUG_NEW *************** *** 502,506 **** if(!pDevice) return; ! // Test the cooperative level to see if it's okay to render if( FAILED( pDevice->TestCooperativeLevel() ) ) --- 504,508 ---- if(!pDevice) return; ! // Test the cooperative level to see if it's okay to render if( FAILED( pDevice->TestCooperativeLevel() ) ) *************** *** 542,600 **** copyY = 144; } ! } ! // MMX doesn't seem to be faster to copy the data ! __asm { ! mov eax, copyX; ! mov ebx, copyY; ! ! mov esi, pix; ! mov edi, locked.pBits; ! mov edx, locked.Pitch; ! cmp systemColorDepth, 16; ! jnz gbaOtherColor; ! sub edx, eax; ! sub edx, eax; ! lea esi,[esi+2*eax+4]; ! shr eax, 1; ! gbaLoop16bit: ! mov ecx, eax; ! repz movsd; ! inc esi; ! inc esi; ! inc esi; ! inc esi; ! add edi, edx; ! dec ebx; ! jnz gbaLoop16bit; ! jmp gbaLoopEnd; ! gbaOtherColor: ! cmp systemColorDepth, 32; ! jnz gbaOtherColor2; ! ! sub edx, eax; ! sub edx, eax; ! sub edx, eax; ! sub edx, eax; ! lea esi, [esi+4*eax+4]; ! gbaLoop32bit: ! mov ecx, eax; ! repz movsd; ! add esi, 4; ! add edi, edx; ! dec ebx; ! jnz gbaLoop32bit; ! jmp gbaLoopEnd; ! gbaOtherColor2: ! lea eax, [eax+2*eax]; ! sub edx, eax; ! gbaLoop24bit: ! mov ecx, eax; ! shr ecx, 2; ! repz movsd; ! add edi, edx; ! dec ebx; ! jnz gbaLoop24bit; ! gbaLoopEnd: ! } } --- 544,549 ---- copyY = 144; } ! } ! copyImage( pix, locked.pBits, theApp.sizeX, theApp.sizeY, locked.Pitch, systemColorDepth ); } *************** *** 713,715 **** return new Direct3DDisplay(); } - --- 662,663 ---- Index: GBCheatsDlg.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/GBCheatsDlg.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GBCheatsDlg.cpp 13 May 2004 15:06:49 -0000 1.4 --- GBCheatsDlg.cpp 6 Jun 2006 21:04:21 -0000 1.5 *************** *** 638,642 **** m_desc.GetWindowText(buffer); ! int bank = (address >> 16); address &= 0xFFFF; --- 638,642 ---- m_desc.GetWindowText(buffer); ! LONG_PTR bank = (address >> 16); address &= 0xFFFF; *************** *** 690,696 **** m_address.SetWindowText(buffer); m_address.EnableWindow(FALSE); ! ::SetWindowLong(m_address, ! GWL_USERDATA, ! address); numberType = regQueryDwordValue("gbCheatsNumberType", 2); --- 690,694 ---- m_address.SetWindowText(buffer); m_address.EnableWindow(FALSE); ! ::SetWindowLongPtr( m_address.GetSafeHwnd(), GWLP_USERDATA, address); numberType = regQueryDwordValue("gbCheatsNumberType", 2); *************** *** 827,833 **** if(m_list.GetItem(&item)) { if(gbCheatList[item.lParam].enabled) ! gbCheatDisable(item.lParam); else ! gbCheatEnable(item.lParam); refresh(); } --- 825,831 ---- if(m_list.GetItem(&item)) { if(gbCheatList[item.lParam].enabled) ! gbCheatDisable((int)item.lParam); else ! gbCheatEnable((int)item.lParam); refresh(); } *************** *** 845,849 **** item.iItem = mark; if(m_list.GetItem(&item)) { ! gbCheatRemove(item.lParam); refresh(); } --- 843,847 ---- item.iItem = mark; if(m_list.GetItem(&item)) { ! gbCheatRemove((int)item.lParam); refresh(); } *************** *** 873,879 **** (((l->uNewState & LVIS_STATEIMAGEMASK)>>12))) { if(m_list.GetCheck(l->iItem)) ! gbCheatEnable(l->lParam); else ! gbCheatDisable(l->lParam); refresh(); } --- 871,877 ---- (((l->uNewState & LVIS_STATEIMAGEMASK)>>12))) { if(m_list.GetCheck(l->iItem)) ! gbCheatEnable((int)l->lParam); else ! gbCheatDisable((int)l->lParam); refresh(); } Index: GBCheatsDlg.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/GBCheatsDlg.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GBCheatsDlg.h 13 May 2004 15:06:49 -0000 1.3 --- GBCheatsDlg.h 6 Jun 2006 21:04:21 -0000 1.4 *************** *** 122,126 **** // Implementation protected: ! u32 address; // Generated message map functions --- 122,126 ---- // Implementation protected: ! LONG_PTR address; // Generated message map functions Index: Logging.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/Logging.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Logging.cpp 5 Jan 2006 14:55:31 -0000 1.6 --- Logging.cpp 6 Jun 2006 21:04:21 -0000 1.7 *************** *** 238,242 **** void Logging::log(const char *s) { ! int size = ::SendMessage(m_log, WM_GETTEXTLENGTH, 0, 0); m_log.SetSel(size, size); m_log.ReplaceSel(s); --- 238,242 ---- void Logging::log(const char *s) { ! DWORD size = (DWORD)::SendMessage(m_log, WM_GETTEXTLENGTH, 0, 0); m_log.SetSel(size, size); m_log.ReplaceSel(s); Index: AcceleratorManager.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/AcceleratorManager.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AcceleratorManager.cpp 4 Nov 2003 14:09:51 -0000 1.6 --- AcceleratorManager.cpp 6 Jun 2006 21:04:20 -0000 1.7 *************** *** 248,252 **** } ! int nAccel = arrayACCEL.GetSize(); LPACCEL lpAccel = (LPACCEL)LocalAlloc(LPTR, nAccel * sizeof(ACCEL)); if (!lpAccel) { --- 248,252 ---- } ! INT_PTR nAccel = arrayACCEL.GetSize(); LPACCEL lpAccel = (LPACCEL)LocalAlloc(LPTR, nAccel * sizeof(ACCEL)); if (!lpAccel) { *************** *** 269,273 **** arrayACCEL.RemoveAll(); ! HACCEL hNewTable = CreateAcceleratorTable(lpAccel, nAccel); if (!hNewTable) { ::LocalFree(lpAccel); --- 269,273 ---- arrayACCEL.RemoveAll(); ! HACCEL hNewTable = CreateAcceleratorTable(lpAccel, (int)nAccel); if (!hNewTable) { ::LocalFree(lpAccel); *************** *** 710,714 **** // AccelsDatasArray.InsertAt(0, MAKELONG(65535, iCount)); ! int count = AccelsDatasArray.GetSize(); DWORD *data = (DWORD *)malloc(count * sizeof(DWORD)); ASSERT(data != NULL); --- 710,714 ---- // AccelsDatasArray.InsertAt(0, MAKELONG(65535, iCount)); ! INT_PTR count = AccelsDatasArray.GetSize(); DWORD *data = (DWORD *)malloc(count * sizeof(DWORD)); ASSERT(data != NULL); *************** *** 717,721 **** data[index] = AccelsDatasArray[index]; ! regSetBinaryValue("keyboard", (char *)data, count*sizeof(DWORD)); AccelsDatasArray.RemoveAll(); --- 717,721 ---- data[index] = AccelsDatasArray[index]; ! regSetBinaryValue("keyboard", (char *)data, (int)(count*sizeof(DWORD))); AccelsDatasArray.RemoveAll(); Index: ModeConfirm.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/ModeConfirm.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ModeConfirm.h 27 May 2006 14:47:33 -0000 1.3 --- ModeConfirm.h 6 Jun 2006 21:04:21 -0000 1.4 *************** *** 61,65 **** afx_msg void OnDestroy(); virtual BOOL OnInitDialog(); ! afx_msg void OnTimer(UINT nIDEvent); //}}AFX_MSG DECLARE_MESSAGE_MAP() --- 61,65 ---- afx_msg void OnDestroy(); virtual BOOL OnInitDialog(); ! afx_msg void OnTimer(UINT_PTR nIDEvent); //}}AFX_MSG DECLARE_MESSAGE_MAP() Index: GBMapView.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/GBMapView.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GBMapView.cpp 27 May 2006 14:47:33 -0000 1.7 --- GBMapView.cpp 6 Jun 2006 21:04:21 -0000 1.8 *************** *** 501,505 **** int x = (int)(wParam & 0xffff); ! int y = wParam >> 16; CString buffer; --- 501,505 ---- int x = (int)(wParam & 0xffff); ! int y = (int)(wParam >> 16); CString buffer; Index: MapView.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/MapView.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** MapView.cpp 3 Sep 2005 12:29:23 -0000 1.9 --- MapView.cpp 6 Jun 2006 21:04:21 -0000 1.10 *************** *** 787,792 **** mapViewZoom.setColors(colors); ! int x = wParam & 0xffff; ! int y = (wParam >> 16); CString buffer; --- 787,792 ---- mapViewZoom.setColors(colors); ! int x = (int)(wParam & 0xffff); ! int y = (int)(wParam >> 16); CString buffer; Index: ModeConfirm.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/ModeConfirm.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ModeConfirm.cpp 13 May 2004 15:06:55 -0000 1.2 --- ModeConfirm.cpp 6 Jun 2006 21:04:21 -0000 1.3 *************** *** 101,105 **** } ! void ModeConfirm::OnTimer(UINT nIDEvent) { CString buffer; --- 101,105 ---- } ! void ModeConfirm::OnTimer(UINT_PTR nIDEvent) { CString buffer; Index: TileView.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/TileView.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TileView.cpp 3 Sep 2005 12:29:23 -0000 1.3 --- TileView.cpp 6 Jun 2006 21:04:21 -0000 1.4 *************** *** 530,535 **** zoom.setColors(colors); ! int x = (wParam & 0xFFFF)/8; ! int y = ((wParam >> 16) & 0xFFFF)/8; u32 address = 0x6000000 + 0x4000 * charBase; --- 530,535 ---- zoom.setColors(colors); ! int x = (int)((wParam & 0xFFFF) / 8); ! int y = (int)(((wParam >> 16) & 0xFFFF) / 8); u32 address = 0x6000000 + 0x4000 * charBase; Index: vba.rc =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/vba.rc,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** vba.rc 27 May 2006 14:47:33 -0000 1.55 --- vba.rc 6 Jun 2006 21:04:21 -0000 1.56 *************** *** 13,18 **** #undef APSTUDIO_READONLY_SYMBOLS - ///////////////////////////////////////////////////////////////////////////// - // English (U.S.) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) --- 13,16 ---- *************** *** 77,81 **** FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN ! ICON 101,IDC_STATIC,6,6,20,20 CTEXT "VisualBoyAdvance Emulator",IDC_STATIC,30,6,120,8 CTEXT "Copyright © 2006 VBA development team",IDC_STATIC,6,36,144,8 --- 75,79 ---- FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN ! ICON IDI_ICON,IDC_STATIC,6,6,20,20 CTEXT "VisualBoyAdvance Emulator",IDC_STATIC,30,6,120,8 CTEXT "Copyright © 2006 VBA development team",IDC_STATIC,6,36,144,8 *************** *** 1826,1836 **** ///////////////////////////////////////////////////////////////////////////// // - // RT_MANIFEST - // - - 1 RT_MANIFEST "VisualBoyAdvance.exe.manifest" - - ///////////////////////////////////////////////////////////////////////////// - // // String Table // --- 1824,1827 ---- Index: DirectDraw.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/DirectDraw.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DirectDraw.cpp 13 May 2006 16:32:16 -0000 1.8 --- DirectDraw.cpp 6 Jun 2006 21:04:21 -0000 1.9 *************** *** 34,37 **** --- 34,39 ---- #include "resource.h" + #include "Display.h" + #ifdef _DEBUG #define new DEBUG_NEW *************** *** 632,635 **** --- 634,638 ---- { HRESULT hret; + unsigned int nBytesPerPixel = systemColorDepth>>3; if(pDirectDraw == NULL || *************** *** 704,761 **** } } ! // MMX doesn't seem to be faster to copy the data ! __asm { ! mov eax, copyX; ! mov ebx, copyY; ! ! mov esi, pix; ! mov edi, ddsDesc.lpSurface; ! mov edx, ddsDesc.lPitch; ! cmp systemColorDepth, 16; ! jnz gbaOtherColor; ! sub edx, eax; ! sub edx, eax; ! lea esi,[esi+2*eax+4]; ! shr eax, 1; ! gbaLoop16bit: ! mov ecx, eax; ! repz movsd; ! inc esi; ! inc esi; ! inc esi; ! inc esi; ! add edi, edx; ! dec ebx; ! jnz gbaLoop16bit; ! jmp gbaLoopEnd; ! gbaOtherColor: ! cmp systemColorDepth, 32; ! jnz gbaOtherColor2; ! ! sub edx, eax; ! sub edx, eax; ! sub edx, eax; ! sub edx, eax; ! lea esi, [esi+4*eax+4]; ! gbaLoop32bit: ! mov ecx, eax; ! repz movsd; ! add esi, 4; ! add edi, edx; ! dec ebx; ! jnz gbaLoop32bit; ! jmp gbaLoopEnd; ! gbaOtherColor2: ! lea eax, [eax+2*eax]; ! sub edx, eax; ! gbaLoop24bit: ! mov ecx, eax; ! shr ecx, 2; ! repz movsd; ! add edi, edx; ! dec ebx; ! jnz gbaLoop24bit; ! gbaLoopEnd: ! } } if(theApp.showSpeed && (theApp.videoOption > VIDEO_4X || theApp.skin != NULL)) { --- 707,711 ---- } } ! copyImage( pix, ddsDesc.lpSurface, copyX, copyY, ddsDesc.lPitch, systemColorDepth ); } if(theApp.showSpeed && (theApp.videoOption > VIDEO_4X || theApp.skin != NULL)) { *************** *** 829,833 **** SetBkMode(hdc,TRANSPARENT); TextOut(hdc, theApp.dest.left+10, theApp.dest.bottom - 20, theApp.screenMessageBuffer, ! strlen(theApp.screenMessageBuffer)); ddsPrimary->ReleaseDC(hdc); } else { --- 779,783 ---- SetBkMode(hdc,TRANSPARENT); TextOut(hdc, theApp.dest.left+10, theApp.dest.bottom - 20, theApp.screenMessageBuffer, ! (int)_tcslen(theApp.screenMessageBuffer)); ddsPrimary->ReleaseDC(hdc); } else { Index: VideoMode.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/VideoMode.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** VideoMode.cpp 13 May 2006 16:32:16 -0000 1.6 --- VideoMode.cpp 6 Jun 2006 21:04:21 -0000 1.7 *************** *** 111,115 **** sprintf(buffer, "%4dx%4dx%2d", surf->dwWidth, surf->dwHeight, surf->ddpfPixelFormat.dwRGBBitCount); ! int pos = ::SendMessage(h, LB_ADDSTRING, 0, (LPARAM)buffer); ::SendMessage(h, LB_SETITEMDATA, pos, (surf->ddpfPixelFormat.dwRGBBitCount << 24) | --- 111,115 ---- sprintf(buffer, "%4dx%4dx%2d", surf->dwWidth, surf->dwHeight, surf->ddpfPixelFormat.dwRGBBitCount); ! WPARAM pos = ::SendMessage(h, LB_ADDSTRING, 0, (LPARAM)buffer); ::SendMessage(h, LB_SETITEMDATA, pos, (surf->ddpfPixelFormat.dwRGBBitCount << 24) | *************** *** 185,189 **** VideoDriverSelect d(pWnd); ! selected = d.DoModal(); if(selected == -1) { --- 185,189 ---- VideoDriverSelect d(pWnd); ! INT_PTR selected = d.DoModal(); if(selected == -1) { *************** *** 230,234 **** VideoMode dlg(ddraw, pWnd); ! int res = dlg.DoModal(); if(res != -1) { --- 230,234 ---- VideoMode dlg(ddraw, pWnd); ! INT_PTR res = dlg.DoModal(); if(res != -1) { *************** *** 246,250 **** #endif ! return res; } --- 246,250 ---- #endif ! return (int)res; } *************** *** 297,306 **** void VideoMode::OnOk() { ! int cur = m_modes.GetCurSel(); if(cur != -1) { ! cur = m_modes.GetItemData(cur); } ! EndDialog(cur); } --- 297,306 ---- void VideoMode::OnOk() { ! DWORD_PTR cur = m_modes.GetCurSel(); if(cur != -1) { ! cur = m_modes.GetItemData((int)cur); } ! EndDialog((int)cur); } Index: ResizeDlg.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/ResizeDlg.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ResizeDlg.cpp 4 Nov 2003 14:09:52 -0000 1.3 --- ResizeDlg.cpp 6 Jun 2006 21:04:21 -0000 1.4 *************** *** 90,94 **** if(res == IDRETRY) { ! __asm int 3; } else if(res == IDABORT) SendMessage(*theApp.m_pMainWnd, WM_QUIT, 0, 0); --- 90,94 ---- if(res == IDRETRY) { ! DebugBreak(); } else if(res == IDABORT) SendMessage(*theApp.m_pMainWnd, WM_QUIT, 0, 0); *************** *** 144,148 **** ::SendMessage(*theApp.m_pMainWnd, WM_QUIT, 0, 0); } else if(nCode == IDRETRY) ! __asm int 3; } --- 144,148 ---- ::SendMessage(*theApp.m_pMainWnd, WM_QUIT, 0, 0); } else if(nCode == IDRETRY) ! DebugBreak(); } Index: MainWndFile.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/MainWndFile.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** MainWndFile.cpp 6 Jun 2006 14:33:43 -0000 1.15 --- MainWndFile.cpp 6 Jun 2006 21:04:21 -0000 1.16 *************** *** 707,711 **** if(game != -1) { ! return cheatsImportGSACodeFile(fileName, game, v3); } --- 707,711 ---- if(game != -1) { ! return cheatsImportGSACodeFile(fileName, (int)game, v3); } Index: Joypad.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/Joypad.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Joypad.cpp 6 Jun 2006 14:33:43 -0000 1.7 --- Joypad.cpp 6 Jun 2006 21:04:21 -0000 1.8 *************** *** 31,36 **** #endif ! extern USHORT joypad[4][13]; ! extern USHORT motion[4]; ///////////////////////////////////////////////////////////////////////////// --- 31,36 ---- #endif ! extern LONG_PTR joypad[4][13]; ! extern LONG_PTR motion[4]; ///////////////////////////////////////////////////////////////////////////// *************** *** 55,63 **** LRESULT JoypadEditControl::OnJoyConfig(WPARAM wParam, LPARAM lParam) { ! #ifdef _WIN64 ! SetWindowLongPtr( GetSafeHwnd(), GWL_USERDATA, ((wParam<<8)|lParam) ); ! #else ! SetWindowLongPtr( GetSafeHwnd(), GWL_USERDATA, PtrToLong((wParam<<8)|lParam) ); ! #endif this->SetWindowText( theApp.input->getKeyName( (int)((wParam<<8)|lParam) ) ); GetParent()->GetNextDlgTabItem(this, FALSE)->SetFocus(); --- 55,59 ---- LRESULT JoypadEditControl::OnJoyConfig(WPARAM wParam, LPARAM lParam) { ! SetWindowLongPtr( this->GetSafeHwnd(), GWLP_USERDATA, (wParam<<8) | lParam ); this->SetWindowText( theApp.input->getKeyName( (int)((wParam<<8)|lParam) ) ); GetParent()->GetNextDlgTabItem(this, FALSE)->SetFocus(); *************** *** 140,144 **** } ! void JoypadConfig::OnTimer(UINT nIDEvent) { theApp.input->checkDevices(); --- 136,140 ---- } ! void JoypadConfig::OnTimer(UINT_PTR nIDEvent) { theApp.input->checkDevices(); *************** *** 157,197 **** timerId = SetTimer(0,50,NULL); ! SetWindowLongPtr(up, GWL_USERDATA,joypad[which][KEY_UP]); up.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_UP])); ! SetWindowLongPtr(down, GWL_USERDATA,joypad[which][KEY_DOWN]); down.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_DOWN])); ! SetWindowLongPtr(left, GWL_USERDATA,joypad[which][KEY_LEFT]); left.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_LEFT])); ! SetWindowLongPtr(right, GWL_USERDATA,joypad[which][KEY_RIGHT]); right.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_RIGHT])); ! SetWindowLongPtr(buttonA, GWL_USERDATA,joypad[which][KEY_BUTTON_A]); buttonA.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_A])); ! SetWindowLongPtr(buttonB, GWL_USERDATA,joypad[which][KEY_BUTTON_B]); buttonB.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_B])); ! SetWindowLongPtr(buttonL, GWL_USERDATA,joypad[which][KEY_BUTTON_L]); buttonL.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_L])); ! SetWindowLongPtr(buttonR, GWL_USERDATA,joypad[which][KEY_BUTTON_R]); buttonR.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_R])); ! SetWindowLongPtr(buttonSelect, GWL_USERDATA,joypad[which][KEY_BUTTON_SELECT]); buttonSelect.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_SELECT])); ! SetWindowLongPtr(buttonStart, GWL_USERDATA,joypad[which][KEY_BUTTON_START]); buttonStart.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_START])); ! SetWindowLongPtr(speed, GWL_USERDATA,joypad[which][KEY_BUTTON_SPEED]); speed.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_SPEED])); ! SetWindowLongPtr(capture, GWL_USERDATA,joypad[which][KEY_BUTTON_CAPTURE]); capture.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_CAPTURE])); ! SetWindowLongPtr(buttonGS, GWL_USERDATA,joypad[which][KEY_BUTTON_GS]); buttonGS.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_GS])); --- 153,193 ---- timerId = SetTimer(0,50,NULL); ! SetWindowLongPtr(up, GWLP_USERDATA,joypad[which][KEY_UP]); up.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_UP])); ! SetWindowLongPtr(down, GWLP_USERDATA,joypad[which][KEY_DOWN]); down.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_DOWN])); ! SetWindowLongPtr(left, GWLP_USERDATA,joypad[which][KEY_LEFT]); left.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_LEFT])); ! SetWindowLongPtr(right, GWLP_USERDATA,joypad[which][KEY_RIGHT]); right.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_RIGHT])); ! SetWindowLongPtr(buttonA, GWLP_USERDATA,joypad[which][KEY_BUTTON_A]); buttonA.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_A])); ! SetWindowLongPtr(buttonB, GWLP_USERDATA,joypad[which][KEY_BUTTON_B]); buttonB.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_B])); ! SetWindowLongPtr(buttonL, GWLP_USERDATA,joypad[which][KEY_BUTTON_L]); buttonL.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_L])); ! SetWindowLongPtr(buttonR, GWLP_USERDATA,joypad[which][KEY_BUTTON_R]); buttonR.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_R])); ! SetWindowLongPtr(buttonSelect, GWLP_USERDATA,joypad[which][KEY_BUTTON_SELECT]); buttonSelect.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_SELECT])); ! SetWindowLongPtr(buttonStart, GWLP_USERDATA,joypad[which][KEY_BUTTON_START]); buttonStart.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_START])); ! SetWindowLongPtr(speed, GWLP_USERDATA,joypad[which][KEY_BUTTON_SPEED]); speed.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_SPEED])); ! SetWindowLongPtr(capture, GWLP_USERDATA,joypad[which][KEY_BUTTON_CAPTURE]); capture.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_CAPTURE])); ! SetWindowLongPtr(buttonGS, GWLP_USERDATA,joypad[which][KEY_BUTTON_GS]); buttonGS.SetWindowText(theApp.input->getKeyName(joypad[which][KEY_BUTTON_GS])); *************** *** 202,206 **** } ! void JoypadConfig::assignKey(int id, int key) { switch(id) { --- 198,202 ---- } ! void JoypadConfig::assignKey(int id, LONG_PTR key) { switch(id) { *************** *** 252,292 **** id = IDC_EDIT_UP; ! assignKey(id, GetWindowLongPtr(up, GWL_USERDATA)); id = IDC_EDIT_DOWN; ! assignKey(id, GetWindowLongPtr(down, GWL_USERDATA)); id = IDC_EDIT_LEFT; ! assignKey(id, GetWindowLongPtr(left, GWL_USERDATA)); id = IDC_EDIT_RIGHT; ! assignKey(id, GetWindowLongPtr(right, GWL_USERDATA)); id = IDC_EDIT_BUTTON_A; ! assignKey(id, GetWindowLongPtr(buttonA, GWL_USERDATA)); id = IDC_EDIT_BUTTON_B; ! assignKey(id, GetWindowLongPtr(buttonB, GWL_USERDATA)); id = IDC_EDIT_BUTTON_L; ! assignKey(id, GetWindowLongPtr(buttonL, GWL_USERDATA)); id = IDC_EDIT_BUTTON_R; ! assignKey(id, GetWindowLongPtr(buttonR, GWL_USERDATA)); id = IDC_EDIT_BUTTON_SELECT; ! assignKey(id, GetWindowLongPtr(buttonSelect, GWL_USERDATA)); id = IDC_EDIT_BUTTON_START; ! assignKey(id, GetWindowLongPtr(buttonStart, GWL_USERDATA)); id = IDC_EDIT_SPEED; ! assignKey(id, GetWindowLongPtr(speed, GWL_USERDATA)); id = IDC_EDIT_CAPTURE; ! assignKey(id, GetWindowLongPtr(capture, GWL_USERDATA)); id = IDC_EDIT_BUTTON_GS; ! assignKey(id, GetWindowLongPtr(buttonGS, GWL_USERDATA)); // winSaveKeys(); --- 248,288 ---- id = IDC_EDIT_UP; ! assignKey(id, GetWindowLongPtr(up, GWLP_USERDATA)); id = IDC_EDIT_DOWN; ! assignKey(id, GetWindowLongPtr(down, GWLP_USERDATA)); id = IDC_EDIT_LEFT; ! assignKey(id, GetWindowLongPtr(left, GWLP_USERDATA)); id = IDC_EDIT_RIGHT; ! assignKey(id, GetWindowLongPtr(right, GWLP_USERDATA)); id = IDC_EDIT_BUTTON_A; ! assignKey(id, GetWindowLongPtr(buttonA, GWLP_USERDATA)); id = IDC_EDIT_BUTTON_B; ! assignKey(id, GetWindowLongPtr(buttonB, GWLP_USERDATA)); id = IDC_EDIT_BUTTON_L; ! assignKey(id, GetWindowLongPtr(buttonL, GWLP_USERDATA)); id = IDC_EDIT_BUTTON_R; ! assignKey(id, GetWindowLongPtr(buttonR, GWLP_USERDATA)); id = IDC_EDIT_BUTTON_SELECT; ! assignKey(id, GetWindowLongPtr(buttonSelect, GWLP_USERDATA)); id = IDC_EDIT_BUTTON_START; ! assignKey(id, GetWindowLongPtr(buttonStart, GWLP_USERDATA)); id = IDC_EDIT_SPEED; ! assignKey(id, GetWindowLongPtr(speed, GWLP_USERDATA)); id = IDC_EDIT_CAPTURE; ! assignKey(id, GetWindowLongPtr(capture, GWLP_USERDATA)); id = IDC_EDIT_BUTTON_GS; ! assignKey(id, GetWindowLongPtr(buttonGS, GWLP_USERDATA)); // winSaveKeys(); *************** *** 355,368 **** timerId = SetTimer(0,200,NULL); ! SetWindowLongPtr(up, GWL_USERDATA,motion[KEY_UP]); up.SetWindowText(theApp.input->getKeyName(motion[KEY_UP])); ! SetWindowLongPtr(down, GWL_USERDATA,motion[KEY_DOWN]); down.SetWindowText(theApp.input->getKeyName(motion[KEY_DOWN])); ! SetWindowLongPtr(left, GWL_USERDATA,motion[KEY_LEFT]); left.SetWindowText(theApp.input->getKeyName(motion[KEY_LEFT])); ! SetWindowLongPtr(right, GWL_USERDATA,motion[KEY_RIGHT]); right.SetWindowText(theApp.input->getKeyName(motion[KEY_RIGHT])); --- 351,364 ---- timerId = SetTimer(0,200,NULL); ! SetWindowLongPtr(up, GWLP_USERDATA,motion[KEY_UP]); up.SetWindowText(theApp.input->getKeyName(motion[KEY_UP])); ! SetWindowLongPtr(down, GWLP_USERDATA,motion[KEY_DOWN]); down.SetWindowText(theApp.input->getKeyName(motion[KEY_DOWN])); ! SetWindowLongPtr(left, GWLP_USERDATA,motion[KEY_LEFT]); left.SetWindowText(theApp.input->getKeyName(motion[KEY_LEFT])); ! SetWindowLongPtr(right, GWLP_USERDATA,motion[KEY_RIGHT]); right.SetWindowText(theApp.input->getKeyName(motion[KEY_RIGHT])); *************** *** 377,381 **** } ! void MotionConfig::OnTimer(UINT nIDEvent) { theApp.input->checkDevices(); --- 373,377 ---- } ! void MotionConfig::OnTimer(UINT_PTR nIDEvent) { theApp.input->checkDevices(); *************** *** 384,388 **** } ! void MotionConfig::assignKey(int id, int key) { switch(id) { --- 380,384 ---- } ! void MotionConfig::assignKey(int id, LONG_PTR key) { switch(id) { *************** *** 407,419 **** id = IDC_EDIT_UP; ! assignKey(id, GetWindowLongPtr(up, GWL_USERDATA)); id = IDC_EDIT_DOWN; ! assignKey(id, GetWindowLongPtr(down, GWL_USERDATA)); id = IDC_EDIT_LEFT; ! assignKey(id, GetWindowLongPtr(left, GWL_USERDATA)); id = IDC_EDIT_RIGHT; ! assignKey(id, GetWindowLongPtr(right, GWL_USERDATA)); } --- 403,415 ---- id = IDC_EDIT_UP; ! assignKey(id, GetWindowLongPtr(up, GWLP_USERDATA)); id = IDC_EDIT_DOWN; ! assignKey(id, GetWindowLongPtr(down, GWLP_USERDATA)); id = IDC_EDIT_LEFT; ! assignKey(id, GetWindowLongPtr(left, GWLP_USERDATA)); id = IDC_EDIT_RIGHT; ! assignKey(id, GetWindowLongPtr(right, GWLP_USERDATA)); } Index: DirectInput.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/DirectInput.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DirectInput.cpp 27 May 2006 14:47:33 -0000 1.6 --- DirectInput.cpp 6 Jun 2006 21:04:21 -0000 1.7 *************** *** 50,54 **** virtual bool readDevices(); virtual u32 readDevice(int which); ! virtual CString getKeyName(int key); virtual void checkKeys(); virtual void checkMotionKeys(); --- 50,54 ---- virtual bool readDevices(); virtual u32 readDevice(int which); ! virtual CString getKeyName(LONG_PTR key); virtual void checkKeys(); virtual void checkMotionKeys(); *************** *** 85,89 **** static int axisNumber = 0; ! USHORT joypad[4][13] = { { DIK_LEFT, DIK_RIGHT, --- 85,89 ---- static int axisNumber = 0; ! LONG_PTR joypad[4][13] = { { DIK_LEFT, DIK_RIGHT, *************** *** 100,104 **** }; ! USHORT motion[4] = { DIK_NUMPAD4, DIK_NUMPAD6, DIK_NUMPAD8, DIK_NUMPAD2 }; --- 100,104 ---- }; ! LONG_PTR motion[4] = { DIK_NUMPAD4, DIK_NUMPAD6, DIK_NUMPAD8, DIK_NUMPAD2 }; *************** *** 172,176 **** } ! static void winSaveKey(char *name, int num, USHORT value) { char buffer[80]; --- 172,176 ---- } ! static void winSaveKey(char *name, int num, LONG_PTR value) { char buffer[80]; *************** *** 178,182 **** sprintf(buffer, "Joy%d_%s", num, name); ! regSetDwordValue(buffer, value); } --- 178,182 ---- sprintf(buffer, "Joy%d_%s", num, name); ! regSetDwordValue(buffer, (DWORD)value); } *************** *** 200,211 **** regSetDwordValue("joyVersion", 1); ! regSetDwordValue("Motion_Left", ! motion[KEY_LEFT]); ! regSetDwordValue("Motion_Right", ! motion[KEY_RIGHT]); ! regSetDwordValue("Motion_Up", ! motion[KEY_UP]); ! regSetDwordValue("Motion_Down", ! motion[KEY_DOWN]); } --- 200,207 ---- regSetDwordValue("joyVersion", 1); ! regSetDwordValue("Motion_Left", (DWORD)motion[KEY_LEFT]); ! regSetDwordValue("Motion_Right", (DWORD)motion[KEY_RIGHT]); ! regSetDwordValue("Motion_Up", (DWORD)motion[KEY_UP]); ! regSetDwordValue("Motion_Down", (DWORD)motion[KEY_DOWN]); } *************** *** 333,337 **** static void checkKeys() { ! int dev = 0; int i; --- 329,333 ---- static void checkKeys() { ! LONG_PTR dev = 0; int i; *************** *** 628,636 **** } ! BOOL checkKey(int key) { ! int dev = (key >> 8); ! int k = (key & 255); if(dev == 0) { --- 624,632 ---- } ! BOOL checkKey(LONG_PTR key) { ! LONG_PTR dev = (key >> 8); ! LONG_PTR k = (key & 255); if(dev == 0) { *************** *** 638,642 **** } else { if(k < 16) { ! int axis = k >> 1; LONG value = pDevices[dev].axis[axis].center; switch(pDevices[dev].axis[axis].offset) { --- 634,638 ---- } else { if(k < 16) { ! LONG_PTR axis = k >> 1; LONG value = pDevices[dev].axis[axis].center; switch(pDevices[dev].axis[axis].offset) { *************** *** 671,675 **** return value < pDevices[dev].axis[axis].negative; } else if(k < 48) { ! int hat = (k >> 2) & 3; int state = getPovState(pDevices[dev].state.rgdwPOV[hat]); BOOL res = FALSE; --- 667,671 ---- return value < pDevices[dev].axis[axis].negative; } else if(k < 48) { ! LONG_PTR hat = (k >> 2) & 3; int state = getPovState(pDevices[dev].state.rgdwPOV[hat]); BOOL res = FALSE; *************** *** 923,930 **** } ! CString DirectInput::getKeyName(int key) { ! int d = (key >> 8); ! int k = key & 255; DIDEVICEOBJECTINSTANCE di; --- 919,926 ---- } ! CString DirectInput::getKeyName(LONG_PTR key) { ! LONG_PTR d = (key >> 8); ! LONG_PTR k = key & 255; DIDEVICEOBJECTINSTANCE di; *************** *** 937,941 **** if(d == 0) { ! pDevices[0].device->GetObjectInfo(&di,key,DIPH_BYOFFSET); winBuffer = di.tszName; } else { --- 933,937 ---- if(d == 0) { ! pDevices[0].device->GetObjectInfo( &di, (DWORD)key, DIPH_BYOFFSET ); winBuffer = di.tszName; } else { *************** *** 966,975 **** } } else if(k < 48) { ! int hat = (k >> 2) & 3; pDevices[d].device->GetObjectInfo(&di, ! DIJOFS_POV(hat), DIPH_BYOFFSET); char *dir = "up"; ! int dd = k & 3; if(dd == 1) dir = "down"; --- 962,971 ---- } } else if(k < 48) { ! LONG_PTR hat = (k >> 2) & 3; pDevices[d].device->GetObjectInfo(&di, ! (DWORD)DIJOFS_POV(hat), DIPH_BYOFFSET); char *dir = "up"; ! LONG_PTR dd = k & 3; if(dd == 1) dir = "down"; *************** *** 981,985 **** } else { pDevices[d].device->GetObjectInfo(&di, ! DIJOFS_BUTTON(k-128), DIPH_BYOFFSET); winBuffer.Format(winResLoadString(IDS_JOY_BUTTON),d,di.tszName); --- 977,981 ---- } else { pDevices[d].device->GetObjectInfo(&di, ! (DWORD)DIJOFS_BUTTON(k-128), DIPH_BYOFFSET); winBuffer.Format(winResLoadString(IDS_JOY_BUTTON),d,di.tszName); Index: MainWndOptions.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/MainWndOptions.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MainWndOptions.cpp 27 May 2006 14:47:33 -0000 1.8 --- MainWndOptions.cpp 6 Jun 2006 21:04:21 -0000 1.9 *************** *** 1534,1537 **** --- 1534,1538 ---- void MainWnd::OnOptionsFilterDisablemmx() { + #ifdef MMX theApp.disableMMX = !theApp.disableMMX; if(!theApp.disableMMX) *************** *** 1539,1542 **** --- 1540,1544 ---- else cpu_mmx = 0; + #endif } Index: VBA.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/VBA.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** VBA.h 27 May 2006 14:47:33 -0000 1.8 --- VBA.h 6 Jun 2006 21:04:21 -0000 1.9 *************** *** 232,237 **** HMODULE winLoadLanguage(const char *name); void winSetLanguageOption(int option, bool force); - bool detectMMX(); #ifdef MMX #endif void updatePriority(); --- 232,237 ---- HMODULE winLoadLanguage(const char *name); void winSetLanguageOption(int option, bool force); #ifdef MMX + bool detectMMX(); #endif void updatePriority(); Index: skin.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/skin.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** skin.cpp 6 Jun 2006 14:33:43 -0000 1.8 --- skin.cpp 6 Jun 2006 21:04:21 -0000 1.9 *************** *** 151,159 **** m_dOldStyle = dwStyle; dwStyle &= ~(WS_CAPTION|WS_SIZEBOX); - #ifdef _WIN64 SetWindowLongPtr(m_hWnd, GWL_STYLE, dwStyle); - #else - SetWindowLongPtr(m_hWnd, GWL_STYLE, (LONG)dwStyle); - #endif RECT r; --- 151,155 ---- *************** *** 173,181 **** // subclass the window procedure ! #ifdef _WIN64 ! m_OldWndProc = (WNDPROC)SetWindowLongPtr(m_hWnd, GWL_WNDPROC, (LONG_PTR)SkinWndProc); ! #else ! m_OldWndProc = (WNDPROC)LongToPtr(SetWindowLongPtr(m_hWnd, GWL_WNDPROC, PtrToLong(SkinWndProc))); ! #endif // store a pointer to our class instance inside the window procedure. --- 169,173 ---- // subclass the window procedure ! m_OldWndProc = (WNDPROC)SetWindowLongPtr( m_hWnd, GWLP_WNDPROC, (LONG_PTR)SkinWndProc ); // store a pointer to our class instance inside the window procedure. *************** *** 223,231 **** // unsubclass the window procedure ! #ifdef _WIN64 ! OurWnd = (WNDPROC)SetWindowLongPtr(m_hWnd, GWL_WNDPROC, (LONG_PTR)m_OldWndProc); ! #else ! OurWnd = (WNDPROC)LongToPtr(SetWindowLongPtr(m_hWnd, GWL_WNDPROC, PtrToLong(m_OldWndProc))); ! #endif // remove the pointer to our class instance, but if we fail we don't care. --- 215,219 ---- // unsubclass the window procedure ! OurWnd = (WNDPROC)SetWindowLongPtr( m_hWnd, GWLP_WNDPROC, (LONG_PTR)m_OldWndProc ); // remove the pointer to our class instance, but if we fail we don't care. *************** *** 236,244 **** m_bHooked = ( OurWnd ? false : true ); - #ifdef _WIN64 SetWindowLongPtr(m_hWnd, GWL_STYLE, m_dOldStyle); - #else - SetWindowLongPtr(m_hWnd, GWL_STYLE, (LONG)m_dOldStyle); - #endif RECT r; --- 224,228 ---- *************** *** 550,554 **** // we will need a pointer to the associated class instance // (it was stored in the window before, remember?) ! CSkin *pSkin = (CSkin*)GetProp(hWnd, "skin"); // to handle WM_PAINT --- 534,538 ---- // we will need a pointer to the associated class instance // (it was stored in the window before, remember?) ! CSkin *pSkin = (CSkin*)GetProp(hWnd, _T("skin")); // to handle WM_PAINT |
From: Spacy <sp...@us...> - 2006-06-06 21:04:32
|
Update of /cvsroot/vba/VisualBoyAdvance/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv29806/src Modified Files: EEprom.h Flash.h GBA.cpp Sound.cpp Sound.h elf.cpp memgzio.c remote.cpp Log Message: make compilable for Windows x64 Index: Flash.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/Flash.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Flash.h 14 Nov 2004 18:54:14 -0000 1.4 --- Flash.h 6 Jun 2006 21:04:20 -0000 1.5 *************** *** 21,26 **** #define VBA_FLASH_H ! extern void flashSaveGame(gzFile gzFile); ! extern void flashReadGame(gzFile gzFile, int version); extern u8 flashRead(u32 address); extern void flashWrite(u32 address, u8 byte); --- 21,26 ---- #define VBA_FLASH_H ! extern void flashSaveGame(gzFile _gzFile); ! extern void flashReadGame(gzFile _gzFile, int version); extern u8 flashRead(u32 address); extern void flashWrite(u32 address, u8 byte); Index: memgzio.c =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/memgzio.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** memgzio.c 27 May 2006 14:47:32 -0000 1.4 --- memgzio.c 6 Jun 2006 21:04:20 -0000 1.5 *************** *** 332,336 **** if (s->stream.avail_in == 0) { errno = 0; ! s->stream.avail_in = memRead(s->inbuf, 1, Z_BUFSIZE, s->file); if (s->stream.avail_in == 0) { s->z_eof = 1; --- 332,336 ---- if (s->stream.avail_in == 0) { errno = 0; ! s->stream.avail_in = (uInt)memRead(s->inbuf, 1, Z_BUFSIZE, s->file); if (s->stream.avail_in == 0) { s->z_eof = 1; *************** *** 477,482 **** } if (s->stream.avail_out > 0) { ! s->stream.avail_out -= memRead(next_out, 1, s->stream.avail_out, ! s->file); } len -= s->stream.avail_out; --- 477,481 ---- } if (s->stream.avail_out > 0) { ! s->stream.avail_out -= (uInt)memRead(next_out, 1, s->stream.avail_out, s->file); } len -= s->stream.avail_out; *************** *** 489,493 **** errno = 0; ! s->stream.avail_in = memRead(s->inbuf, 1, Z_BUFSIZE, s->file); if (s->stream.avail_in == 0) { s->z_eof = 1; --- 488,492 ---- errno = 0; ! s->stream.avail_in = (uInt)memRead(s->inbuf, 1, Z_BUFSIZE, s->file); if (s->stream.avail_in == 0) { s->z_eof = 1; Index: Sound.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/Sound.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Sound.cpp 25 Jun 2005 06:16:05 -0000 1.16 --- Sound.cpp 6 Jun 2006 21:04:20 -0000 1.17 *************** *** 1,5 **** // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // Copyright (C) 1999-2003 Forgotten ! // Copyright (C) 2005 Forgotten and the VBA development team // This program is free software; you can redistribute it and/or modify --- 1,6 ---- // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // Copyright (C) 1999-2003 Forgotten ! // Copyright (C) 2004 Forgotten and the VBA development team ! // Copyright (C) 2004-2006 VBA development team // This program is free software; you can redistribute it and/or modify *************** *** 19,25 **** #include <memory.h> #include "GBA.h" #include "Globals.h" - #include "Sound.h" #include "Util.h" --- 20,27 ---- #include <memory.h> + #include "Sound.h" + #include "GBA.h" #include "Globals.h" #include "Util.h" *************** *** 27,31 **** #define SOUND_MAGIC 0x60000000 #define SOUND_MAGIC_2 0x30000000 ! #define NOISE_MAGIC 5 extern bool stopState; --- 29,33 ---- #define SOUND_MAGIC 0x60000000 #define SOUND_MAGIC_2 0x30000000 ! #define NOISE_MAGIC 5 extern bool stopState; Index: GBA.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/GBA.cpp,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** GBA.cpp 13 May 2006 16:32:15 -0000 1.66 --- GBA.cpp 6 Jun 2006 21:04:20 -0000 1.67 *************** *** 1231,1241 **** utilPutDword(buffer, 0x000f0000); fwrite(buffer, 1, 4, file); // save type 0x000f0000 = GBA save ! utilPutDword(buffer, strlen(title)); fwrite(buffer, 1, 4, file); // title length fwrite(title, 1, strlen(title), file); ! utilPutDword(buffer, strlen(desc)); fwrite(buffer, 1, 4, file); // desc length fwrite(desc, 1, strlen(desc), file); ! utilPutDword(buffer, strlen(notes)); fwrite(buffer, 1, 4, file); // notes length fwrite(notes, 1, strlen(notes), file); --- 1231,1241 ---- utilPutDword(buffer, 0x000f0000); fwrite(buffer, 1, 4, file); // save type 0x000f0000 = GBA save ! utilPutDword(buffer, (u32)strlen(title)); fwrite(buffer, 1, 4, file); // title length fwrite(title, 1, strlen(title), file); ! utilPutDword(buffer, (u32)strlen(desc)); fwrite(buffer, 1, 4, file); // desc length fwrite(desc, 1, strlen(desc), file); ! utilPutDword(buffer, (u32)strlen(notes)); fwrite(buffer, 1, 4, file); // notes length fwrite(notes, 1, strlen(notes), file); Index: Sound.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/Sound.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Sound.h 13 May 2004 15:06:44 -0000 1.4 --- Sound.h 6 Jun 2006 21:04:20 -0000 1.5 *************** *** 3,6 **** --- 3,7 ---- // Copyright (C) 1999-2003 Forgotten // Copyright (C) 2004 Forgotten and the VBA development team + // Copyright (C) 2004-2006 VBA development team // This program is free software; you can redistribute it and/or modify *************** *** 21,24 **** --- 22,27 ---- #define VBA_SOUND_H + #include "System.h" + #define NR10 0x60 #define NR11 0x62 *************** *** 48,68 **** #define FIFOB_H 0xa6 ! extern void soundTick(); ! extern void soundShutdown(); ! extern bool soundInit(); ! extern void soundPause(); ! extern void soundResume(); ! extern void soundEnable(int); ! extern void soundDisable(int); ! extern int soundGetEnable(); ! extern void soundReset(); ! extern void soundSaveGame(gzFile); ! extern void soundReadGame(gzFile, int); ! extern void soundEvent(u32, u8); ! extern void soundEvent(u32, u16); ! extern void soundTimerOverflow(int); ! extern void soundSetQuality(int); - //extern int SOUND_TICKS; extern int SOUND_CLOCK_TICKS; extern int soundTicks; --- 51,70 ---- #define FIFOB_H 0xa6 ! void soundTick(); ! void soundShutdown(); ! bool soundInit(); ! void soundPause(); ! void soundResume(); ! void soundEnable(int); ! void soundDisable(int); ! int soundGetEnable(); ! void soundReset(); ! void soundSaveGame(gzFile); ! void soundReadGame(gzFile, int); ! void soundEvent(u32, u8); ! void soundEvent(u32, u16); ! void soundTimerOverflow(int); ! void soundSetQuality(int); extern int SOUND_CLOCK_TICKS; extern int soundTicks; Index: EEprom.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/EEprom.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EEprom.h 25 Jun 2005 06:15:34 -0000 1.3 --- EEprom.h 6 Jun 2006 21:04:20 -0000 1.4 *************** *** 21,26 **** #define VBA_EEPROM_H ! extern void eepromSaveGame(gzFile gzFile); ! extern void eepromReadGame(gzFile gzFile, int version); extern int eepromRead(u32 address); extern void eepromWrite(u32 address, u8 value); --- 21,26 ---- #define VBA_EEPROM_H ! extern void eepromSaveGame(gzFile _gzFile); ! extern void eepromReadGame(gzFile _gzFile, int version); extern int eepromRead(u32 address); extern void eepromWrite(u32 address, u8 value); Index: remote.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/remote.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** remote.cpp 20 May 2004 21:01:29 -0000 1.8 --- remote.cpp 6 Jun 2006 21:04:20 -0000 1.9 *************** *** 21,25 **** #include <string.h> ! #ifndef WIN32 # include <unistd.h> # include <sys/socket.h> --- 21,25 ---- #include <string.h> ! #ifndef _WIN32 # include <unistd.h> # include <sys/socket.h> *************** *** 33,37 **** # define socklen_t int # endif // ! HAVE_ARPA_INET_H ! #else // WIN32 # include <winsock.h> # include <io.h> --- 33,37 ---- # define socklen_t int # endif // ! HAVE_ARPA_INET_H ! #else // _WIN32 # include <winsock.h> # include <io.h> *************** *** 40,44 **** # define read _read # define write _write ! #endif // WIN32 #include "GBA.h" --- 40,44 ---- # define read _read # define write _write ! #endif // _WIN32 #include "GBA.h" *************** *** 55,60 **** int remotePort = 55555; int remoteSignal = 5; ! int remoteSocket = -1; ! int remoteListenSocket = -1; bool remoteConnected = false; bool remoteResumed = false; --- 55,60 ---- int remotePort = 55555; int remoteSignal = 5; ! SOCKET remoteSocket = -1; ! SOCKET remoteListenSocket = -1; bool remoteConnected = false; bool remoteResumed = false; *************** *** 86,94 **** { if(remoteSocket == -1) { ! #ifdef WIN32 WSADATA wsaData; int error = WSAStartup(MAKEWORD(1,1),&wsaData); ! #endif // WIN32 ! int s = socket(PF_INET, SOCK_STREAM, 0); remoteListenSocket = s; --- 86,94 ---- { if(remoteSocket == -1) { ! #ifdef _WIN32 WSADATA wsaData; int error = WSAStartup(MAKEWORD(1,1),&wsaData); ! #endif // _WIN32 ! SOCKET s = socket(PF_INET, SOCK_STREAM, 0); remoteListenSocket = s; *************** *** 132,140 **** socklen_t len = sizeof(addr); ! #ifdef WIN32 int flag = 0; ioctlsocket(s, FIONBIO, (unsigned long *)&flag); ! #endif // WIN32 ! int s2 = accept(s, (sockaddr *)&addr, &len); if(s2 > 0) { fprintf(stderr, "Got a connection from %s %d\n", --- 132,140 ---- socklen_t len = sizeof(addr); ! #ifdef _WIN32 int flag = 0; ioctlsocket(s, FIONBIO, (unsigned long *)&flag); ! #endif // _WIN32 ! SOCKET s2 = accept(s, (sockaddr *)&addr, &len); if(s2 > 0) { fprintf(stderr, "Got a connection from %s %d\n", *************** *** 142,148 **** ntohs(addr.sin_port)); } else { ! #ifdef WIN32 int error = WSAGetLastError(); ! #endif // WIN32 } char dummy; --- 142,148 ---- ntohs(addr.sin_port)); } else { ! #ifdef _WIN32 int error = WSAGetLastError(); ! #endif // _WIN32 } char dummy; *************** *** 231,235 **** char buffer[1024]; ! int count = strlen(packet); unsigned char csum = 0; --- 231,235 ---- char buffer[1024]; ! size_t count = strlen(packet); unsigned char csum = 0; *************** *** 247,251 **** *p++ = 0; // printf("Sending %s\n", buffer); ! remoteSendFnc(buffer, count + 4); char c = 0; --- 247,251 ---- *p++ = 0; // printf("Sending %s\n", buffer); ! remoteSendFnc(buffer, (int)count + 4); char c = 0; Index: elf.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/elf.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** elf.cpp 27 May 2006 14:47:32 -0000 1.20 --- elf.cpp 6 Jun 2006 21:04:20 -0000 1.21 *************** *** 962,967 **** break; case DW_FORM_ref_addr: ! attr->value = (elfDebugInfo->infodata + elfRead4Bytes(data)) - ! elfGetCompileUnitForData(data)->top; data += 4; break; --- 962,966 ---- break; case DW_FORM_ref_addr: ! attr->value = (elfDebugInfo->infodata + elfRead4Bytes(data)) - elfGetCompileUnitForData(data)->top; data += 4; break; *************** *** 971,979 **** break; case DW_FORM_ref_udata: ! attr->value = (elfDebugInfo->infodata + ! (elfGetCompileUnitForData(data)->top - ! elfDebugInfo->infodata) + ! elfReadLEB128(data, &bytes)) - ! elfCurrentUnit->top; data += bytes; break; --- 970,974 ---- break; case DW_FORM_ref_udata: ! attr->value = (elfDebugInfo->infodata + (elfGetCompileUnitForData(data)->top - elfDebugInfo->infodata) + elfReadLEB128(data, &bytes)) - elfCurrentUnit->top; data += bytes; break; |
From: Spacy <sp...@us...> - 2006-06-06 21:04:32
|
Update of /cvsroot/vba/VisualBoyAdvance/src/gb In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv29806/src/gb Modified Files: GB.cpp Log Message: make compilable for Windows x64 Index: GB.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/gb/GB.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** GB.cpp 6 Jun 2006 14:25:43 -0000 1.27 --- GB.cpp 6 Jun 2006 21:04:20 -0000 1.28 *************** *** 2912,2916 **** } ! int read = fread(&gbMemory[0xa000], 1, 256, --- 2912,2916 ---- } ! size_t read = fread(&gbMemory[0xa000], 1, 256, *************** *** 2933,2937 **** 1, file); ! if(read >0) { systemMessage(MSG_FAILED_TO_READ_SGM, N_("Battery file's size incompatible with the rom settings %s (%d).\nWarning : save of the battery file is now disabled !"), name, read); --- 2933,2937 ---- 1, file); ! if(read > 0) { systemMessage(MSG_FAILED_TO_READ_SGM, N_("Battery file's size incompatible with the rom settings %s (%d).\nWarning : save of the battery file is now disabled !"), name, read); *************** *** 3066,3070 **** } ! int read = fread(&gbMemory[0xa000], 1, 256, --- 3066,3070 ---- } ! size_t read = fread(&gbMemory[0xa000], 1, 256, *************** *** 3087,3091 **** 1, file); ! if(read >0) { systemMessage(MSG_FAILED_TO_READ_SGM, N_("Battery file's size incompatible with the rom settings %s (%d).\nWarning : save of the battery file is now disabled !"), name, read); --- 3087,3091 ---- 1, file); ! if(read > 0) { systemMessage(MSG_FAILED_TO_READ_SGM, N_("Battery file's size incompatible with the rom settings %s (%d).\nWarning : save of the battery file is now disabled !"), name, read); *************** *** 3386,3390 **** } fseek(file, 0x13, SEEK_SET); ! int read = 0; int toRead = 0; switch(gbRomType) { --- 3386,3390 ---- } fseek(file, 0x13, SEEK_SET); ! size_t read = 0; int toRead = 0; switch(gbRomType) { |
From: Spacy <sp...@us...> - 2006-06-06 21:04:32
|
Update of /cvsroot/vba/VisualBoyAdvance/src/sdl In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv29806/src/sdl Modified Files: SDL.cpp TestEmu.cpp Log Message: make compilable for Windows x64 Index: TestEmu.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/sdl/TestEmu.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TestEmu.cpp 27 May 2006 14:47:33 -0000 1.6 --- TestEmu.cpp 6 Jun 2006 21:04:20 -0000 1.7 *************** *** 35,39 **** #include "../getopt.h" ! #ifndef WIN32 # include <unistd.h> # define GETCWD getcwd --- 35,39 ---- #include "../getopt.h" ! #ifndef _WIN32 # include <unistd.h> # define GETCWD getcwd Index: SDL.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/sdl/SDL.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** SDL.cpp 6 Jun 2006 14:25:17 -0000 1.13 --- SDL.cpp 6 Jun 2006 21:04:20 -0000 1.14 *************** *** 40,50 **** #include "../gb/gbGlobals.h" ! #ifndef WIN32 # include <unistd.h> # define GETCWD getcwd ! #else // WIN32 # include <direct.h> # define GETCWD _getcwd ! #endif // WIN32 #ifndef __GNUC__ --- 40,50 ---- #include "../gb/gbGlobals.h" ! #ifndef _WIN32 # include <unistd.h> # define GETCWD getcwd ! #else // _WIN32 # include <direct.h> # define GETCWD _getcwd ! #endif // _WIN32 #ifndef __GNUC__ *************** *** 867,879 **** char path[2048]; ! #ifdef WIN32 #define PATH_SEP ";" #define FILE_SEP '\\' #define EXE_NAME "VisualBoyAdvance-SDL.exe" ! #else // ! WIN32 #define PATH_SEP ":" #define FILE_SEP '/' #define EXE_NAME "VisualBoyAdvance" ! #endif // ! WIN32 fprintf(stderr, "Searching for file %s\n", name); --- 867,879 ---- char path[2048]; ! #ifdef _WIN32 #define PATH_SEP ";" #define FILE_SEP '\\' #define EXE_NAME "VisualBoyAdvance-SDL.exe" ! #else // ! _WIN32 #define PATH_SEP ":" #define FILE_SEP '/' #define EXE_NAME "VisualBoyAdvance" ! #endif // ! _WIN32 fprintf(stderr, "Searching for file %s\n", name); *************** *** 898,902 **** } ! #ifdef WIN32 home = getenv("USERPROFILE"); if(home != NULL) { --- 898,902 ---- } ! #ifdef _WIN32 home = getenv("USERPROFILE"); if(home != NULL) { *************** *** 907,911 **** return f; } ! #else // ! WIN32 fprintf(stderr, "Searching system config directory: %s\n", SYSCONFDIR); sprintf(path, "%s%c%s", SYSCONFDIR, FILE_SEP, name); --- 907,911 ---- return f; } ! #else // ! _WIN32 fprintf(stderr, "Searching system config directory: %s\n", SYSCONFDIR); sprintf(path, "%s%c%s", SYSCONFDIR, FILE_SEP, name); *************** *** 913,917 **** if(f != NULL) return f; ! #endif // ! WIN32 if(!strchr(arg0, '/') && --- 913,917 ---- if(f != NULL) return f; ! #endif // ! _WIN32 if(!strchr(arg0, '/') && |
From: Spacy <sp...@us...> - 2006-06-06 15:48:34
|
Update of /cvsroot/vba/VisualBoyAdvance/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv25618/src Modified Files: NLS.h Log Message: two IDs were missing Index: NLS.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/NLS.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NLS.h 13 May 2004 15:06:44 -0000 1.4 --- NLS.h 6 Jun 2006 15:19:25 -0000 1.5 *************** *** 61,62 **** --- 61,64 ---- #define MSG_CBA_CODE_WARNING 40 #define MSG_OUT_OF_MEMORY 41 + #define MSG_WRONG_GAMESHARK_CODE 42 + #define MSG_UNSUPPORTED_GAMESHARK_CODE 43 |
From: Spacy <sp...@us...> - 2006-06-06 14:57:16
|
Update of /cvsroot/vba/VisualBoyAdvance/src/gb In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv1412/src/gb Modified Files: GB.cpp GB.h gbCheats.cpp gbCheats.h gbMemory.cpp gbMemory.h Log Message: Pokemonhacker: Improved/corrected the GG and GS cheats handling. Added support for the GS hardware rom bank switching. Corrected a crash in loading GB savestates while in GBC mode. Index: gbMemory.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/gb/gbMemory.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gbMemory.cpp 13 May 2006 16:32:15 -0000 1.6 --- gbMemory.cpp 6 Jun 2006 14:25:43 -0000 1.7 *************** *** 1532,1536 **** } ! mapperMMM01 gbDataMMM01 ={ 0, // RAM enable --- 1532,1536 ---- } ! // MMM01 Used in Momotarou collection (however the rom is corrupted) mapperMMM01 gbDataMMM01 ={ 0, // RAM enable *************** *** 1543,1547 **** }; ! // MBC1 ROM write registers void mapperMMM01ROM(u16 address, u8 value) { --- 1543,1547 ---- }; ! // MMM01 ROM write registers void mapperMMM01ROM(u16 address, u8 value) { *************** *** 1614,1618 **** } ! // MBC1 RAM write void mapperMMM01RAM(u16 address, u8 value) { --- 1614,1618 ---- } ! // MMM01 RAM write void mapperMMM01RAM(u16 address, u8 value) { *************** *** 1653,1654 **** --- 1653,1717 ---- } } + + // GameGenie ROM write registers + void mapperGGROM(u16 address, u8 value) + { + int tmpAddress = 0; + + switch(address & 0x6000) { + case 0x0000: // RAM enable register + break; + case 0x2000: // GameGenie has only a half bank + break; + case 0x4000: // GameGenie has no RAM + if ((address >=0x4001) && (address <= 0x4020)) // GG Hardware Registers + gbMemoryMap[address >> 12][address & 0x0fff] = value; + break; + case 0x6000: // GameGenie has only a half bank + break; + } + } + + + // GS3 Used to emulate the GS V3.0 rom bank switching + mapperGS3 gbDataGS3 = { 1 }; // ROM bank + + void mapperGS3ROM(u16 address, u8 value) + { + int tmpAddress = 0; + + switch(address & 0x6000) { + case 0x0000: // GS has no ram + break; + case 0x2000: // GS has no 'classic' ROM bank select + break; + case 0x4000: // GS has no ram + break; + case 0x6000: // 0x6000 area is RW, and used for GS hardware registers + + if (address == 0x7FE1) // This is the (half) ROM bank select register + { + if(value == gbDataGS3.mapperROMBank) + break; + tmpAddress = value << 13; + + tmpAddress &= gbRomSizeMask; + gbDataGS3.mapperROMBank = value; + gbMemoryMap[0x04] = &gbRom[tmpAddress]; + gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000]; + } + else + gbMemoryMap[address>>12][address & 0x0fff] = value; + break; + } + } + + void memoryUpdateMapGS3() + { + int tmpAddress = gbDataGS3.mapperROMBank << 13; + + tmpAddress &= gbRomSizeMask; + // GS can only change a half ROM bank + gbMemoryMap[0x04] = &gbRom[tmpAddress]; + gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000]; + } \ No newline at end of file Index: gbCheats.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/gb/gbCheats.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gbCheats.h 13 May 2004 15:06:46 -0000 1.3 --- gbCheats.h 6 Jun 2006 14:25:43 -0000 1.4 *************** *** 51,54 **** --- 51,55 ---- extern void gbCheatDisable(int); extern u8 gbCheatRead(u16); + extern void gbCheatWrite(bool); extern int gbCheatNumber; Index: GB.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/gb/GB.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GB.h 27 May 2006 14:47:33 -0000 1.8 --- GB.h 6 Jun 2006 14:25:43 -0000 1.9 *************** *** 39,42 **** --- 39,43 ---- extern bool gbLoadRom(const char *); extern void gbEmulate(int); + extern void gbWriteMemory(register u16, register u8); extern void gbDrawLine(); extern bool gbIsGameboyRom(const char *); Index: gbMemory.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/gb/gbMemory.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gbMemory.h 30 Apr 2006 14:44:16 -0000 1.3 --- gbMemory.h 6 Jun 2006 14:25:43 -0000 1.4 *************** *** 147,150 **** --- 147,154 ---- }; + struct mapperGS3 { + int mapperROMBank; + }; + extern mapperMBC1 gbDataMBC1; extern mapperMBC2 gbDataMBC2; *************** *** 155,158 **** --- 159,163 ---- extern mapperTAMA5 gbDataTAMA5; extern mapperMMM01 gbDataMMM01; + extern mapperGS3 gbDataGS3; void mapperMBC1ROM(u16,u8); *************** *** 180,183 **** --- 185,190 ---- void mapperMMM01ROM(u16,u8); void mapperMMM01RAM(u16,u8); + void mapperGGROM(u16,u8); + void mapperGS3ROM(u16,u8); //extern void (*mapper)(u16,u8); //extern void (*mapperRAM)(u16,u8); *************** *** 193,196 **** --- 200,204 ---- extern void memoryUpdateMapTAMA5(); extern void memoryUpdateMapMMM01(); + extern void memoryUpdateMapGS3(); Index: GB.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/gb/GB.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** GB.cpp 27 May 2006 14:47:33 -0000 1.26 --- GB.cpp 6 Jun 2006 14:25:43 -0000 1.27 *************** *** 134,137 **** --- 134,138 ---- int gbIntBreak = 0; int gbInterruptLaunched = 0; + u8 gbCheatingDevice = 0; // 1 = GS, 2 = GG // breakpoint bool breakpoint = false; *************** *** 726,733 **** #endif - if(mapper) (*mapper)(address, value); return; } --- 727,734 ---- #endif if(mapper) (*mapper)(address, value); return; + } *************** *** 738,744 **** // This part is used to emulate a small difference between hardwares // (check 8-in-1's arrow on GBA/GBC to verify it) ! ((register_LY == 0) && ((gbHardware & 0xa) && (gbScreenOn==false) && ! (register_LCDC & 0x80)) && ! (gbLcdLYIncrementTicksDelayed ==(GBLY_INCREMENT_CLOCK_TICKS-GBLCD_MODE_2_CLOCK_TICKS)))) gbMemoryMap[address>>12][address&0x0fff] = value; return; --- 739,745 ---- // This part is used to emulate a small difference between hardwares // (check 8-in-1's arrow on GBA/GBC to verify it) ! ((register_LY == 0) && ((gbHardware & 0xa) && (gbScreenOn==false) && ! (register_LCDC & 0x80)) && ! (gbLcdLYIncrementTicksDelayed ==(GBLY_INCREMENT_CLOCK_TICKS-GBLCD_MODE_2_CLOCK_TICKS)))) gbMemoryMap[address>>12][address&0x0fff] = value; return; *************** *** 772,785 **** // OAM not accessible during mode 2 & 3. ! if((address < 0xfea0) && ! (((gbHardware & 0xa) && ((gbLcdMode | gbLcdModeDelayed) &2)) || ! ((gbHardware & 5) && (((gbLcdModeDelayed == 2) && ! (gbLcdTicksDelayed<=GBLCD_MODE_2_CLOCK_TICKS)) || ! (gbLcdModeDelayed == 3))))) { ! return; } ! if(address < 0xff00){ gbMemory[address] = value; return; --- 773,793 ---- // OAM not accessible during mode 2 & 3. ! if(address < 0xfea0) ! { ! if (((gbHardware & 0xa) && ((gbLcdMode | gbLcdModeDelayed) &2)) || ! ((gbHardware & 5) && (((gbLcdModeDelayed == 2) && ! (gbLcdTicksDelayed<=GBLCD_MODE_2_CLOCK_TICKS)) || ! (gbLcdModeDelayed == 3)))) ! return; ! else ! { ! gbMemory[address] = value; ! return; ! } } ! ! if((address > 0xfea0) && (address < 0xff00)){ // GBC allows reading/writing to that area gbMemory[address] = value; return; *************** *** 1712,1715 **** --- 1720,1736 ---- break; } + + if ((address >= 0xfea0) && (address < 0xff00)) + { + if (gbHardware & 1) + return ((((address + ((address >> 4) - 0xfea)) >> 2) & 1) ? 0x00 : 0xff ); + else if (gbHardware & 2) + return gbMemoryMap[address>>12][address & 0x0fff]; + else if (gbHardware & 4) + return ((((address + ((address >> 4) - 0xfea)) >> 2) & 1) ? 0xff : 0x00 ); + else if (gbHardware & 8) + return ((address & 0xf0) |((address & 0xf0)>>4)); + } + return gbMemoryMap[address>>12][address & 0x0fff]; } *************** *** 1958,1961 **** --- 1979,1994 ---- return 0xff; + if ((address >= 0xfea0) && (address < 0xff00)) + { + if (gbHardware & 1) + return ((((address + ((address >> 4) - 0xfea)) >> 2) & 1) ? 0x00 : 0xff ); + else if (gbHardware & 2) + return gbMemoryMap[address>>12][address & 0x0fff]; + else if (gbHardware & 4) + return ((((address + ((address >> 4) - 0xfea)) >> 2) & 1) ? 0xff : 0x00 ); + else if (gbHardware & 8) + return ((address & 0xf0) |((address & 0xf0)>>4)); + } + return gbMemoryMap[address>>12][address & 0x0fff]; } *************** *** 1963,1966 **** --- 1996,2000 ---- void gbVblank_interrupt() { + gbCheatWrite(false); // Emulates GS codes. gbMemory[0xff0f] = register_IF &= 0xfe; gbWriteMemory(--SP.W, PC.B.B1); *************** *** 2172,2176 **** if (gbMemory != NULL) { ! memset(gbMemory,0, 65536); for (int temp = 0xC000; temp < 0xE000; temp++) if ((temp & 0x8) ^((temp & 0x800)>>8)) --- 2206,2210 ---- if (gbMemory != NULL) { ! memset(gbMemory,0xff, 65536); for (int temp = 0xC000; temp < 0xE000; temp++) if ((temp & 0x8) ^((temp & 0x800)>>8)) *************** *** 2618,2621 **** --- 2652,2656 ---- inBios = false; } + gbMemoryMap[0x01] = &gbRom[0x1000]; gbMemoryMap[0x02] = &gbRom[0x2000]; *************** *** 2642,2646 **** gbMemoryMap[0x0d] = &gbMemory[0xd000]; gbMemoryMap[0x0e] = &gbMemory[0xe000]; ! gbMemoryMap[0x0f] = &gbMemory[0xf000]; } --- 2677,2681 ---- gbMemoryMap[0x0d] = &gbMemory[0xd000]; gbMemoryMap[0x0e] = &gbMemory[0xe000]; ! gbMemoryMap[0x0f] = &gbMemory[0xf000]; } *************** *** 2660,2663 **** --- 2695,2700 ---- gbSystemMessage = false; + gbCheatWrite(true); // Emulates GS codes. + } *************** *** 3597,3603 **** } - int oldgbCgbMode = gbCgbMode; - int oldgbSgbMode = gbSgbMode; - gbReset(); --- 3634,3637 ---- *************** *** 3608,3634 **** // Correct crash when loading color gameboy save in regular gameboy type. ! if (oldgbCgbMode != gbCgbMode) { ! if (!gbCgbMode) ! { ! if(gbVram != NULL) { ! free(gbVram); ! gbVram = NULL; ! } ! if(gbWram != NULL) { ! free(gbWram); ! gbWram = NULL; ! } } ! else ! { ! if(gbVram == NULL) ! gbVram = (u8 *)malloc(0x4000); ! if(gbWram == NULL) ! gbWram = (u8 *)malloc(0x8000); ! memset(gbVram,0,0x4000); ! memset(gbPalette,0, 2*128); } } if(version >= GBSAVE_GAME_VERSION_7) { --- 3642,3667 ---- // Correct crash when loading color gameboy save in regular gameboy type. ! if (!gbCgbMode) { ! if(gbVram != NULL) { ! free(gbVram); ! gbVram = NULL; } ! if(gbWram != NULL) { ! free(gbWram); ! gbWram = NULL; } } + else + { + if(gbVram == NULL) + gbVram = (u8 *)malloc(0x4000); + if(gbWram == NULL) + gbWram = (u8 *)malloc(0x8000); + memset(gbVram,0,0x4000); + memset(gbPalette,0, 2*128); + } + + if(version >= GBSAVE_GAME_VERSION_7) { *************** *** 3775,3778 **** --- 3808,3815 ---- memoryUpdateMapMBC7(); break; + case 0x56: + // GS3 + memoryUpdateMapGS3(); + break; case 0xfd: // TAMA5 *************** *** 4028,4031 **** --- 4065,4070 ---- if(gbRomSize < gbRomSizes[gbRom[0x148]]) { gbRom = (u8 *)realloc(gbRom, gbRomSizes[gbRom[0x148]]); + for (int i = gbRomSize; i<gbRomSizes[gbRom[0x148]]; i++) + gbRom[i] = 0x00; // Not sure if it's 0x00, 0xff or random data... } // (it's in the case a cart is 'lying' on its size. *************** *** 4060,4063 **** --- 4099,4115 ---- gbRom[0x149] = ramsize; + if ((gbRom[2] == 0x6D) && (gbRom[5] == 0x47) && (gbRom[6] == 0x65) && (gbRom[7] == 0x6E) && + (gbRom[8] == 0x69) && (gbRom[9] == 0x65) && (gbRom[0xA] == 0x28) && (gbRom[0xB] == 0x54)) + { + gbCheatingDevice = 1; // GameGenie + for (int i = 0; i < 0x20; i++) // Cleans GG hardware registers + gbRom[0x4000+i] = 0; + } + else if (((gbRom[0x104] == 0x44) && (gbRom[0x156] == 0xEA) && (gbRom[0x158] == 0x7F) && + (gbRom[0x159] == 0xEA) && (gbRom[0x15B] == 0x7F)) || ((gbRom[0x165] == 0x3E) && + (gbRom[0x166] == 0xD9) && (gbRom[0x16D] == 0xE1) && (gbRom[0x16E] == 0x7F))) + gbCheatingDevice = 2; // GameShark + else gbCheatingDevice = 0; + if(ramsize > 5) { systemMessage(MSG_UNSUPPORTED_RAM_SIZE, *************** *** 4090,4093 **** --- 4142,4149 ---- gbRomType = 0x1b; } + else if (gbCheatingDevice == 1) + gbRomType = 0x55; + else if (gbCheatingDevice == 2) + gbRomType = 0x56; gbRom[0x147] = gbRomType; *************** *** 4101,4105 **** case 0x03: case 0x08: ! case 0x09: // MBC 1 mapper = mapperMBC1ROM; --- 4157,4161 ---- case 0x03: case 0x08: ! case 0x09: // MBC 1 mapper = mapperMBC1ROM; *************** *** 4155,4158 **** --- 4211,4222 ---- mapperReadRAM = mapperMBC7ReadRAM; break; + // GG (GameGenie) + case 0x55: + mapper = mapperGGROM; + break; + case 0x56: + // GS (GameShark) + mapper = mapperGS3ROM; + break; case 0xfd: // TAMA5 Index: gbCheats.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/gb/gbCheats.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** gbCheats.cpp 27 May 2006 14:47:33 -0000 1.10 --- gbCheats.cpp 6 Jun 2006 14:25:43 -0000 1.11 *************** *** 28,34 **** --- 28,36 ---- #include "gbCheats.h" #include "gbGlobals.h" + #include "GB.h" gbCheat gbCheatList[100]; int gbCheatNumber = 0; + int gbNextCheat = 0; bool gbCheatMap[0x10000]; *************** *** 181,188 **** GBCHEAT_HEX_VALUE(code[5]); - if(address < 0xa000 || - address > 0xdfff) - return false; - return true; } --- 183,186 ---- *************** *** 221,227 **** gbCheatList[i].enabled = true; ! ! gbCheatMap[gbCheatList[i].address] = true; ! gbCheatNumber++; } --- 219,233 ---- gbCheatList[i].enabled = true; ! ! int gsCode = gbCheatList[i].code; ! ! if ((gsCode !=1) && ((gsCode & 0xF0) !=0x80) && ((gsCode & 0xF0) !=0x90) && ! ((gsCode & 0xF0) !=0xA0) && ((gsCode) !=0xF0) && ((gsCode) !=0xF1)) ! systemMessage(MSG_WRONG_GAMESHARK_CODE, ! N_("Wrong GameShark code type : %s"), code); ! else if (((gsCode & 0xF0) ==0xA0) || ((gsCode) ==0xF0) || ((gsCode) ==0xF1)) ! systemMessage(MSG_UNSUPPORTED_GAMESHARK_CODE, ! N_("Unsupported GameShark code type : %s"), code); ! gbCheatNumber++; } *************** *** 319,323 **** strcpy(gbCheatList[i].cheatDesc, desc); ! gbCheatList[i].code = 1; gbCheatList[i].value = (GBCHEAT_HEX_VALUE(code[0]) << 4) + GBCHEAT_HEX_VALUE(code[1]); --- 325,329 ---- strcpy(gbCheatList[i].cheatDesc, desc); ! gbCheatList[i].code = 0x101; gbCheatList[i].value = (GBCHEAT_HEX_VALUE(code[0]) << 4) + GBCHEAT_HEX_VALUE(code[1]); *************** *** 344,347 **** --- 350,354 ---- } + gbCheatList[i].enabled = true; *************** *** 428,431 **** --- 435,439 ---- } + // Used to emulated GG codes u8 gbCheatRead(u16 address) { *************** *** 440,461 **** return gbCheatList[i].value; break; ! case 0x00: ! case 0x01: ! case 0x80: ! return gbCheatList[i].value; ! case 0x90: ! case 0x91: ! case 0x92: ! case 0x93: ! case 0x94: ! case 0x95: ! case 0x96: ! case 0x97: ! if(address >= 0xd000 && address < 0xe000) { ! if(((gbMemoryMap[0x0d] - gbWram)/0x1000) == ! (gbCheatList[i].code - 0x90)) ! return gbCheatList[i].value; ! } else return gbCheatList[i].value; } } --- 448,454 ---- return gbCheatList[i].value; break; ! case 0x101: // GameGenie 6 digits code support return gbCheatList[i].value; + break; } } *************** *** 463,464 **** --- 456,518 ---- return gbMemoryMap[address>>12][address&0xFFF]; } + + + // Used to emulate GS codes. + void gbCheatWrite(bool reboot) + { + if(cheatsEnabled) + { + u16 address = 0; + + if (gbNextCheat >= gbCheatNumber) + gbNextCheat = 0; + + for(int i = gbNextCheat; i < gbCheatNumber; i++) { + if(gbCheatList[i].enabled) { + address = gbCheatList[i].address; + if ((!reboot) && (address >= 0x8000) && !((address>=0xA000) && (address<0xC000))) + { // These codes are executed one per one, at each Vblank + switch(gbCheatList[i].code) { + case 0x01: + gbWriteMemory(address, gbCheatList[i].value); + gbNextCheat = i+1; + return; + case 0x90: + case 0x91: + case 0x92: + case 0x93: + case 0x94: + case 0x95: + case 0x96: + case 0x97: + case 0x98: + case 0x99: + case 0x9A: + case 0x9B: + case 0x9C: + case 0x9D: + case 0x9E: + case 0x9F: + int oldbank = gbMemory[0xff70]; + gbWriteMemory(0xff70, gbCheatList[i].code & 0xf); + gbWriteMemory(address, gbCheatList[i].value); + gbWriteMemory(0xff70, oldbank); + gbNextCheat = i+1; + return; + } + } + else // These codes are only executed when the game is booted + { + switch(gbCheatList[i].code & 0xF0) { + case 0x80: + gbWriteMemory(0x0000, 0x0A); + gbWriteMemory(0x4000, gbCheatList[i].value & 0xF); + gbWriteMemory(address, gbCheatList[i].value); + gbNextCheat = i+1; + return; + } + } + } + } + } + } \ No newline at end of file |
Update of /cvsroot/vba/VisualBoyAdvance/src/win32 In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv4915/src/win32 Modified Files: AboutDialog.cpp Joypad.cpp MainWndFile.cpp RomInfo.cpp VBA.cpp resource.h skin.cpp Log Message: Pokemonhacker: Improved/corrected the GG and GS cheats handling. Added support for the GS hardware rom bank switching. Corrected a crash in loading GB savestates while in GBC mode. Spacy: minor Index: VBA.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/VBA.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** VBA.cpp 27 May 2006 14:47:33 -0000 1.15 --- VBA.cpp 6 Jun 2006 14:33:43 -0000 1.16 *************** *** 1338,1344 **** ifbType = 0; ! flashSize = winFlashSize = regQueryDwordValue("flashSize", 0x10000); if(winFlashSize != 0x10000 && winFlashSize != 0x20000) winFlashSize = 0x10000; agbPrintEnable(regQueryDwordValue("agbPrint", 0) ? true : false); --- 1338,1345 ---- ifbType = 0; ! winFlashSize = regQueryDwordValue("flashSize", 0x10000); if(winFlashSize != 0x10000 && winFlashSize != 0x20000) winFlashSize = 0x10000; + flashSize = winFlashSize; agbPrintEnable(regQueryDwordValue("agbPrint", 0) ? true : false); Index: MainWndFile.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/MainWndFile.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** MainWndFile.cpp 27 May 2006 14:47:33 -0000 1.14 --- MainWndFile.cpp 6 Jun 2006 14:33:43 -0000 1.15 *************** *** 738,742 **** CFileStatus status; CString str; ! __time64_t time = (__time64_t)-1; int found = 0; --- 738,742 ---- CFileStatus status; CString str; ! time_t time = (time_t)-1; int found = 0; *************** *** 824,828 **** CFileStatus status; CString str; ! __time64_t time = 0; int found = -1; --- 824,828 ---- CFileStatus status; CString str; ! time_t time = 0; int found = -1; *************** *** 831,835 **** if(emulating && CFile::GetStatus(name, status)) { ! if((unsigned long)status.m_mtime.GetTime() > time) { time = status.m_mtime.GetTime(); found = i; --- 831,835 ---- if(emulating && CFile::GetStatus(name, status)) { ! if(status.m_mtime.GetTime() < time) { time = status.m_mtime.GetTime(); found = i; Index: resource.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/resource.h,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** resource.h 27 May 2006 14:47:33 -0000 1.43 --- resource.h 6 Jun 2006 14:33:43 -0000 1.44 *************** *** 45,48 **** --- 45,50 ---- #define IDS_CBA_CODE_WARNING 40 #define IDS_OUT_OF_MEMORY 41 + #define IDS_WRONG_GAMESHARK_CODE 42 + #define IDS_UNSUPPORTED_GAMESHARK_CODE 43 #define IDI_ICON 101 #define IDD_REGISTERS 102 Index: Joypad.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/Joypad.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Joypad.cpp 27 May 2006 14:47:33 -0000 1.6 --- Joypad.cpp 6 Jun 2006 14:33:43 -0000 1.7 *************** *** 57,61 **** #ifdef _WIN64 SetWindowLongPtr( GetSafeHwnd(), GWL_USERDATA, ((wParam<<8)|lParam) ); ! #elif defined _WIN32 SetWindowLongPtr( GetSafeHwnd(), GWL_USERDATA, PtrToLong((wParam<<8)|lParam) ); #endif --- 57,61 ---- #ifdef _WIN64 SetWindowLongPtr( GetSafeHwnd(), GWL_USERDATA, ((wParam<<8)|lParam) ); ! #else SetWindowLongPtr( GetSafeHwnd(), GWL_USERDATA, PtrToLong((wParam<<8)|lParam) ); #endif Index: AboutDialog.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/AboutDialog.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AboutDialog.cpp 26 May 2006 14:37:41 -0000 1.4 --- AboutDialog.cpp 6 Jun 2006 14:33:43 -0000 1.5 *************** *** 20,26 **** // #include "AboutDialog.h" #include "../AutoBuild.h" - #include "resource.h" #ifdef _DEBUG --- 20,26 ---- // + #include "stdafx.h" #include "AboutDialog.h" #include "../AutoBuild.h" #ifdef _DEBUG Index: RomInfo.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/RomInfo.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RomInfo.cpp 27 May 2006 14:47:33 -0000 1.6 --- RomInfo.cpp 6 Jun 2006 14:33:43 -0000 1.7 *************** *** 402,405 **** --- 402,411 ---- type = "ROM+MBC7+BATT"; break; + case 0x55: + type = "GameGenie"; + break; + case 0x56: + type = "GameShark V3.0"; + break; case 0xfc: type = "ROM+POCKET CAMERA"; Index: skin.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/skin.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** skin.cpp 27 May 2006 14:47:33 -0000 1.7 --- skin.cpp 6 Jun 2006 14:33:43 -0000 1.8 *************** *** 153,157 **** #ifdef _WIN64 SetWindowLongPtr(m_hWnd, GWL_STYLE, dwStyle); ! #elif defined _WIN32 SetWindowLongPtr(m_hWnd, GWL_STYLE, (LONG)dwStyle); #endif --- 153,157 ---- #ifdef _WIN64 SetWindowLongPtr(m_hWnd, GWL_STYLE, dwStyle); ! #else SetWindowLongPtr(m_hWnd, GWL_STYLE, (LONG)dwStyle); #endif *************** *** 175,179 **** #ifdef _WIN64 m_OldWndProc = (WNDPROC)SetWindowLongPtr(m_hWnd, GWL_WNDPROC, (LONG_PTR)SkinWndProc); ! #elif defined _WIN32 m_OldWndProc = (WNDPROC)LongToPtr(SetWindowLongPtr(m_hWnd, GWL_WNDPROC, PtrToLong(SkinWndProc))); #endif --- 175,179 ---- #ifdef _WIN64 m_OldWndProc = (WNDPROC)SetWindowLongPtr(m_hWnd, GWL_WNDPROC, (LONG_PTR)SkinWndProc); ! #else m_OldWndProc = (WNDPROC)LongToPtr(SetWindowLongPtr(m_hWnd, GWL_WNDPROC, PtrToLong(SkinWndProc))); #endif *************** *** 225,229 **** #ifdef _WIN64 OurWnd = (WNDPROC)SetWindowLongPtr(m_hWnd, GWL_WNDPROC, (LONG_PTR)m_OldWndProc); ! #elif defined _WIN32 OurWnd = (WNDPROC)LongToPtr(SetWindowLongPtr(m_hWnd, GWL_WNDPROC, PtrToLong(m_OldWndProc))); #endif --- 225,229 ---- #ifdef _WIN64 OurWnd = (WNDPROC)SetWindowLongPtr(m_hWnd, GWL_WNDPROC, (LONG_PTR)m_OldWndProc); ! #else OurWnd = (WNDPROC)LongToPtr(SetWindowLongPtr(m_hWnd, GWL_WNDPROC, PtrToLong(m_OldWndProc))); #endif *************** *** 238,242 **** #ifdef _WIN64 SetWindowLongPtr(m_hWnd, GWL_STYLE, m_dOldStyle); ! #elif defined _WIN32 SetWindowLongPtr(m_hWnd, GWL_STYLE, (LONG)m_dOldStyle); #endif --- 238,242 ---- #ifdef _WIN64 SetWindowLongPtr(m_hWnd, GWL_STYLE, m_dOldStyle); ! #else SetWindowLongPtr(m_hWnd, GWL_STYLE, (LONG)m_dOldStyle); #endif |
From: Spacy <sp...@us...> - 2006-06-06 14:25:43
|
Update of /cvsroot/vba/VisualBoyAdvance/src/sdl In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv1368/src/sdl Modified Files: SDL.cpp Log Message: Pokemonhacker: Improved/corrected the GG and GS cheats handling. Added support for the GS hardware rom bank switching. Corrected a crash in loading GB savestates while in GBC mode. Index: SDL.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/sdl/SDL.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** SDL.cpp 27 May 2006 14:47:33 -0000 1.12 --- SDL.cpp 6 Jun 2006 14:25:17 -0000 1.13 *************** *** 816,820 **** struct stat buf; ! size_t len = strlen(dir); char *p = dir + len - 1; --- 816,820 ---- struct stat buf; ! int len = strlen(dir); char *p = dir + len - 1; *************** *** 839,843 **** static char filebuffer[2048]; ! size_t len = strlen(name); char *p = name + len - 1; --- 839,843 ---- static char filebuffer[2048]; ! int len = strlen(name); char *p = name + len - 1; *************** *** 2219,2225 **** if(!failed) { gbGetHardwareType(); ! ! // used for the handling of the gb Boot Rom ! if (gbHardware & 5) { char tempName[0x800]; --- 2219,2225 ---- if(!failed) { gbGetHardwareType(); ! ! // used for the handling of the gb Boot Rom ! if (gbHardware & 5) { char tempName[0x800]; *************** *** 2284,2288 **** } } else { ! cartridgeType = IMAGE_GBA; strcpy(filename, "gnu_stub"); rom = (u8 *)malloc(0x2000000); --- 2284,2288 ---- } } else { ! cartridgeType = 0; strcpy(filename, "gnu_stub"); rom = (u8 *)malloc(0x2000000); |
From: Spacy <sp...@us...> - 2006-06-06 03:51:08
|
Update of /cvsroot/vba/VisualBoyAdvance/src/win32 In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv20004/src/win32 Modified Files: DirectSound.cpp Log Message: Fixed a bug. Reworked the whole file. Index: DirectSound.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/DirectSound.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DirectSound.cpp 13 May 2004 15:06:49 -0000 1.3 --- DirectSound.cpp 4 Jun 2006 17:13:56 -0000 1.4 *************** *** 2,5 **** --- 2,6 ---- // Copyright (C) 1999-2003 Forgotten // Copyright (C) 2004 Forgotten and the VBA development team + // Copyright (C) 2004-2006 VBA development team // This program is free software; you can redistribute it and/or modify *************** *** 18,26 **** #include "stdafx.h" ! #include "VBA.h" #include "AVIWrite.h" - #include "Sound.h" #include "WavWriter.h" #include "../System.h" #include "../GBA.h" --- 19,28 ---- #include "stdafx.h" ! ! // Tools #include "AVIWrite.h" #include "WavWriter.h" + // Internals #include "../System.h" #include "../GBA.h" *************** *** 28,373 **** #include "../Sound.h" #include <mmreg.h> #include <dsound.h> class DirectSound : public ISound { private: ! HINSTANCE dsoundDLL; ! LPDIRECTSOUND pDirectSound; ! LPDIRECTSOUNDBUFFER dsbPrimary; ! LPDIRECTSOUNDBUFFER dsbSecondary; ! LPDIRECTSOUNDNOTIFY dsbNotify; ! HANDLE dsbEvent; ! WAVEFORMATEX wfx; public: ! DirectSound(); ! virtual ~DirectSound(); ! bool init(); ! void pause(); ! void reset(); ! void resume(); ! void write(); }; DirectSound::DirectSound() { ! dsoundDLL = NULL; ! pDirectSound = NULL; ! dsbPrimary = NULL; ! dsbSecondary = NULL; ! dsbNotify = NULL; ! dsbEvent = NULL; } DirectSound::~DirectSound() { ! if(theApp.aviRecorder != NULL) { ! delete theApp.aviRecorder; ! theApp.aviRecorder = NULL; ! theApp.aviFrameNumber = 0; ! } ! ! if(theApp.soundRecording) { ! if(theApp.soundRecorder != NULL) { ! delete theApp.soundRecorder; ! theApp.soundRecorder = NULL; ! } ! theApp.soundRecording = false; ! } ! ! if(dsbNotify != NULL) { ! dsbNotify->Release(); ! dsbNotify = NULL; ! } ! if(dsbEvent != NULL) { ! CloseHandle(dsbEvent); ! dsbEvent = NULL; ! } ! ! if(pDirectSound != NULL) { ! if(dsbPrimary != NULL) { ! dsbPrimary->Release(); ! dsbPrimary = NULL; ! } ! ! if(dsbSecondary != NULL) { ! dsbSecondary->Release(); ! dsbSecondary = NULL; ! } ! ! pDirectSound->Release(); ! pDirectSound = NULL; ! } ! ! if(dsoundDLL != NULL) { ! FreeLibrary(dsoundDLL); ! dsoundDLL = NULL; ! } } bool DirectSound::init() { ! HRESULT hr; - dsoundDLL = LoadLibrary("DSOUND.DLL"); - HRESULT (WINAPI *DSoundCreate)(LPCGUID,LPDIRECTSOUND *,IUnknown *); - if(dsoundDLL != NULL) { - DSoundCreate = (HRESULT (WINAPI *)(LPCGUID,LPDIRECTSOUND *,IUnknown *)) - GetProcAddress(dsoundDLL, "DirectSoundCreate"); - - if(DSoundCreate == NULL) { - theApp.directXMessage("DirectSoundCreate"); - return false; - } - } else { - theApp.directXMessage("DSOUND.DLL"); - return false; - } - - if((hr = DSoundCreate(NULL,&pDirectSound,NULL) != DS_OK)) { - // errorMessage(myLoadString(IDS_ERROR_SOUND_CREATE), hr); - systemMessage(IDS_CANNOT_CREATE_DIRECTSOUND, - "Cannot create DirectSound %08x", hr); - pDirectSound = NULL; - dsbSecondary = NULL; - return false; - } ! if((hr=pDirectSound->SetCooperativeLevel((HWND)*theApp.m_pMainWnd, ! DSSCL_EXCLUSIVE)) != DS_OK) { ! // errorMessage(myLoadString(IDS_ERROR_SOUND_LEVEL), hr); ! systemMessage(IDS_CANNOT_SETCOOPERATIVELEVEL, ! "Cannot SetCooperativeLevel %08x", hr); ! return false; ! } - DSBUFFERDESC dsbdesc; - ZeroMemory(&dsbdesc,sizeof(DSBUFFERDESC)); - dsbdesc.dwSize=sizeof(DSBUFFERDESC); - dsbdesc.dwFlags = DSBCAPS_PRIMARYBUFFER; - - if((hr=pDirectSound->CreateSoundBuffer(&dsbdesc, - &dsbPrimary, - NULL) != DS_OK)) { - // errorMessage(myLoadString(IDS_ERROR_SOUND_BUFFER),hr); - systemMessage(IDS_CANNOT_CREATESOUNDBUFFER, - "Cannot CreateSoundBuffer %08x", hr); - return false; - } - - // Set primary buffer format ! memset(&wfx, 0, sizeof(WAVEFORMATEX)); ! wfx.wFormatTag = WAVE_FORMAT_PCM; ! wfx.nChannels = 2; ! switch(soundQuality) { ! case 2: ! wfx.nSamplesPerSec = 22050; ! soundBufferLen = 736*2; ! soundBufferTotalLen = 7360*2; ! break; ! case 4: ! wfx.nSamplesPerSec = 11025; ! soundBufferLen = 368*2; ! soundBufferTotalLen = 3680*2; ! break; ! default: ! soundQuality = 1; ! wfx.nSamplesPerSec = 44100; ! soundBufferLen = 1470*2; ! soundBufferTotalLen = 14700*2; ! } ! wfx.wBitsPerSample = 16; ! wfx.nBlockAlign = (wfx.wBitsPerSample / 8) * wfx.nChannels; ! wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign; - if((hr = dsbPrimary->SetFormat(&wfx)) != DS_OK) { - // errorMessage(myLoadString(IDS_ERROR_SOUND_PRIMARY),hr); - systemMessage(IDS_CANNOT_SETFORMAT_PRIMARY, - "Cannot SetFormat for primary %08x", hr); - return false; - } - - ZeroMemory(&dsbdesc,sizeof(DSBUFFERDESC)); - dsbdesc.dwSize = sizeof(DSBUFFERDESC); - dsbdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2|DSBCAPS_CTRLPOSITIONNOTIFY; - dsbdesc.dwBufferBytes = soundBufferTotalLen; - dsbdesc.lpwfxFormat = &wfx; ! if((hr = pDirectSound->CreateSoundBuffer(&dsbdesc, &dsbSecondary, NULL)) ! != DS_OK) { ! dsbdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2; ! if((hr = pDirectSound->CreateSoundBuffer(&dsbdesc, &dsbSecondary, NULL)) ! != DS_OK) { ! systemMessage(IDS_CANNOT_CREATESOUNDBUFFER_SEC, ! "Cannot CreateSoundBuffer secondary %08x", hr); ! return false; ! } ! } ! dsbSecondary->SetCurrentPosition(0); ! if(!theApp.useOldSync) { ! hr = dsbSecondary->QueryInterface(IID_IDirectSoundNotify, ! (void **)&dsbNotify); ! if(!FAILED(hr)) { ! dsbEvent = CreateEvent(NULL, FALSE, FALSE, NULL); ! ! DSBPOSITIONNOTIFY notify[10]; ! ! for(int i = 0; i < 10; i++) { ! notify[i].dwOffset = i*soundBufferLen; ! notify[i].hEventNotify = dsbEvent; ! } ! if(FAILED(dsbNotify->SetNotificationPositions(10, notify))) { ! dsbNotify->Release(); ! dsbNotify = NULL; ! CloseHandle(dsbEvent); ! dsbEvent = NULL; ! } ! } ! } ! ! hr = dsbPrimary->Play(0,0,DSBPLAY_LOOPING); ! if(hr != DS_OK) { ! // errorMessage(myLoadString(IDS_ERROR_SOUND_PLAYPRIM), hr); ! systemMessage(IDS_CANNOT_PLAY_PRIMARY, "Cannot Play primary %08x", hr); ! return false; ! } ! systemSoundOn = true; ! ! return true; } void DirectSound::pause() { ! if(dsbSecondary != NULL) { ! DWORD status = 0; ! dsbSecondary->GetStatus(&status); ! ! if(status & DSBSTATUS_PLAYING) { ! dsbSecondary->Stop(); ! } ! } } void DirectSound::reset() { ! if(dsbSecondary) { ! dsbSecondary->Stop(); ! dsbSecondary->SetCurrentPosition(0); ! } } void DirectSound::resume() { ! if(dsbSecondary != NULL) { ! dsbSecondary->Play(0,0,DSBPLAY_LOOPING); ! } } void DirectSound::write() { ! int len = soundBufferLen; ! LPVOID lpvPtr1; ! DWORD dwBytes1; ! LPVOID lpvPtr2; ! DWORD dwBytes2; - if(!pDirectSound) - return; ! if(theApp.soundRecording) { ! if(dsbSecondary) { ! if(theApp.soundRecorder == NULL) { ! theApp.soundRecorder = new WavWriter; ! WAVEFORMATEX format; ! dsbSecondary->GetFormat(&format, sizeof(format), NULL); ! if(theApp.soundRecorder->Open(theApp.soundRecordName)) ! theApp.soundRecorder->SetFormat(&format); ! } ! } ! ! if(theApp.soundRecorder) { ! theApp.soundRecorder->AddSound((u8 *)soundFinalWave, len); ! } ! } - if(theApp.aviRecording) { - if(theApp.aviRecorder) { - if(dsbSecondary) { - if(!theApp.aviRecorder->IsSoundAdded()) { - WAVEFORMATEX format; - dsbSecondary->GetFormat(&format, sizeof(format), NULL); - theApp.aviRecorder->SetSoundFormat(&format); - } - } - - theApp.aviRecorder->AddSound((const char *)soundFinalWave, len); - } - } - - HRESULT hr; ! if(!speedup && synchronize && !theApp.throttle) { ! DWORD status=0; ! hr = dsbSecondary->GetStatus(&status); ! if(status && DSBSTATUS_PLAYING) { ! if(!soundPaused) { ! DWORD play; ! while(true) { ! dsbSecondary->GetCurrentPosition(&play, NULL); ! if(play < soundNextPosition || ! play > soundNextPosition+soundBufferLen) { ! break; ! } ! if(dsbEvent) { ! WaitForSingleObject(dsbEvent, 50); ! } ! } ! } ! } else { ! soundPaused = 1; ! } ! } ! // Obtain memory address of write block. This will be in two parts ! // if the block wraps around. ! hr = dsbSecondary->Lock(soundNextPosition, soundBufferLen, &lpvPtr1, ! &dwBytes1, &lpvPtr2, &dwBytes2, ! 0); ! ! // If DSERR_BUFFERLOST is returned, restore and retry lock. ! if (DSERR_BUFFERLOST == hr) { ! dsbSecondary->Restore(); ! hr = dsbSecondary->Lock(soundNextPosition, soundBufferLen,&lpvPtr1, ! &dwBytes1, &lpvPtr2, &dwBytes2, ! 0); ! } ! soundNextPosition += soundBufferLen; ! soundNextPosition = soundNextPosition % soundBufferTotalLen; ! ! if SUCCEEDED(hr) { ! // Write to pointers. ! CopyMemory(lpvPtr1, soundFinalWave, dwBytes1); ! if (NULL != lpvPtr2) { ! CopyMemory(lpvPtr2, soundFinalWave+dwBytes1, dwBytes2); ! } ! // Release the data back to DirectSound. ! hr = dsbSecondary->Unlock(lpvPtr1, dwBytes1, lpvPtr2, ! dwBytes2); ! } } ISound *newDirectSound() { ! return new DirectSound(); } --- 30,366 ---- #include "../Sound.h" + // DirectSound includes + #include <mmsystem.h> #include <mmreg.h> #include <dsound.h> + class DirectSound : public ISound { private: ! LPDIRECTSOUND8 pDirectSound; // DirectSound interface ! LPDIRECTSOUNDBUFFER dsbPrimary; // Primary DirectSound buffer ! LPDIRECTSOUNDBUFFER dsbSecondary; // Secondary DirectSound buffer ! LPDIRECTSOUNDNOTIFY8 dsbNotify; ! HANDLE dsbEvent; ! WAVEFORMATEX wfx; // Primary buffer wave format public: ! DirectSound(); ! virtual ~DirectSound(); ! bool init(); // initialize the primary and secondary sound buffer ! void pause(); // pause the secondary sound buffer ! void reset(); // stop and reset the secondary sound buffer ! void resume(); // resume the secondary sound buffer ! void write(); // write the emulated sound to the secondary sound buffer }; + DirectSound::DirectSound() { ! CoInitialize( NULL ); ! ! pDirectSound = NULL; ! dsbPrimary = NULL; ! dsbSecondary = NULL; ! dsbNotify = NULL; ! dsbEvent = NULL; } + DirectSound::~DirectSound() { ! if(theApp.aviRecorder) { ! delete theApp.aviRecorder; ! theApp.aviRecorder = NULL; ! theApp.aviFrameNumber = 0; ! } ! ! if(theApp.soundRecording) { ! if(theApp.soundRecorder) { ! delete theApp.soundRecorder; ! theApp.soundRecorder = NULL; ! } ! theApp.soundRecording = false; ! } ! ! if(dsbNotify) { ! dsbNotify->Release(); ! dsbNotify = NULL; ! } ! ! if(dsbEvent) { ! CloseHandle(dsbEvent); ! dsbEvent = NULL; ! } ! ! if(pDirectSound) { ! if(dsbPrimary) { ! dsbPrimary->Release(); ! dsbPrimary = NULL; ! } ! if(dsbSecondary) { ! dsbSecondary->Release(); ! dsbSecondary = NULL; ! } ! ! pDirectSound->Release(); ! pDirectSound = NULL; ! } ! ! CoUninitialize(); } + bool DirectSound::init() { ! HRESULT hr; ! DWORD freq; ! DSBUFFERDESC dsbdesc; ! int i; ! // Initialize DirectSound ! if( FAILED( hr = DirectSoundCreate8( &DSDEVID_DefaultPlayback, &pDirectSound, NULL ) ) ) { ! systemMessage( IDS_CANNOT_CREATE_DIRECTSOUND, _T("Cannot create DirectSound %08x"), hr ); ! pDirectSound = NULL; ! return false; ! } ! if( FAILED( hr = pDirectSound->SetCooperativeLevel( theApp.m_pMainWnd->GetSafeHwnd(), DSSCL_EXCLUSIVE ) ) ) { ! systemMessage( IDS_CANNOT_SETCOOPERATIVELEVEL, _T("Cannot SetCooperativeLevel %08x"), hr ); ! return false; ! } ! // Create primary sound buffer ! ZeroMemory( &dsbdesc, sizeof(DSBUFFERDESC) ); ! dsbdesc.dwSize = sizeof(DSBUFFERDESC); ! dsbdesc.dwFlags = DSBCAPS_PRIMARYBUFFER; ! if( FAILED( hr = pDirectSound->CreateSoundBuffer( &dsbdesc, &dsbPrimary, NULL ) ) ) { ! systemMessage(IDS_CANNOT_CREATESOUNDBUFFER, _T("Cannot CreateSoundBuffer %08x"), hr); ! return false; ! } ! switch(soundQuality) ! { ! case 4: ! freq = 11025; ! break; ! case 2: ! freq = 22050; ! break; ! default: ! soundQuality = 1; ! case 1: ! freq = 44100; ! break; ! } ! soundBufferLen = freq*2/30; ! soundBufferTotalLen = soundBufferLen * 10; ! ZeroMemory( &wfx, sizeof(WAVEFORMATEX) ); ! wfx.wFormatTag = WAVE_FORMAT_PCM; ! wfx.nChannels = 2; ! wfx.nSamplesPerSec = freq; ! wfx.wBitsPerSample = 16; ! wfx.nBlockAlign = wfx.nChannels * wfx.wBitsPerSample / 8; ! wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign; ! if( FAILED( hr = dsbPrimary->SetFormat( &wfx ) ) ) { ! systemMessage( IDS_CANNOT_SETFORMAT_PRIMARY, _T("CreateSoundBuffer(primary) failed %08x"), hr ); ! return false; ! } ! ! ! // Create secondary sound buffer ! ZeroMemory( &dsbdesc, sizeof(DSBUFFERDESC) ); ! dsbdesc.dwSize = sizeof(DSBUFFERDESC); ! dsbdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLPOSITIONNOTIFY; ! dsbdesc.dwBufferBytes = soundBufferTotalLen; ! dsbdesc.lpwfxFormat = &wfx; ! ! if( FAILED( hr = pDirectSound->CreateSoundBuffer( &dsbdesc, &dsbSecondary, NULL ) ) ) { ! systemMessage( IDS_CANNOT_CREATESOUNDBUFFER, _T("CreateSoundBuffer(secondary) failed %08x"), hr ); ! return false; ! } ! ! if( FAILED( hr = dsbSecondary->SetCurrentPosition( 0 ) ) ) { ! systemMessage( 0, _T("dsbSecondary->SetCurrentPosition failed %08x"), hr ); ! return false; ! } ! ! ! if( !theApp.useOldSync ) { ! if( FAILED( hr = dsbSecondary->QueryInterface( IID_IDirectSoundNotify8, (LPVOID*)&dsbNotify ) ) ) { ! dsbEvent = CreateEvent( NULL, FALSE, FALSE, NULL ); ! DSBPOSITIONNOTIFY notify[10]; ! for( i = 0; i < 10; i++ ) { ! notify[i].dwOffset = i * soundBufferLen; ! notify[i].hEventNotify = dsbEvent; ! } ! ! if( FAILED( dsbNotify->SetNotificationPositions( 10, notify ) ) ) { ! dsbNotify->Release(); ! dsbNotify = NULL; ! CloseHandle(dsbEvent); ! dsbEvent = NULL; ! } ! } ! } ! ! ! // Play primary buffer ! if( FAILED( hr = dsbPrimary->Play( 0, 0, DSBPLAY_LOOPING ) ) ) { ! systemMessage( IDS_CANNOT_PLAY_PRIMARY, _T("Cannot Play primary %08x"), hr ); ! return false; ! } ! ! systemSoundOn = true; ! ! return true; } + void DirectSound::pause() { ! if( dsbSecondary == NULL ) return; ! ! DWORD status; ! ! dsbSecondary->GetStatus( &status ); ! ! if( status & DSBSTATUS_PLAYING ) dsbSecondary->Stop(); } + void DirectSound::reset() { ! if( dsbSecondary == NULL ) return; ! ! dsbSecondary->Stop(); ! ! dsbSecondary->SetCurrentPosition( 0 ); } + void DirectSound::resume() { ! if( dsbSecondary == NULL ) return; ! ! dsbSecondary->Play( 0, 0, DSBPLAY_LOOPING ); } + void DirectSound::write() { ! if(!pDirectSound) return; ! HRESULT hr; ! DWORD status = 0; ! DWORD play = 0; ! WAVEFORMATEX format; ! LPVOID lpvPtr1; ! DWORD dwBytes1 = 0; ! LPVOID lpvPtr2; ! DWORD dwBytes2 = 0; ! if( theApp.soundRecording ) { ! if( dsbSecondary ) { ! if( theApp.soundRecorder ) { ! theApp.soundRecorder->AddSound( (u8 *)soundFinalWave, soundBufferLen ); ! } else { ! theApp.soundRecorder = new WavWriter; ! dsbSecondary->GetFormat( &format, sizeof(format), NULL ); ! if( theApp.soundRecorder->Open( theApp.soundRecordName ) ) { ! theApp.soundRecorder->SetFormat( &format ); ! } ! } ! } ! } ! ! if( theApp.aviRecording ) { ! if( theApp.aviRecorder ) { ! if( dsbSecondary ) { ! if( !theApp.aviRecorder->IsSoundAdded() ) { ! dsbSecondary->GetFormat( &format, sizeof(format), NULL ); ! theApp.aviRecorder->SetSoundFormat( &format ); ! } ! } ! theApp.aviRecorder->AddSound( (const char *)soundFinalWave, soundBufferLen ); ! } ! } ! ! ! if( !speedup && synchronize && !theApp.throttle ) { ! hr = dsbSecondary->GetStatus(&status); ! if( status & DSBSTATUS_PLAYING ) { ! if( !soundPaused ) { ! while( true ) { ! dsbSecondary->GetCurrentPosition(&play, NULL); ! if( ( play < soundNextPosition ) || ( play > (soundNextPosition + soundBufferLen) ) ) { ! break; ! } ! if( dsbEvent ) { ! WaitForSingleObject(dsbEvent, 50); ! } ! } ! } ! } else { ! soundPaused = 1; ! } ! } ! ! // Obtain memory address of write block. ! // This will be in two parts if the block wraps around. ! if( DSERR_BUFFERLOST == ( hr = dsbSecondary->Lock( ! soundNextPosition, ! soundBufferLen, ! &lpvPtr1, ! &dwBytes1, ! &lpvPtr2, ! &dwBytes2, ! 0 ) ) ) { ! // If DSERR_BUFFERLOST is returned, restore and retry lock. ! dsbSecondary->Restore(); ! hr = dsbSecondary->Lock( ! soundNextPosition, ! soundBufferLen, ! &lpvPtr1, ! &dwBytes1, ! &lpvPtr2, ! &dwBytes2, ! 0 ); ! } ! ! soundNextPosition += soundBufferLen; ! soundNextPosition = soundNextPosition % soundBufferTotalLen; ! if( SUCCEEDED( hr ) ) { ! // Write to pointers. ! CopyMemory( lpvPtr1, soundFinalWave, dwBytes1 ); ! if ( lpvPtr2 ) { ! CopyMemory( lpvPtr2, soundFinalWave + dwBytes1, dwBytes2 ); ! } ! ! // Release the data back to DirectSound. ! hr = dsbSecondary->Unlock( lpvPtr1, dwBytes1, lpvPtr2, dwBytes2 ); ! } else { ! systemMessage( 0, _T("dsbSecondary->Lock() failed: %08x"), hr ); ! return; ! } } + ISound *newDirectSound() { ! return new DirectSound(); } |